Impl EncodeLabelValue for Option<T>#137
Conversation
Signed-off-by: Evan Schwartz <3262610+emschwartz@users.noreply.github.com>
|
I've implemented an equivalent of this where I use this crate to allow For derived |
|
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! |
|
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 |
|
Thanks @emschwartz and @drbrain for the additional input.
Backing this up:
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? |
|
Released through #141 as |
|
Thanks @mxinden! |
Alternatively, the
EncodeLabelSetderive macro could add code that checks whether the value of theOptionand only encodes theSomevalue