Skip to content

Commit 85f67fd

Browse files
committed
also add new CDN metrics prometheus registry
1 parent 093384c commit 85f67fd

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

src/metrics/macros.rs

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,36 @@ macro_rules! metrics {
3737
$(#[$meta])*
3838
registry.register(Box::new($metric.clone()))?;
3939
)*
40+
41+
let cdn_invalidation_time = prometheus::HistogramVec::new(
42+
prometheus::HistogramOpts::new(
43+
"cdn_invalidation_time",
44+
"duration of CDN invalidations after having been sent to the CDN.",
45+
)
46+
.namespace($namespace)
47+
.buckets($crate::metrics::CDN_INVALIDATION_HISTOGRAM_BUCKETS.to_vec())
48+
.variable_label("distribution"),
49+
&["distribution"],
50+
)?;
51+
registry.register(Box::new(cdn_invalidation_time.clone()))?;
52+
53+
let cdn_queue_time = prometheus::HistogramVec::new(
54+
prometheus::HistogramOpts::new(
55+
"cdn_queue_time",
56+
"queue time of CDN invalidations before they are sent to the CDN. ",
57+
)
58+
.namespace($namespace)
59+
.buckets($crate::metrics::CDN_INVALIDATION_HISTOGRAM_BUCKETS.to_vec())
60+
.variable_label("distribution"),
61+
&["distribution"],
62+
)?;
63+
registry.register(Box::new(cdn_queue_time.clone()))?;
64+
4065
Ok(Self {
4166
registry,
4267
recently_accessed_releases: RecentlyAccessedReleases::new(),
43-
cdn_invalidation_time: prometheus::HistogramVec::new(
44-
prometheus::HistogramOpts::new(
45-
"cdn_invalidation_time",
46-
"duration of CDN invalidations after having been sent to the CDN.",
47-
)
48-
.buckets($crate::metrics::CDN_INVALIDATION_HISTOGRAM_BUCKETS.to_vec())
49-
.variable_label("distribution"),
50-
&["distribution"],
51-
)?,
52-
cdn_queue_time: prometheus::HistogramVec::new(
53-
prometheus::HistogramOpts::new(
54-
"cdn_queue_time",
55-
"queue time of CDN invalidations before they are sent to the CDN. ",
56-
)
57-
.buckets($crate::metrics::CDN_INVALIDATION_HISTOGRAM_BUCKETS.to_vec())
58-
.variable_label("distribution"),
59-
&["distribution"],
60-
)?,
68+
cdn_invalidation_time,
69+
cdn_queue_time,
6170
$(
6271
$(#[$meta])*
6372
$metric,

0 commit comments

Comments
 (0)