Record Class DiagnosticReport
java.lang.Object
java.lang.Record
dev.ua.theroer.magicutils.diagnostics.DiagnosticReport
- Record Components:
runtimeName- logical runtime namemode- execution modestartedAt- start timestampduration- total durationresults- collected results
public record DiagnosticReport(String runtimeName, DiagnosticMode mode, Instant startedAt, Duration duration, Map<String,Object> technical, List<DiagnosticResult> results)
extends Record
Aggregated runtime diagnostics report.
-
Constructor Summary
ConstructorsConstructorDescriptionDiagnosticReport(String runtimeName, DiagnosticMode mode, Instant startedAt, Duration duration, List<DiagnosticResult> results) DiagnosticReport(String runtimeName, DiagnosticMode mode, Instant startedAt, Duration duration, Map<String, Object> technical, List<DiagnosticResult> results) Creates a normalized report. -
Method Summary
Modifier and TypeMethodDescriptionblockingResults(DiagnosticSeverity threshold) Returns the results that block publication for the given severity threshold.duration()Returns the value of thedurationrecord component.final booleanIndicates whether some other object is "equal to" this one.intCount of FAIL results.booleanReturns true when at least one check failed.final inthashCode()Returns a hash code value for this object.booleanReturns the publish-readiness verdict using the default severity threshold (DiagnosticSeverity.CRITICAL).booleanisPublishable(DiagnosticSeverity threshold) Returns the publish-readiness verdict using a custom severity threshold.mode()Returns the value of themoderecord component.intokCount()Count of OK results.results()Returns the value of theresultsrecord component.Returns the value of theruntimeNamerecord component.intCount of SKIPPED results.Returns the value of thestartedAtrecord component.Returns the value of thetechnicalrecord component.final StringtoString()Returns a string representation of this record class.intCount of WARN results.
-
Constructor Details
-
DiagnosticReport
public DiagnosticReport(String runtimeName, DiagnosticMode mode, Instant startedAt, Duration duration, List<DiagnosticResult> results) -
DiagnosticReport
public DiagnosticReport(String runtimeName, DiagnosticMode mode, Instant startedAt, Duration duration, Map<String, Object> technical, List<DiagnosticResult> results) Creates a normalized report.- Parameters:
runtimeName- logical runtime namemode- execution modestartedAt- start timestampduration- total durationresults- collected results
-
-
Method Details
-
okCount
public int okCount()Count of OK results.- Returns:
- OK count
-
warnCount
public int warnCount()Count of WARN results.- Returns:
- WARN count
-
failCount
public int failCount()Count of FAIL results.- Returns:
- FAIL count
-
skippedCount
public int skippedCount()Count of SKIPPED results.- Returns:
- SKIPPED count
-
hasFailures
public boolean hasFailures()Returns true when at least one check failed.- Returns:
- true when report contains failures
-
isPublishable
public boolean isPublishable()Returns the publish-readiness verdict using the default severity threshold (DiagnosticSeverity.CRITICAL).The report is publishable when no check with status
FAILcarries a severity greater than or equal toDiagnosticSeverity.CRITICAL.- Returns:
- true when the report is ready for publication
-
isPublishable
Returns the publish-readiness verdict using a custom severity threshold.The report is publishable when it contains no result whose status is
DiagnosticStatus.FAILand whose severity is greater than or equal to the giventhreshold(compared by enum order:INFO < WARNING < CRITICAL). Non-FAILstatuses (includingWARN) never block publication.- Parameters:
threshold- minimal blocking severity; defaults toDiagnosticSeverity.CRITICALwhennull- Returns:
- true when the report is ready for publication
-
blockingResults
Returns the results that block publication for the given severity threshold.A result blocks publication when its status is
DiagnosticStatus.FAILand its severity is greater than or equal to thethreshold(compared by enum order:INFO < WARNING < CRITICAL).- Parameters:
threshold- minimal blocking severity; defaults toDiagnosticSeverity.CRITICALwhennull- Returns:
- immutable list of blocking results, empty when publishable
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
runtimeName
Returns the value of theruntimeNamerecord component.- Returns:
- the value of the
runtimeNamerecord component
-
mode
-
startedAt
-
duration
-
technical
-
results
-