-
Notifications
You must be signed in to change notification settings - Fork 894
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
Are empty string values equivalent to unset attributes? #431
Comments
Depending on the outcome, we may need to separately discuss this for:
|
This has been discussed in the context of metrics as well, with no great resolution. At present, the protocol spec says that empty values are considered the same as unspecified. I have a preference for treating them distinctly, but it implies a lot of changes in a lot of places and there wasn't a great deal of enthusiasm when this was discussed. |
In open-telemetry/opentelemetry-java#771, opentelemetry-java decided to silently ignore calls to Span.setAttribute with empty string values (see also the brief discussion at open-telemetry/opentelemetry-java#765 (comment)).
I wonder what the specification position on this is. The semantic conventions for
http.host
say-- https://github.com/open-telemetry/opentelemetry-specification/blob/cf0bb600b2eef359dbdd8fbe6f4696ed3e67ed1d/specification/data-http.md#common-attributes
(which is maybe a bit of an unfortunate formulation but is meant to say: "When the header is empty, this attribute should be empty. When the header is not present, this attribute should not be present.")
If we consider an empty string the same as not set, why don't we do the same for numeric values of zero or boolean values of false? 😉
I think we should add a note that explicitly states what to do with empty strings in SetAttribute (probably the same applies to metric labels and resource key values).
My personal opinion is that empty strings should be distinct from an unset attributes.
The text was updated successfully, but these errors were encountered: