open-telemetry / opentelemetry-specification

Specifications for OpenTelemetry
https://opentelemetry.io
Apache License 2.0
3.64k stars 870 forks source link

Clarify the allowance of an empty string in the baggage names #4082

Open XSAM opened 1 week ago

XSAM commented 1 week ago

What are you trying to achieve?

Clarify the allowance of an empty string in the baggage names.

Additional context.

After https://github.com/open-telemetry/opentelemetry-specification/pull/3801, we allow the UTF-8 string in the baggage. However, an empty string is also a valid UTF-8 string.

UTF8-octets = *( UTF8-char )

https://datatracker.ietf.org/doc/html/rfc3629

This means we allow our baggage names to be empty. = and =bar become valid baggages, which are strange baggage.


FYI, the W3C baggage specification does not allow an empty baggage name.

key = token ; as defined in RFC 7230, Section 3.2.6

https://www.w3.org/TR/baggage/#definition


I am not against the design of allowing empty strings in baggage names, as it does not bring compatible issues while parsing W3C baggage. But it might be worth mentioning in the doc that we actually allow empty strings in baggage names, so it won't confuse people while implementing.

Related PR: https://github.com/open-telemetry/opentelemetry-go/pull/5132