Replies: 2 comments 8 replies
-
Oh yes, I'm also interested in whether calling |
Beta Was this translation helpful? Give feedback.
8 replies
-
Any formatting in the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I asked this question on SO, before I found this discussion forum, so I thought I'd repost here with more context:
https://stackoverflow.com/questions/77297754/how-should-open-telemetry-users-prevent-accidentally-creating-attributes-with-ma
I'm looking at putting together an OTel friendly backend for Google's Flogger logging API (rather than going via a simplistic bridging backend), but am wondering how to manage attributes and attribute keys.
Flogger already has a robust context metadata mechanism, and it mostly maps well to Attributes ... mostly.
Some issues arise however because while Flogger doesn't impose any restrictions on key labels, OTel seems to (esp. in the sense that values are stored in maps and duplicates are removed). So I'm faced with the undesirable prospect of having to ignore user provided metadata with distinct key instances which (possible accidentally) share duplicate labels. This is something Flogger itself doesn't do currently so I am keen to avoid it if possible.
I can use Floggers metadata handling to avoid directly using "Attributes", "AttributesBuilder" etc. during processing, but I still need to make calls to
logRecordBuilder.setAttribute()
at some point. However, I can find no documentation on the semantics of this call. Specifically:None of the above happen when using the default
Attributes
implementation due to it's deduplication, but nothing in the docs says that this behaviour must be reflected in the calls tosetAttribute()
itself.I can address some of the issues if I can make my own keys with automatic prefixes (e.g. "otel:user_defined_label" and "flogger:user_defined_label"), but I also can't find documentation on what the label syntax should be and whether it's promised that the key-string used to create an
AttributeKey
must be what is passed to the log record.Finally, I'm interested in what the semantics of printing attribute values should be. I saw some code which just used "Attributes.toString()" but it's not clear if that's required, or just an option. I say this because Flogger goes to some length to make the metadata representation it uses correct JSON (including escaping string contents of values). The
Attributes
class does not do this.Specifically it:
toString()
on the list value) and does not quote the elements or the result.Would it be acceptable to create string representations of attributes without these drawbacks, or is this part of a serialization specification somewhere?
Beta Was this translation helpful? Give feedback.
All reactions