-
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
Give a definition for null-valued attributes/labels/resources #503
Comments
A closely related point on #459 is about this language specifying valid keys:
We also have a guideline not to panic, so what should be done if the user supplies a key that is an empty string? I do not believe the right answer is to introduce error checking (i.e., require you to check errors when constructing keys). I agree, however, with the requirement, so I would say something like implementations SHOULD use a name "empty_at_file:line" when the empty-string is given as a key name, or "null" (or something similar), when a null-valued key is provided. (Note that in Go, the key is a string type, so it's impossible to pass a null-valued key.) |
If there is no way of adding a I'm open to discuss dropping the null-clears-previous-value behavior in favor of an explicit While it would be required to be able to export a meaningful If we cannot agree on keeping the current semantics, I would at least like to leave it up to language implementations to decide if |
Rust also does not support I don't think tying to add the concept of I think simply adding an attribute indicate we want it to be used, and not ignored. What if we replaced |
Two choices
|
I prefer doing neither of the above. As I see it, only if we cannot disallow null at compile time, do we need to define some sensible behavior for it. If at all possible, there should be no null/remove/... at all. |
This is unpopular, I'll close it. |
In #459 we declared that empty-string values are meaningful. I agree with this position and recommend the same treatment for the metrics API. However, the same change introduces language about null-valued span attributes, stating that they are effectively skipped and/or indicate deletion of an attribute.
This topic came up in the metrics API because many exporters will treat an unspecified value as an empty string in the exposition format. The default Metrics SDK specification will have to say something about this particular point. See the related discussion in #345.
As for
null
, this is something of a language-specific term. For example, there is no way to construct a null-valued attribute in the current Go API, because there simply is not a method to create a null-valuedKeyValue
. The Go API uses an "INVALID" type to indicate when a variable has not been initialized, and we could possibly treat the uninitialized state asnull
. However, I would call the uninitialized state an error, and would prefer the API tell me that I have made an error rather than delete an attribute because I "set" the uninitialized value.As for the value of
null
, it is a value. It is a value in the language and it is a value in JSON, and I would argue that we should have an explicit null-valued attribute, metric label, and resource. In export formats that preserve value type, this would have its own distinct type in the protocol (i.e., in JSON "null" vs null). In export formats that require a string representation, the representation is "null", not the empty string, because these are meaningfully different values.My request is that we declare a meaningful null value. The call to
SetAttribute
is not skipped, but a null-value is recorded.If we intend to support a Span API for deleting a current annotation (as discussed when setting null-valued attributes in #459)--and I do not think we should--then we should have an explicit API for deleting span attributes (e.g.,
DeleteAttribute
). However, I'll note that this topic was briefly discussed because OpenCensus and OpenTracing have a notion of "overwrite" but not of "delete" for attributes: open-telemetry/opentelemetry-go#53 (comment)The text was updated successfully, but these errors were encountered: