`Class Instrumentation`
java.lang.Object
com.google.adk.telemetry.Instrumentation
这是一个统一的上下文管理器工具类,用于在 ADK(Adobe Digital Kit)中收集代理(agent)和工具(tool)执行过程中的遥测数据(telemetry information)。
-
嵌套类概述
Nested ClassesModifier and TypeClassDescriptionstatic final class用于代理调用的、可自动关闭的遥测数据跟踪功能。static class用于实现自动关闭(AutoCloseable)功能的遥测跟踪框架(telemetry tracking framework)的基类。static final class存储所有与遥测相关的状态信息。static final class用于工具执行的、可自动关闭的遥测数据跟踪功能。 -
方法概述
Modifier and TypeMethodDescriptionrecordAgentInvocation(InvocationContext ctx, BaseAgent agent) 已弃用(Deprecated)。请改用那些明确指定了父上下文的版本。recordAgentInvocation(InvocationContext ctx, BaseAgent agent, io.opentelemetry.context.Context parentContext) 创建一个……Instrumentation.AgentInvocation用于记录代理调用遥测数据的上下文环境,其中包含一个明确的父上下文(parent context)。创建一个 `ToolExecution` 上下文对象,用于记录工具执行过程中的相关数据(即“遥测信息”)。recordToolExecution(BaseTool tool, BaseAgent agent, Map<String, Object> functionArgs, io.opentelemetry.context.Context parentContext) 创建一个Instrumentation.ToolExecution用于记录工具执行情况的遥测数据(telemetry)的上下文环境;该上下文环境具有明确的“父上下文”(parent context)。
-
方法详细信息(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.AgentInvocationscope.
-
recordToolExecution
-
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.ToolExecutionscope.
-