-
Notifications
You must be signed in to change notification settings - Fork 2.2k
.NET: expose OpenTelemetryAgent.DefaultSourceName #7815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Yashvant Mahadev Hange (YashvantHange)
wants to merge
4
commits into
microsoft:main
Choose a base branch
from
YashvantHange:dotnet-expose-otel-default-source-name
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
48a3e97
.NET: expose OpenTelemetryAgent.DefaultSourceName
YashvantHange e9d0aa3
.NET: read DefaultSourceName at run time instead of inlining it
YashvantHange 2a44f9f
.NET: document that AddSource and the agent source name must match
YashvantHange 496a212
Merge remote-tracking branch 'upstream/main' into dotnet-expose-otel-…
YashvantHange File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -41,6 +41,18 @@ public sealed class OpenTelemetryAgent : DelegatingAIAgent, IDisposable | |||||||
| // inner agent not directly but rather via OpenTelemetryChatClient, which wraps a ForwardingChatClient that in turn | ||||||||
| // calls back into the inner agent. | ||||||||
|
|
||||||||
| /// <summary> | ||||||||
| /// Gets the default <see cref="ActivitySource"/> name used by <see cref="OpenTelemetryAgent"/> when no source | ||||||||
| /// name is supplied to the constructor. | ||||||||
| /// </summary> | ||||||||
| /// <remarks> | ||||||||
| /// Pass this value to the tracing pipeline (for example, <c>TracerProviderBuilder.AddSource</c>) to subscribe to | ||||||||
| /// the spans emitted by agents that use the default source name, instead of hardcoding the literal name. This is | ||||||||
| /// a property rather than a constant so that the value is read at run time: a consumer that upgrades the package | ||||||||
| /// picks up the current source name without recompiling. | ||||||||
| /// </remarks> | ||||||||
| public static string DefaultSourceName => OpenTelemetryConsts.DefaultSourceName; | ||||||||
|
rogerbarreto marked this conversation as resolved.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is a new public API available, please lets add an experimental attribute on this and graduate it in a later time, if proven to be useful.
Suggested change
|
||||||||
|
|
||||||||
| /// <summary>The <see cref="OpenTelemetryChatClient"/> providing the bulk of the telemetry.</summary> | ||||||||
| private readonly OpenTelemetryChatClient _otelClient; | ||||||||
| /// <summary>The provider name extracted from <see cref="AIAgentMetadata"/>.</summary> | ||||||||
|
|
@@ -62,8 +74,9 @@ public sealed class OpenTelemetryAgent : DelegatingAIAgent, IDisposable | |||||||
| /// <summary>Initializes a new instance of the <see cref="OpenTelemetryAgent"/> class.</summary> | ||||||||
| /// <param name="innerAgent">The underlying <see cref="AIAgent"/> to be augmented with telemetry capabilities.</param> | ||||||||
| /// <param name="sourceName"> | ||||||||
| /// 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. | ||||||||
| /// An optional source name used to identify telemetry data from this agent. | ||||||||
| /// When specified, register the same value with <c>TracerProviderBuilder.AddSource</c> so the tracing pipeline | ||||||||
| /// subscribes to these spans. When omitted, <see cref="DefaultSourceName"/> is used. | ||||||||
| /// </param> | ||||||||
| /// <exception cref="ArgumentNullException"><paramref name="innerAgent"/> is <see langword="null"/>.</exception> | ||||||||
| /// <remarks> | ||||||||
|
|
@@ -80,8 +93,9 @@ public OpenTelemetryAgent(AIAgent innerAgent, string? sourceName = null) | |||||||
| /// <summary>Initializes a new instance of the <see cref="OpenTelemetryAgent"/> class.</summary> | ||||||||
| /// <param name="innerAgent">The underlying <see cref="AIAgent"/> to be augmented with telemetry capabilities.</param> | ||||||||
| /// <param name="sourceName"> | ||||||||
| /// 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. | ||||||||
| /// An optional source name used to identify telemetry data from this agent. | ||||||||
| /// When specified, register the same value with <c>TracerProviderBuilder.AddSource</c> so the tracing pipeline | ||||||||
| /// subscribes to these spans. When omitted, <see cref="DefaultSourceName"/> is used. | ||||||||
| /// </param> | ||||||||
| /// <param name="autoWireChatClient"> | ||||||||
| /// When <see langword="true"/> and the inner agent is a <see cref="ChatClientAgent"/>, the underlying | ||||||||
|
|
||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.