-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
Description
Description
STR:
- Attach Otel
ResourceBuilder resourceBuilder = ResourceBuilder.CreateDefault()
.AddService("a2a-poc-service");
_tracerProvider = Sdk.CreateTracerProviderBuilder()
.SetResourceBuilder(resourceBuilder)
.AddSource(SourceName)
.AddSource("*Microsoft.Extensions.AI") // Listen to the Experimental.Microsoft.Extensions.AI source for chat client telemetry.
.AddSource("*Microsoft.Extensions.Agents*") // Listen to the Experimental.Microsoft.Extensions.Agents source for agent telemetry.
.AddConsoleExporter()
////.AddAzureMonitorTraceExporter(options => options.ConnectionString = config.GetRequired("APPLICATION_INSIGHTS_CONNECTION_STRING"))
.Build();
- Create AI Agent:
AIAgent agent = _chatClient
.AsAIAgent(
name: Name,
description: Description,
instructions: Instructions,
tools: _toolRepository.Tools)
.AsBuilder()
.UseOpenTelemetry(sourceName: _otelConfig.SourceName)
.Build();
app.MapAGUI("/", agent);
- Invoke an agent through AGUI:
AGUIChatClient chatClient = new(new(), "http://localhost:5001");
AIAgent aguiAgent = chatClient.AsAIAgent();
await foreach (AgentResponseUpdate update in aguiAgent.RunStreamingAsync("Tell me a joke about a pirate."))
{
Console.Write(update);
}
Console.WriteLine();
Expected:
OTel Telemetry logged to console.
Actual:
No telemetry logged:
Note:
If calling the same agent directly
await foreach (AgentResponseUpdate update in agent.RunStreamingAsync("Tell me a joke about a pirate."))
{
Console.Write(update);
}
Console.WriteLine();
Then telemetry logged as expected:
Code Sample
<PackageReference Include="Microsoft.Agents.AI.A2A" Version="1.0.0-preview.260311.1" />
<PackageReference Include="Microsoft.Agents.AI.AGUI" Version="1.0.0-preview.260311.1" />
<PackageReference Include="Microsoft.Agents.AI.DevUI" Version="1.0.0-preview.260311.1" />
<PackageReference Include="Microsoft.Agents.AI.Hosting.AGUI.AspNetCore" Version="1.0.0-preview.260311.1" />
<PackageReference Include="Microsoft.Extensions.AI" Version="10.4.1" />Error Messages / Stack Traces
Package Versions
1.0.0-preview.260311.1
.NET Version
No response
Additional Context
No response
Reactions are currently unavailable