OpenTelemetryAgentDecorator
AgentPrism.Core.dllWraps every agent resolved from the catalog with Microsoft Agent Framework’s
AI.OpenTelemetryAgent decorator.
public sealed class OpenTelemetryAgentDecorator : IAgentDecoratorInheritance
Section titled “Inheritance”object ← OpenTelemetryAgentDecorator
Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”OpenTelemetryAgentDecorator.Order is 10. It is outside RunRecordingAgentDecorator
at 0 and inside tool approval at 20. The generated invoke_agent span is
therefore a child of agentprism.run, and the waterfall view shows the right hierarchy.
Passes autoWireChatClient: false. The chat client pipeline already uses
UseOpenTelemetry(AgentPrismDiagnostics.ActivitySourceName). See
OpenAIChatClientFactory. Automatic wiring would wrap the same client twice
and produce duplicate spans for each model call.
Constructors
Section titled “Constructors”OpenTelemetryAgentDecorator(IOptions<AgentPrismOptions>)
Section titled “ OpenTelemetryAgentDecorator(IOptions<AgentPrismOptions>)”Initializes a new telemetry decorator.
public OpenTelemetryAgentDecorator(IOptions<AgentPrismOptions> options)Parameters
Section titled “Parameters”options IOptions<AgentPrismOptions>
The AgentPrism options.
Exceptions
Section titled “Exceptions”options is null.
Properties
Section titled “Properties”Gets the order of application. A lower value wraps inside, a higher value wraps outside. Run recording uses 0, which makes it the outermost decorator.
public int Order { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Decorate(AIAgent, AgentDescriptor)
Section titled “ Decorate(AIAgent, AgentDescriptor)”Decorates the agent.
public AIAgent Decorate(AIAgent agent, AgentDescriptor descriptor)Parameters
Section titled “Parameters”agent AIAgent
The agent to decorate.
descriptor AgentDescriptor
The catalog summary of the agent.
Returns
Section titled “Returns”AIAgent
The decorated agent.