OpenTelemetryChatClientBuilderExtensions.UseOpenTelemetry Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Adds OpenTelemetry support to the chat client pipeline, following the OpenTelemetry Semantic Conventions for Generative AI systems.
public static Microsoft.Extensions.AI.ChatClientBuilder UseOpenTelemetry (this Microsoft.Extensions.AI.ChatClientBuilder builder, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory = default, string? sourceName = default, Action<Microsoft.Extensions.AI.OpenTelemetryChatClient>? configure = default);
static member UseOpenTelemetry : Microsoft.Extensions.AI.ChatClientBuilder * Microsoft.Extensions.Logging.ILoggerFactory * string * Action<Microsoft.Extensions.AI.OpenTelemetryChatClient> -> Microsoft.Extensions.AI.ChatClientBuilder
<Extension()>
Public Function UseOpenTelemetry (builder As ChatClientBuilder, Optional loggerFactory As ILoggerFactory = Nothing, Optional sourceName As String = Nothing, Optional configure As Action(Of OpenTelemetryChatClient) = Nothing) As ChatClientBuilder
Parameters
- builder
- ChatClientBuilder
The ChatClientBuilder.
- loggerFactory
- ILoggerFactory
An optional ILoggerFactory to use to create a logger for logging events.
- sourceName
- String
An optional source name that will be used on the telemetry data.
- configure
- Action<OpenTelemetryChatClient>
An optional callback that can be used to configure the OpenTelemetryChatClient instance.
Returns
The builder
.
Remarks
The draft specification this follows is available at https://opentelemetry.io/docs/specs/semconv/gen-ai/. The specification is still experimental and subject to change; as such, the telemetry output by this client is also subject to change.