Record Class SlowLogCollector.Stats

java.lang.Object
java.lang.Record
cloud.opencode.base.observability.SlowLogCollector.Stats
Record Components:
totalSlowOps - total number of slow operations recorded (cumulative) | 记录的慢操作总数(累积)
maxDuration - the longest duration among all buffered slow operations | 缓冲的最长耗时
avgDuration - the average duration of all buffered slow operations | 缓冲的平均耗时
slowestOperation - the operation type with the longest duration | 耗时最长的操作类型
Enclosing class:
SlowLogCollector

public static record SlowLogCollector.Stats(long totalSlowOps, Duration maxDuration, Duration avgDuration, String slowestOperation) extends Record
Aggregated statistics for recorded slow operations. 已记录慢操作的聚合统计信息。
Since:
JDK 25, opencode-base-observability V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Field Details

    • EMPTY

      public static final SlowLogCollector.Stats EMPTY
      Empty stats instance returned when no slow operations have been recorded. 未记录慢操作时返回的空统计实例。
  • Constructor Details

    • Stats

      public Stats(long totalSlowOps, Duration maxDuration, Duration avgDuration, String slowestOperation)
      Creates an instance of a Stats record class.
      Parameters:
      totalSlowOps - the value for the totalSlowOps record component
      maxDuration - the value for the maxDuration record component
      avgDuration - the value for the avgDuration record component
      slowestOperation - the value for the slowestOperation record component
  • Method Details

    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • totalSlowOps

      public long totalSlowOps()
      Returns the value of the totalSlowOps record component.
      Returns:
      the value of the totalSlowOps record component
    • maxDuration

      public Duration maxDuration()
      Returns the value of the maxDuration record component.
      Returns:
      the value of the maxDuration record component
    • avgDuration

      public Duration avgDuration()
      Returns the value of the avgDuration record component.
      Returns:
      the value of the avgDuration record component
    • slowestOperation

      public String slowestOperation()
      Returns the value of the slowestOperation record component.
      Returns:
      the value of the slowestOperation record component