You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
enhancement(observability): add fixed tag option to RegisteredEventCache (#17814)
@bruceg highlighted the fact that there was no straight forward way to
add fixed tags to the `RegisteredEventCache`.
This adds the option to do that. Very quickly, supposing the
`TaggedEventsSent` had two tags, `something` and `service`. `something`
never changes so can be passed in when the event cache is first created.
The code for this would look similar to:
```rust
crate::registered_event!(
TaggedEventsSent {
something: String,
service: OptionalTag<String>,
} => {
events: Counter = {
register_counter!("component_sent_events_total", &make_tags(&self.something, &self.service))
},
event_bytes: Counter = {
register_counter!("component_sent_event_bytes_total", &make_tags(&self.something, &self.service))
},
}
fn emit(&self, data: CountByteSize) {
...
}
fn register(something: String, tags: EventCountTags) {
super::register(TaggedEventsSent::new(
something,
tags,
))
}
);
...
let events_sent = RegisteredEventCache::default(String::from("something"));
....
events_sent.emit(service, *size);
```
---------
Signed-off-by: Stephen Wakely <[email protected]>
0 commit comments