agent-framework icon indicating copy to clipboard operation
agent-framework copied to clipboard

.NET: Workflows: the span tag `message.type` collides with the obsoleted OpenTelemetry RPC attribute of the same name

Open ANcpLua opened this issue 1 month ago • 1 comments

Summary

Microsoft.Agents.AI.Workflows sets the span tag message.type to the .NET type name of the message being processed. message.type is a registered OpenTelemetry semantic-convention attribute: the RPC message-event key with the enum values SENT / RECEIVED, deprecated as obsoleted in semantic-conventions 1.44.0 (model/rpc/deprecated/registry-deprecated.yaml). A registry-driven pipeline therefore treats the workflow tag as the obsoleted RPC key: Weaver live-check reports it as a deprecated attribute carrying a value outside its enum, and a collector that follows the registry drops it. The message type never reaches a backend.

Where (tag dotnet-1.24.0)

  • dotnet/src/Microsoft.Agents.AI.Workflows/Observability/Tags.cs:20 declares message.type.
  • dotnet/src/Microsoft.Agents.AI.Workflows/Observability/WorkflowTelemetryContext.cs:146 sets it on executor.process.

Why only this tag

The other workflow tags live in namespaces upstream does not define (workflow.*, executor.*, edge_group.*, message.content, message.source_id, message.target_id), so a downstream registry can declare them as library-owned keys and pass them through. message.type is the one tag that cannot be declared, because the catalog already carries the upstream key of that name with a different meaning. (session.id, error.type and error.message also collide, but their meaning matches upstream's, so they pass as the upstream keys.)

Ask

Give the tag a library-owned name, for example executor.message.type or workflow.message.type, the way the executor and edge-group tags already are. Longer term, prefixing all of message.* (workflow.message.*) would keep the library clear of the deprecated RPC message.* keys entirely.

Context

We maintain a Weaver registry that layers the GenAI conventions and library-owned keys for .NET instrumentation, and declare the workflow tags there as pass-through keys: https://github.com/ANcpLua/Qyl.OpenTelemetry.SemanticConventions/blob/main/registry/vendor/microsoft-agents-ai-workflows.yaml. Happy to send a PR for the rename if the direction is agreed.

ANcpLua avatar Oct 10 '26 18:10 ANcpLua

Thanks for the write-up, makes sense. Agree it should get a library-owned name.

My suggestion would be executor.message.type. In .NET the tag is only set on the executor.process span, right next to executor.id and executor.type, so it fits there and we don't have to start a workflow.message.* family yet. Renaming the whole message.* group later still makes sense as a separate change.

I wouldn't keep emitting the old message.type key. Registry-based pipelines drop it anyway. It does break dashboards that query message.type, so the PR should call that out.

I have a small local change for this with tests (Tags / WorkflowTelemetryContext). @ANcpLua you offered to send the PR, so if you still want to, go for it. Otherwise I'm happy to open mine.

Could a maintainer confirm the name and add ready-for-implementation if this direction works?

Side note: Python also emits message.type but with a different meaning (the MessageType enum, with the payload class in message.payload_type). Probably worth a separate issue so the two don't drift.

Note: I used an AI assistant while working on this and reviewed and tested everything myself.

ShmueLior avatar Nov 13 '26 15:11 ShmueLior