Record Class ExecutionTrace

java.lang.Object
java.lang.Record
cloud.opencode.base.rules.trace.ExecutionTrace
Record Components:
ruleTraces - trace per rule | 每个规则的轨迹
totalDuration - total engine execution time | 引擎执行总时间
firedCount - count of fired rules | 已触发规则的数量
skippedCount - count of skipped rules | 已跳过规则的数量
failedCount - count of failed rules | 已失败规则的数量

public record ExecutionTrace(List<RuleTrace> ruleTraces, Duration totalDuration, int firedCount, int skippedCount, int failedCount) extends Record
Execution Trace - Records the Complete Execution Trace of a Rule Engine Run 执行轨迹 - 记录规则引擎一次运行的完整执行轨迹

Aggregates individual rule traces with summary counts and total duration.

聚合单个规则轨迹,提供汇总计数和总持续时间。

Since:
JDK 25, opencode-base-rules V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • ExecutionTrace

      public ExecutionTrace(List<RuleTrace> ruleTraces, Duration totalDuration, int firedCount, int skippedCount, int failedCount)
      Canonical constructor with validation 带验证的规范构造函数
      Parameters:
      ruleTraces - trace per rule | 每个规则的轨迹
      totalDuration - total engine execution time | 引擎执行总时间
      firedCount - count of fired rules | 已触发规则的数量
      skippedCount - count of skipped rules | 已跳过规则的数量
      failedCount - count of failed rules | 已失败规则的数量
  • Method Details

    • of

      public static ExecutionTrace of(List<RuleTrace> traces, Duration totalDuration)
      Creates an execution trace from a list of rule traces and total duration, computing fired/skipped/failed counts automatically 从规则轨迹列表和总持续时间创建执行轨迹,自动计算触发/跳过/失败计数
      Parameters:
      traces - the rule traces | 规则轨迹
      totalDuration - the total duration | 总持续时间
      Returns:
      the execution trace | 执行轨迹
    • firedRules

      public List<RuleTrace> firedRules()
      Returns the list of rule traces that fired 返回已触发的规则轨迹列表
      Returns:
      list of fired rule traces | 已触发的规则轨迹列表
    • failedRules

      public List<RuleTrace> failedRules()
      Returns the list of rule traces that failed 返回已失败的规则轨迹列表
      Returns:
      list of failed rule traces | 已失败的规则轨迹列表
    • getTrace

      public Optional<RuleTrace> getTrace(String ruleName)
      Finds a rule trace by rule name 按规则名称查找规则轨迹
      Parameters:
      ruleName - the rule name | 规则名称
      Returns:
      optional containing the trace, empty if not found | 包含轨迹的Optional,如果未找到则为空
    • 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.
    • ruleTraces

      public List<RuleTrace> ruleTraces()
      Returns the value of the ruleTraces record component.
      Returns:
      the value of the ruleTraces record component
    • totalDuration

      public Duration totalDuration()
      Returns the value of the totalDuration record component.
      Returns:
      the value of the totalDuration record component
    • firedCount

      public int firedCount()
      Returns the value of the firedCount record component.
      Returns:
      the value of the firedCount record component
    • skippedCount

      public int skippedCount()
      Returns the value of the skippedCount record component.
      Returns:
      the value of the skippedCount record component
    • failedCount

      public int failedCount()
      Returns the value of the failedCount record component.
      Returns:
      the value of the failedCount record component