Open lenin-jaganathan opened 4 days ago
Thanks for the issue! Could you please provide us a concrete real-world example where you would use this?
I think providing a simple implementation for this wouldn't be too hard, I'm a bit concerned though about two things:
KeyValues
on events, we need to maintain two containers on each of them, I'm not sure how bad is it though, hopefully it's not too bad.Event
interface: if we add new (non-default) methods to it (getter/setter), existing implementations can be broken, for example if somebody did something like this: GrpcServerEvents
/cc @ThomasVitale @jzheaux
Sure. There are multiple places where we can use the KeyValue
associated with an event. I am sharing some of the use-cases with each Observability signals that can be derived from them.
Counter
we need to add the tags in observation which then gets added to all the other events and more importantly to the timer as well, which makes the timer costlier and heavier.context
to get data. Instead of that, if events support KeyValue we can keep them away from context and make context very lean. Only context gets propagated across thread boundaries and events can be flushed out as when they are created and the data can stay with them instead of being in the entire context. If we try to avoid getting KeyValue from context, events really make little sense with just the name part of them.
Please describe the feature request. Currently,
Observation.Event
supports only providing a name (and contextual name). The enhancement request is to allow the addition of low cardinality and high cardinality tags (aka attributes) to events.Rationale This would allow the Observation handlers to use them appropriately for use cases like tagging the counters created from the events with more informative tags, key value-based spans/logging systems can use this to enhance search capabilities and enrich events with additional contextual information, etc. Adding support for tags in events would also enable places where certain tags are associated with an event to be flushed immediately and remove references. Today, such information can only be added to Observation which might be long-lived. Also, we cannot add too many low cardinal tags to the observation as that would make it emit timers with too many attributes. Doing so in events would ease these off from timers and add to counters which are relatively cheaper compared to Timers.