# AI tracing: .NET AI

Any IChatClient (OpenAI, Azure OpenAI, Ollama and others) and Semantic Kernel or Agent Framework apps built on it.

## 1. Add the OpenTelemetry step to your chat client

UseOpenTelemetry creates a span for every chat call and tool call. EnableSensitiveData puts prompts and answers on the spans; leave it off to send counts and timings only.

```
IChatClient chat = new OpenAI.Chat.ChatClient("gpt-5", apiKey)
    .AsIChatClient()
    .AsBuilder()
    .UseOpenTelemetry(sourceName: "MyApp.AI", configure: o => o.EnableSensitiveData = true)
    .UseFunctionInvocation()
    .Build();
```

## 2. Listen to that source

Add the source name to the tracing your service already sends to PowerTraces.

```
builder.AddPowerTraces();
builder.Services.ConfigureOpenTelemetryTracerProvider(t => t.AddSource("MyApp.AI"));
```

The same pipeline works for Azure OpenAI, Ollama and any other IChatClient. Keep UseOpenTelemetry before UseFunctionInvocation so each tool call becomes its own step.

## Prompts and answers

Most libraries send only counts and timings until you turn content on. When you do, PowerTraces keeps it, masks personal data, or drops it, as set in AI › Settings for each workspace.

## Check it works

Make one model call, then open the AI page: the run appears within a minute. Open it to see each step in the Agent tab.

## Other providers

- [Claude](https://powertraces.com/docs/ai/claude)
- [OpenAI / ChatGPT](https://powertraces.com/docs/ai/openai)
- [Gemini](https://powertraces.com/docs/ai/gemini)
- [Vercel AI SDK](https://powertraces.com/docs/ai/vercel)
- [LangChain · LlamaIndex](https://powertraces.com/docs/ai/frameworks)
- [Amazon Bedrock](https://powertraces.com/docs/ai/bedrock)
- [Other providers](https://powertraces.com/docs/ai/others)

[All documentation](https://powertraces.com/docs)
