Fix protocol version tag for stateless server spans (#1810)

Co-authored-by: Luis Rodriguez <25299418+luisangelrod@users.noreply.github.com>
Co-authored-by: Tarek Mahmoud Sayed <tarekms@ntdev.microsoft.com>
This commit is contained in:
Luis Rodriguez 2026-08-14 11:40:57 -04:00 • committed by GitHub
commit 8754e19f80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -962,9 +962,10 @@ internal sealed partial class McpSessionHandler : IAsyncDisposable
tags.Add("network.protocol.name", "http");
}
if (NegotiatedProtocolVersion is not null)
string? protocolVersion = (message as JsonRpcRequest)?.Context?.ProtocolVersion ?? NegotiatedProtocolVersion;
if (protocolVersion is not null)
{
tags.Add("mcp.protocol.version", NegotiatedProtocolVersion);
tags.Add("mcp.protocol.version", protocolVersion);
}
if (activity is { IsAllDataRequested: true })