From f8da4a9642fcc2a5671e4f2eaa5831b94c62464f Mon Sep 17 00:00:00 2001 From: "Agatha V. Lovelace" Date: Mon, 15 Jan 2024 11:33:54 +0100 Subject: [PATCH] fix: Remove duplicate _total suffix from counters --- README.md | 2 +- src/lib.rs | 5 ++--- tests/basic_metrics_output.txt | 8 ++++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b7cb949..d5a1b63 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ file within the repository. If you compile the open source software that we make available to develop your own mobile, desktop or embeddable application, and cause that application to -connect to our servers for any purposes, you have to aggree to our Terms of +connect to our servers for any purposes, you have to agree to our Terms of Service. In short, if you choose to connect to our servers, certain restrictions apply as follows: diff --git a/src/lib.rs b/src/lib.rs index 315320f..095c7b1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -147,9 +147,8 @@ impl RecorderMiddleware { let http_requests_duration_seconds = meter.f64_histogram("http.requests.duration.seconds").init(); - let http_requests_total = meter.u64_counter("http.requests.total").init(); - let http_unmatched_requests_total = - meter.u64_counter("http.mismatched.requests.total").init(); + let http_requests_total = meter.u64_counter("http.requests").init(); + let http_unmatched_requests_total = meter.u64_counter("http.mismatched.requests").init(); Self { registry, diff --git a/tests/basic_metrics_output.txt b/tests/basic_metrics_output.txt index 157b450..53e6093 100644 --- a/tests/basic_metrics_output.txt +++ b/tests/basic_metrics_output.txt @@ -1,7 +1,7 @@ # TYPE fox_counter_total counter fox_counter_total{otel_scope_name="axum-opentelemetry"} 6 -# TYPE http_mismatched_requests_total_total counter -http_mismatched_requests_total_total{otel_scope_name="axum-opentelemetry"} 10 +# TYPE http_mismatched_requests_total counter +http_mismatched_requests_total{otel_scope_name="axum-opentelemetry"} 10 # TYPE http_requests_duration_seconds histogram http_requests_duration_seconds_bucket{endpoint="/visible_fox",method="GET",status="200",otel_scope_name="axum-opentelemetry",le="0"} 0 http_requests_duration_seconds_bucket{endpoint="/visible_fox",method="GET",status="200",otel_scope_name="axum-opentelemetry",le="5"} 5 @@ -21,8 +21,8 @@ http_requests_duration_seconds_bucket{endpoint="/visible_fox",method="GET",statu http_requests_duration_seconds_bucket{endpoint="/visible_fox",method="GET",status="200",otel_scope_name="axum-opentelemetry",le="+Inf"} 5 http_requests_duration_seconds_sum{endpoint="/visible_fox",method="GET",status="200",otel_scope_name="axum-opentelemetry"} FLOAT http_requests_duration_seconds_count{endpoint="/visible_fox",method="GET",status="200",otel_scope_name="axum-opentelemetry"} 5 -# TYPE http_requests_total_total counter -http_requests_total_total{endpoint="/visible_fox",method="GET",status="200",otel_scope_name="axum-opentelemetry"} 5 +# TYPE http_requests_total counter +http_requests_total{endpoint="/visible_fox",method="GET",status="200",otel_scope_name="axum-opentelemetry"} 5 # HELP otel_scope_info Instrumentation Scope metadata # TYPE otel_scope_info gauge otel_scope_info{otel_scope_name="axum-opentelemetry"} 1