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
MetricsLayer — Add additional event fields as KeyValue pairs to a recorded metric #32
Comments
@jnicholls This sounds good! are you able to submit a PR to this effect? |
If @jnicholls doesn't mind, I'd like to try this feature. My understanding is that in the Metric api's Counter add operation spec says
This feature allows you to associate the attributes with the metrics. For example tracing::info!(
monotonic_counter.foo = 1,
key_1 = val_1,
"foo",
); would export metrics with the attributes of |
jtescher
pushed a commit
that referenced
this issue
Aug 8, 2023
## Motivation Support #32 This change will allow user to associate Attributes with metrics from tracing. ## Solution 1. MetricsLayer is only interested in events that contain fields with metrics prefixes such as `counter`, so I have utilized the [tracing_subscriber Filter trait](https://docs.rs/tracing-subscriber/latest/tracing_subscriber/layer/#per-layer-filtering). 2. Since it's necessary to pass Attributes when outputting Measurements, it's required to complete the visit for all fields first before invoking the Metrics API(`Counter:add()`). `SmallVec` is used to hold Attribute KeyValues, Metrics names, and Instruments for invocation, aiming to avoid allocations in typical use cases.
Resolved in #43 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature Request
MetricsLayer
— Add additional event fields asKeyValue
pairs to a recorded metric.Motivation
MetricsLayer
is a great idea, to have events be able to be captured and exported as metrics. Brilliant. But, the current implementation only submits the metric name and value, and no associatedKeyValue
pairs to add context to the metric.Proposal
It would be fantastic if other fields of the event were added as associated
KeyValue
pairs to the metric. Or, another specially named field specifically forMetricsLayer
to inspect for optionalKeyValue
pairs.The text was updated successfully, but these errors were encountered: