-
Notifications
You must be signed in to change notification settings - Fork 7
Align telemetry schema with nodejs PR #207 #210
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
base: main
Are you sure you want to change the base?
Changes from all commits
edcf4a8
cb2d862
2442fb4
2c09507
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,6 +1,5 @@ | ||||||||||||||||||||||
| // Copyright (c) Microsoft Corporation. | ||||||||||||||||||||||
| // Licensed under the MIT License. | ||||||||||||||||||||||
| using Microsoft.Agents.A365.Observability.Runtime.Tracing.Contracts; | ||||||||||||||||||||||
| using Microsoft.Agents.A365.Observability.Runtime.Tracing.Scopes; | ||||||||||||||||||||||
| using OpenTelemetry; | ||||||||||||||||||||||
| using System; | ||||||||||||||||||||||
|
|
@@ -19,7 +18,6 @@ namespace Microsoft.Agents.A365.Observability.Runtime.Common | |||||||||||||||||||||
| /// <para> | ||||||||||||||||||||||
| /// <b>Certification Requirements:</b> To ensure the agent passes certification, the following properties must be set using their respective methods: | ||||||||||||||||||||||
| /// <list type="bullet"> | ||||||||||||||||||||||
| /// <item><see cref="OperationSource"/></item> | ||||||||||||||||||||||
| /// <item><see cref="TenantId"/></item> | ||||||||||||||||||||||
| /// <item><see cref="ConversationId"/></item> | ||||||||||||||||||||||
| /// <item><see cref="ChannelName"/></item> | ||||||||||||||||||||||
|
|
@@ -60,18 +58,6 @@ public void Dispose() | |||||||||||||||||||||
|
|
||||||||||||||||||||||
| private readonly Dictionary<string, string?> _pairs = new Dictionary<string, string?>(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Sets the operation source baggage value. | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
| /// <remarks> | ||||||||||||||||||||||
| /// This property must be set for the agent to pass certification requirements. | ||||||||||||||||||||||
| /// </remarks> | ||||||||||||||||||||||
| public BaggageBuilder OperationSource(OperationSource source) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.OperationSourceKey, source.ToString()); | ||||||||||||||||||||||
| return this; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Sets the tenant ID baggage value. | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
|
|
@@ -156,15 +142,6 @@ public BaggageBuilder AgentBlueprintId(string? v) | |||||||||||||||||||||
| return this; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Sets the agent type baggage value. | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
| public BaggageBuilder AgentType(AgentType? v) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.GenAiAgentTypeKey, v?.ToString()); | ||||||||||||||||||||||
| return this; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Sets the agent platform ID baggage value. | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
|
|
@@ -174,15 +151,6 @@ public BaggageBuilder AgentPlatformId(string? v) | |||||||||||||||||||||
| return this; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Sets the correlation ID baggage value. | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
| public BaggageBuilder CorrelationId(string? v) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.CorrelationIdKey, v); | ||||||||||||||||||||||
| return this; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Sets the caller ID baggage value. | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
|
|
@@ -191,7 +159,7 @@ public BaggageBuilder CorrelationId(string? v) | |||||||||||||||||||||
| /// </remarks> | ||||||||||||||||||||||
| public BaggageBuilder CallerId(string? v) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.GenAiCallerIdKey, v); | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.CallerIdKey, v); | ||||||||||||||||||||||
| return this; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -203,7 +171,7 @@ public BaggageBuilder CallerId(string? v) | |||||||||||||||||||||
| /// </remarks> | ||||||||||||||||||||||
| public BaggageBuilder CallerUpn(string? v) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.GenAiCallerUpnKey, v); | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.CallerUpnKey, v); | ||||||||||||||||||||||
| return this; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -215,7 +183,7 @@ public BaggageBuilder CallerUpn(string? v) | |||||||||||||||||||||
| /// </remarks> | ||||||||||||||||||||||
| public BaggageBuilder CallerName(string? v) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.GenAiCallerNameKey, v); | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.CallerNameKey, v); | ||||||||||||||||||||||
| return this; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -224,7 +192,7 @@ public BaggageBuilder CallerName(string? v) | |||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
| public BaggageBuilder CallerClientIp(IPAddress v) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.GenAiCallerClientIpKey, v.ToString()); | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.CallerClientIpKey, v.ToString()); | ||||||||||||||||||||||
| return this; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -257,7 +225,7 @@ public BaggageBuilder ConversationItemLink(string? v) | |||||||||||||||||||||
| /// </remarks> | ||||||||||||||||||||||
| public BaggageBuilder ChannelName(string? v) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.GenAiChannelNameKey, v); | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.ChannelNameKey, v); | ||||||||||||||||||||||
| return this; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -266,7 +234,7 @@ public BaggageBuilder ChannelName(string? v) | |||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
| public BaggageBuilder ChannelLink(string? v) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.GenAiChannelLinkKey, v); | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.ChannelLinkKey, v); | ||||||||||||||||||||||
| return this; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
@@ -288,15 +256,6 @@ public BaggageBuilder SessionDescription(string? v) | |||||||||||||||||||||
| return this; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Sets the hiring manager ID baggage value. | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
| public BaggageBuilder HiringManagerId(string? v) | ||||||||||||||||||||||
| { | ||||||||||||||||||||||
| Set(OpenTelemetryConstants.HiringManagerIdKey, v); | ||||||||||||||||||||||
| return this; | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Applies the collected baggage to the current context. | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
|
|
@@ -317,11 +276,10 @@ public IDisposable Build() | |||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
| /// Convenience: begin a request baggage scope with common fields. | ||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||
| public static IDisposable SetRequestContext(string? tenantId, string? agentId, string? correlationId = null) | ||||||||||||||||||||||
| public static IDisposable SetRequestContext(string? tenantId, string? agentId) | ||||||||||||||||||||||
| => new BaggageBuilder() | ||||||||||||||||||||||
| .TenantId(tenantId) | ||||||||||||||||||||||
| .AgentId(agentId) | ||||||||||||||||||||||
| .CorrelationId(correlationId) | ||||||||||||||||||||||
| .Build(); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||
|
||||||||||||||||||||||
| /// <summary> | |
| /// <summary> | |
| /// Convenience overload preserved for backward compatibility. The correlationId | |
| /// parameter is ignored; use <see cref="SetRequestContext(string?, string?)"/> instead. | |
| /// </summary> | |
| [Obsolete("Use SetRequestContext(string? tenantId, string? agentId) instead.")] | |
| public static IDisposable SetRequestContext(string? tenantId, string? agentId, string? correlationId) | |
| => SetRequestContext(tenantId, agentId); | |
| /// <summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GenAiToolCallResultKey(gen_ai.tool.call.result) is tool-call specific, but this helper method is extracting content for user/choice message events. Reusing a tool-result attribute for non-tool events is semantically ambiguous and risks collisions/incorrect analytics. Consider looking for the user/choice event payload under a message-specific key (if one exists in the target schema), or (at minimum) support both keys during migration by checking for the prior key as a fallback so existing instrumentation doesn’t silently stop being parsed.