`Class Instrumentation`

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

public final class Instrumentation extends Object
这是一个统一的上下文管理器工具类,用于在 ADK(Adobe Digital Kit)中收集代理(agent)和工具(tool)执行过程中的遥测数据(telemetry information)。
  • 方法详细信息(Method Details)

    • recordAgentInvocation

      @Deprecated public static Instrumentation.AgentInvocation recordAgentInvocation(InvocationContext ctx, BaseAgent agent)
      Deprecated.
      Use the version with explicit parent context instead. This method will be removed once all callers are updated.
      创建一个 `AgentInvocation` 上下文对象,用于记录代理调用的相关数据(即代理调用的“遥测”信息)。
    • recordAgentInvocation

      public static Instrumentation.AgentInvocation recordAgentInvocation(InvocationContext ctx, BaseAgent agent, io.opentelemetry.context.Context parentContext)
      创建一个…… Instrumentation.AgentInvocation 用于记录代理调用遥测数据的上下文环境,其中包含一个明确的父上下文(parent context)。
      Parameters:
      ctx - The invocation context of the agent execution.
      agent - The agent being invoked.
      parentContext - The OpenTelemetry parent context.
      Returns:
      A new Instrumentation.AgentInvocation scope.
    • recordToolExecution

      public static Instrumentation.ToolExecution recordToolExecution(BaseTool tool, BaseAgent agent, Map<String,Object> functionArgs)
      创建一个 `ToolExecution` 上下文对象,用于记录工具执行过程中的相关数据(即“遥测信息”)。
    • recordToolExecution

      public static Instrumentation.ToolExecution recordToolExecution(BaseTool tool, BaseAgent agent, Map<String,Object> functionArgs, io.opentelemetry.context.Context parentContext)
      创建一个 Instrumentation.ToolExecution 用于记录工具执行情况的遥测数据(telemetry)的上下文环境;该上下文环境具有明确的“父上下文”(parent context)。
      Parameters:
      tool - The tool being executed.
      agent - The agent invoking the tool.
      functionArgs - The arguments passed to the tool.
      parentContext - The OpenTelemetry parent context.
      Returns:
      A new Instrumentation.ToolExecution scope.