“Class Metrics”(类指标)

java.lang.Object
com.google.adk.telemetry.Metrics

public final class Metrics extends Object
这是一个用于在 ADK(Android Development Kit)中记录 OpenTelemetry 指标的实用类。
  • 方法详细信息(Method Details)

    • setMeterForTesting

      public static void setMeterForTesting(io.opentelemetry.api.metrics.Meter meter)
      用于设置将用于收集指标数据的 OpenTelemetry 计量器(meter)。此功能仅用于测试目的。
    • recordAgentInvocationDuration

      public static void recordAgentInvocationDuration(String agentName, Duration duration, @Nullable Throwable error)
      记录代理程序被调用的持续时间。
    • recordAgentRequestSize

      public static void recordAgentRequestSize(String agentName, @Nullable com.google.genai.types.Content userContent)
      记录代理请求的大小。
    • recordAgentResponseSize

      public static void recordAgentResponseSize(String agentName, @Nullable List<Event> events)
      通过从事件中提取内容来记录代理响应的大小。
    • recordAgentWorkflowSteps

      public static void recordAgentWorkflowSteps(String agentName, List<Event> events)
      通过统计事件的数量来记录代理工作流程中的步骤数。
    • recordToolExecutionDuration

      public static void recordToolExecutionDuration(String toolName, String agentName, Duration duration, @Nullable Throwable error)
      记录工具执行的持续时间。
    • recordToolRequestSize

      public static void recordToolRequestSize(String toolName, String agentName, Map<String,Object> functionArgs)
      记录工具请求的大小。
    • recordToolResponseSize

      public static void recordToolResponseSize(String toolName, String agentName, @Nullable Event responseEvent)
      记录工具响应的数据大小。