From f49e40ad8ab3f21c2d3dbc257ac19a7feb6cc001 Mon Sep 17 00:00:00 2001 From: John Howard Date: Wed, 4 Jan 2023 09:33:05 -0800 Subject: [PATCH] ADd changelog example Signed-off-by: John Howard --- CHANGELOG.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 45b5a414..fcc12b8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Introduce `Collector` abstraction allowing users to provide additional metrics and their description on each scrape. See [PR 82]. - Introduce a `#[prometheus(flatten)]` attribute which can be used when deriving `EncodeLabelSet`, allowing - a nested struct the be flattened during encoding. See [PR 118]. + a nested struct to be flattened during encoding. See [PR 118]. + For example: + ```rust + #[derive(EncodeLabelSet, Hash, Clone, Eq, PartialEq, Debug)] + struct CommonLabels { + a: u64, + b: u64, + } + #[derive(EncodeLabelSet, Hash, Clone, Eq, PartialEq, Debug)] + struct Labels { + unique: u64, + #[prometheus(flatten)] + common: CommonLabels, + } + + // Would result in `my_metric{a="42",b="42",unique="42"} 42 + ``` [PR 82]: https://github.com/prometheus/client_rust/pull/82 [PR 118]: https://github.com/prometheus/client_rust/pull/118