Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc(opentelemetry): use histogram for metrics #2326

Merged
merged 2 commits into from Sep 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions tracing-opentelemetry/src/metrics.rs
Expand Up @@ -263,7 +263,7 @@ impl<'a> Visit for MetricVisitor<'a> {
/// - `monotonic_counter.` (non-negative numbers): Used when the counter should
/// only ever increase
/// - `counter.`: Used when the counter can go up or down
/// - `value.`: Used for discrete data points (i.e., summing them does not make
/// - `histogram.`: Used for discrete data points (i.e., summing them does not make
/// semantic sense)
///
/// Examples:
Expand All @@ -276,9 +276,9 @@ impl<'a> Visit for MetricVisitor<'a> {
/// info!(counter.baz = -1);
/// info!(counter.xyz = 1.1);
///
/// info!(value.qux = 1);
/// info!(value.abc = -1);
/// info!(value.def = 1.1);
/// info!(histogram.qux = 1);
/// info!(histogram.abc = -1);
/// info!(histogram.def = 1.1);
/// ```
///
/// # Mixing data types
Expand Down
6 changes: 3 additions & 3 deletions tracing-opentelemetry/tests/metrics_publishing.rs
Expand Up @@ -129,7 +129,7 @@ async fn u64_histogram_is_exported() {
);

tracing::collect::with_default(subscriber, || {
tracing::info!(value.abcdefg = 9_u64);
tracing::info!(histogram.abcdefg = 9_u64);
});

exporter.export().unwrap();
Expand All @@ -145,7 +145,7 @@ async fn i64_histogram_is_exported() {
);

tracing::collect::with_default(subscriber, || {
tracing::info!(value.abcdefg_auenatsou = -19_i64);
tracing::info!(histogram.abcdefg_auenatsou = -19_i64);
});

exporter.export().unwrap();
Expand All @@ -161,7 +161,7 @@ async fn f64_histogram_is_exported() {
);

tracing::collect::with_default(subscriber, || {
tracing::info!(value.abcdefg_racecar = 777.0012_f64);
tracing::info!(histogram.abcdefg_racecar = 777.0012_f64);
});

exporter.export().unwrap();
Expand Down