Uh oh!
There was an error while loading. Please reload this page.
Impl EncodeLabelValue for Option<T> - #137
Conversation
Signed-off-by: Evan Schwartz <3262610+emschwartz@users.noreply.github.com>
drbrain
commented
Apr 21, 2023
I've implemented an equivalent of this where I use this crate to allow For derived |
mxinden
commented
May 9, 2023
Can you expand on the use-case for a metric with a label key but an empty string as label value? Ideally the use-case and the corresponding Prometheus query? Thank you for your upstream work! |
emschwartz
commented
May 9, 2023
I'm working on the Autometrics project, which generates metrics from function names. We have a feature where you can define Service-Level Objectives in your code and then attach them to metrics. This works by adding some "objective"-related labels to the metrics produced by each function. My label set thus contains some values that will always be there and some that are optional. To be honest, it doesn't matter to me whether they show up as label keys with empty values or just aren't attached at all (and I'm not sure if it makes a difference to Prometheus as querying Here is a detailed write-up of the SLO feature in autometrics-rs: https://fiberplane.com/blog/autometrics-rs-0-3-defining-service-level-objectives-in-rust-source-code |
mxinden
commented
May 14, 2023
Thanks @emschwartz and @drbrain for the additional input.
Backing this up:
https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#label With that, I am fine either way. In case neither of you objects to this pull request as is, would you @emschwartz mind bumping the minor version and adding a changelog entry? |
mxinden
commented
May 16, 2023
Released through #141 as |
emschwartz
commented
May 16, 2023
Thanks @mxinden! |
Alternatively, the
EncodeLabelSetderive macro could add code that checks whether the value of theOptionand only encodes theSomevalue