opentelemetry-dotnet icon indicating copy to clipboard operation
opentelemetry-dotnet copied to clipboard

[feature request] Support best-practice tracestate mutation

Open gearset-joe-ls opened this issue 9 months ago • 1 comments

Package

OpenTelemetry

Is your feature request related to a problem?

Hi great people, 👋

The W3C recommend several practices when mutating the tracestate header:

  • "Vendors SHOULD NOT delete keys that were not generated by them."
  • "Modified keys SHOULD be moved to the beginning (left) of the list."
  • "the order of unmodified key/value pairs MUST be preserved"
  • "Spaces and horizontal tabs surrounding list-members are ignored"
  • "Empty list members are allowed"

It is tricky and time-consuming to write tracestate mutation code that follows these practices, so I wonder if we might consider providing an API in this package. Perhaps a TraceState struct that wraps the string value and provides "Update" methods, or a static helper class.

I am happy to author a PR if the idea meets approval.

Thanks

What is the expected behavior?

An API for performing tracestate mutation that adheres to the W3C's recommended practices

Which alternative solutions or features have you considered?

Additional context

No response

gearset-joe-ls avatar Apr 02 '25 10:04 gearset-joe-ls