.NET: Add otel file logging and switch samples to projects client with store=true (#5924)

* Add otel file logging and switch samples to projects client with store=true

* Fix formatting and remove rogue file
This commit is contained in:
westey
2026-05-18 17:39:29 +00:00
committed by GitHub
parent 7cea5e162a
commit eff36b504e
13 changed files with 216 additions and 46 deletions
@@ -130,7 +130,7 @@ public sealed class HarnessAgent : DelegatingAIAgent
if (options?.DisableOpenTelemetry is not true)
{
builder.UseOpenTelemetry();
builder.UseOpenTelemetry(sourceName: options?.OpenTelemetrySourceName);
}
return builder.Build();
@@ -183,6 +183,8 @@ public sealed class HarnessAgent : DelegatingAIAgent
AIContextProviders = contextProviders,
UseProvidedChatClientAsIs = true,
RequirePerServiceCallChatHistoryPersistence = true,
WarnOnChatHistoryProviderConflict = false,
ThrowOnChatHistoryProviderConflict = false,
});
}
@@ -206,4 +206,16 @@ public sealed class HarnessAgentOptions
/// following the Semantic Conventions for Generative AI systems.
/// </remarks>
public bool DisableOpenTelemetry { get; set; }
/// <summary>
/// Gets or sets the OpenTelemetry source name used by the <see cref="OpenTelemetryAgent"/> wrapper.
/// </summary>
/// <remarks>
/// When <see langword="null"/> (the default), the framework's default source name
/// (<c>"Experimental.Microsoft.Agents.AI"</c>) is used.
/// Set this to a custom value to enable filtering spans from a specific <see cref="System.Diagnostics.ActivitySource"/>
/// in your <c>TracerProvider</c> configuration.
/// This property is ignored when <see cref="DisableOpenTelemetry"/> is <see langword="true"/>.
/// </remarks>
public string? OpenTelemetrySourceName { get; set; }
}