-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix exemplars being added to gauge metrics in the prometheus exporter (…
…#5912) Prometheus Gauge metrics don't support exemplars and while `addGaugeMetric()` doesn't add them, `addSumMetric()` will if the metric is monotonic. This causes the prometheus client to throw an error: ``` * error collecting metric Desc{fqName: "http_server_request_body_size_bytes", help: "Measures size of RPC request messages (uncompressed).", constLabels: {}, variableLabels: {net_protocol_name,net_protocol_version,http_method,http_route,http_scheme,net_host_name,net_host_port,otel_scope_name,otel_scope_version}}: cannot inject exemplar into Gauge, Summary or Untyped ``` --------- Co-authored-by: Damien Mathieu <[email protected]> Co-authored-by: David Ashpole <[email protected]>
- Loading branch information
1 parent
30c4a9a
commit 664a075
Showing
4 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
exporters/prometheus/testdata/non_monotonic_sum_does_not_add_exemplars.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# HELP foo_seconds a simple up down counter | ||
# TYPE foo_seconds gauge | ||
foo_seconds{A="B",C="D",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 23.3 | ||
foo_seconds{A="D",C="B",E="true",F="42",otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 5 | ||
# HELP otel_scope_info Instrumentation Scope metadata | ||
# TYPE otel_scope_info gauge | ||
otel_scope_info{otel_scope_name="testmeter",otel_scope_version="v0.1.0"} 1 | ||
# HELP target_info Target metadata | ||
# TYPE target_info gauge | ||
target_info{service_name="prometheus_test",telemetry_sdk_language="go",telemetry_sdk_name="opentelemetry",telemetry_sdk_version="latest"} 1 |