@@ -247,8 +247,7 @@ impl<'a> Visit for MetricVisitor<'a> {
247
247
/// - `monotonic_counter.` (non-negative numbers): Used when the counter should
248
248
/// only ever increase
249
249
/// - `counter.`: Used when the counter can go up or down
250
- /// - `value.`: Used for discrete data points (i.e., summing them does not make
251
- /// semantic sense)
250
+ /// - `histogram.`: Used to report arbitrary values that are likely to be statistically meaningful
252
251
///
253
252
/// Examples:
254
253
/// ```
@@ -260,9 +259,9 @@ impl<'a> Visit for MetricVisitor<'a> {
260
259
/// info!(counter.baz = -1);
261
260
/// info!(counter.xyz = 1.1);
262
261
///
263
- /// info!(value .qux = 1);
264
- /// info!(value .abc = -1);
265
- /// info!(value .def = 1.1);
262
+ /// info!(histogram .qux = 1);
263
+ /// info!(histogram .abc = -1);
264
+ /// info!(histogram .def = 1.1);
266
265
/// ```
267
266
///
268
267
/// # Mixing data types
@@ -307,6 +306,19 @@ impl<'a> Visit for MetricVisitor<'a> {
307
306
/// info!(counter.baz = (i64::MAX as u64) + 1)
308
307
/// ```
309
308
///
309
+ /// # Attributes
310
+ ///
311
+ /// When `MetricsLayer` outputs metrics, it converts key-value pairs into [Attributes] and associates them with metrics.
312
+ ///
313
+ /// [Attributes]: https://opentelemetry.io/docs/specs/otel/common/#attribute
314
+ ///
315
+ /// For example:
316
+ /// ```
317
+ /// # use tracing::info;
318
+ /// // adds attributes bar="baz" and qux=2 to the `foo` counter.
319
+ /// info!(monotonic_counter.foo = 1, bar = "baz", qux = 2);
320
+ /// ```
321
+ ///
310
322
/// # Implementation Details
311
323
///
312
324
/// `MetricsLayer` holds a set of maps, with each map corresponding to a
0 commit comments