Record Class DiagnosticReport

java.lang.Object
java.lang.Record
dev.ua.theroer.magicutils.diagnostics.DiagnosticReport
Record Components:
runtimeName - logical runtime name
mode - execution mode
startedAt - start timestamp
duration - total duration
results - 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 Details

  • 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 FAIL carries a severity greater than or equal to DiagnosticSeverity.CRITICAL.

      Returns:
      true when the report is ready for publication
    • isPublishable

      public boolean isPublishable(DiagnosticSeverity threshold)
      Returns the publish-readiness verdict using a custom severity threshold.

      The report is publishable when it contains no result whose status is DiagnosticStatus.FAIL and whose severity is greater than or equal to the given threshold (compared by enum order: INFO < WARNING < CRITICAL). Non-FAIL statuses (including WARN) never block publication.

      Parameters:
      threshold - minimal blocking severity; defaults to DiagnosticSeverity.CRITICAL when null
      Returns:
      true when the report is ready for publication
    • blockingResults

      public List<DiagnosticResult> blockingResults(DiagnosticSeverity threshold)
      Returns the results that block publication for the given severity threshold.

      A result blocks publication when its status is DiagnosticStatus.FAIL and its severity is greater than or equal to the threshold (compared by enum order: INFO < WARNING < CRITICAL).

      Parameters:
      threshold - minimal blocking severity; defaults to DiagnosticSeverity.CRITICAL when null
      Returns:
      immutable list of blocking results, empty when publishable
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • runtimeName

      public String runtimeName()
      Returns the value of the runtimeName record component.
      Returns:
      the value of the runtimeName record component
    • mode

      public DiagnosticMode mode()
      Returns the value of the mode record component.
      Returns:
      the value of the mode record component
    • startedAt

      public Instant startedAt()
      Returns the value of the startedAt record component.
      Returns:
      the value of the startedAt record component
    • duration

      public Duration duration()
      Returns the value of the duration record component.
      Returns:
      the value of the duration record component
    • technical

      public Map<String,Object> technical()
      Returns the value of the technical record component.
      Returns:
      the value of the technical record component
    • results

      public List<DiagnosticResult> results()
      Returns the value of the results record component.
      Returns:
      the value of the results record component