Language

OpenTelemetryAgent Constructors

Definition

Overloads

Name Description
OpenTelemetryAgent(AIAgent, String)

Initializes a new instance of the OpenTelemetryAgent class.

OpenTelemetryAgent(AIAgent, String, Boolean)

Initializes a new instance of the OpenTelemetryAgent class.

OpenTelemetryAgent(AIAgent, String)

Initializes a new instance of the OpenTelemetryAgent class.

public OpenTelemetryAgent(Microsoft.Agents.AI.AIAgent innerAgent, string? sourceName = default);
new Microsoft.Agents.AI.OpenTelemetryAgent : Microsoft.Agents.AI.AIAgent * string -> Microsoft.Agents.AI.OpenTelemetryAgent
Public Sub New (innerAgent As AIAgent, Optional sourceName As String = Nothing)

Parameters

innerAgent
AIAgent

The underlying AIAgent to be augmented with telemetry capabilities.

sourceName
String

An optional source name that will be used to identify telemetry data from this agent. If not provided, a default source name will be used for telemetry identification.

Exceptions

innerAgent is null.

Remarks

The constructor automatically extracts provider metadata from the inner agent and configures telemetry collection according to OpenTelemetry semantic conventions for AI systems.

Applies to

OpenTelemetryAgent(AIAgent, String, Boolean)

Initializes a new instance of the OpenTelemetryAgent class.

public OpenTelemetryAgent(Microsoft.Agents.AI.AIAgent innerAgent, string? sourceName, bool autoWireChatClient);
new Microsoft.Agents.AI.OpenTelemetryAgent : Microsoft.Agents.AI.AIAgent * string * bool -> Microsoft.Agents.AI.OpenTelemetryAgent
Public Sub New (innerAgent As AIAgent, sourceName As String, autoWireChatClient As Boolean)

Parameters

innerAgent
AIAgent

The underlying AIAgent to be augmented with telemetry capabilities.

sourceName
String

An optional source name that will be used to identify telemetry data from this agent. If not provided, a default source name will be used for telemetry identification.

autoWireChatClient
Boolean

When true and the inner agent is a ChatClientAgent, the underlying IChatClient is automatically wrapped with OpenTelemetryChatClient for each invocation so that chat-level telemetry flows alongside agent-level telemetry. If the underlying chat client is already instrumented, no additional wrapping is applied. Set to false to opt-out of this behavior.

Exceptions

innerAgent is null.

Remarks

The constructor automatically extracts provider metadata from the inner agent and configures telemetry collection according to OpenTelemetry semantic conventions for AI systems.

Applies to