Skip to content

Commit 257f86f

Browse files
nmoutschenhawkw
authored andcommitted
opentelemetry: fix metrics docs using value. instead of histogram. (#2326)
## Motivation This fixes a discrepancy in the `tracing-opentelemetry` docs for the new MetricsLayer. The docs refer to `value.` as a way to collect discrete data point, but this doesn't match any of the prefix constant mentioned in the same file. ```rust const METRIC_PREFIX_MONOTONIC_COUNTER: &str = "monotonic_counter."; const METRIC_PREFIX_COUNTER: &str = "counter."; const METRIC_PREFIX_HISTOGRAM: &str = "histogram."; ``` ## Solution This fixes the documentation and test by referring to `histogram.` instead of `value.`.
1 parent 130c499 commit 257f86f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

tracing-opentelemetry/src/metrics.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ impl<'a> Visit for MetricVisitor<'a> {
263263
/// - `monotonic_counter.` (non-negative numbers): Used when the counter should
264264
/// only ever increase
265265
/// - `counter.`: Used when the counter can go up or down
266-
/// - `value.`: Used for discrete data points (i.e., summing them does not make
266+
/// - `histogram.`: Used for discrete data points (i.e., summing them does not make
267267
/// semantic sense)
268268
///
269269
/// Examples:
@@ -276,9 +276,9 @@ impl<'a> Visit for MetricVisitor<'a> {
276276
/// info!(counter.baz = -1);
277277
/// info!(counter.xyz = 1.1);
278278
///
279-
/// info!(value.qux = 1);
280-
/// info!(value.abc = -1);
281-
/// info!(value.def = 1.1);
279+
/// info!(histogram.qux = 1);
280+
/// info!(histogram.abc = -1);
281+
/// info!(histogram.def = 1.1);
282282
/// ```
283283
///
284284
/// # Mixing data types

tracing-opentelemetry/tests/metrics_publishing.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ async fn u64_histogram_is_exported() {
129129
);
130130

131131
tracing::subscriber::with_default(subscriber, || {
132-
tracing::info!(value.abcdefg = 9_u64);
132+
tracing::info!(histogram.abcdefg = 9_u64);
133133
});
134134

135135
exporter.export().unwrap();
@@ -145,7 +145,7 @@ async fn i64_histogram_is_exported() {
145145
);
146146

147147
tracing::subscriber::with_default(subscriber, || {
148-
tracing::info!(value.abcdefg_auenatsou = -19_i64);
148+
tracing::info!(histogram.abcdefg_auenatsou = -19_i64);
149149
});
150150

151151
exporter.export().unwrap();
@@ -161,7 +161,7 @@ async fn f64_histogram_is_exported() {
161161
);
162162

163163
tracing::subscriber::with_default(subscriber, || {
164-
tracing::info!(value.abcdefg_racecar = 777.0012_f64);
164+
tracing::info!(histogram.abcdefg_racecar = 777.0012_f64);
165165
});
166166

167167
exporter.export().unwrap();

0 commit comments

Comments
 (0)