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

OpenTelemetry metrics - provide units in metadata, and NOT include the units in the metric name #6227

Open
theJC opened this issue Nov 4, 2024 · 0 comments

Comments

@theJC
Copy link
Contributor

theJC commented Nov 4, 2024

Describe the bug

Router exposes apollo_router_http_request_duration_seconds via opentelemetry.

Please remove the _seconds from the name and provide it via metrics instead, theres no reason to clutter up the metrics names with the unit suffixes.

https://opentelemetry.io/docs/specs/semconv/general/metrics/#units

Conventional metrics or metrics that have their units included in OpenTelemetry metadata (e.g. metric.WithUnit in Go) SHOULD NOT include the units in the metric name. Units may be included when it provides additional meaning to the metric name. Metrics MUST, above all, be understandable and usable.

To Reproduce

Run Router with otel collector logging:
docker run --name otelcollector -d --rm -v "${PWD}/otel-nobatch-config.yaml":/etc/otelcol/config.yaml -p 4317:4317 otel/opentelemetry-collector

See output below

  1. metrics has _seconds suffix
  2. Metadata doesnt provide units

Expected behavior

A clear and concise description of what you expected to happen.

Metric to not have _seconds suffix, and the units be provided in the opentelemetry metadata

Output

If applicable, add output to help explain your problem.

Metric #18
Descriptor:
     -> Name: apollo_router_http_request_duration_seconds
     -> Description: Duration of HTTP requests.
     -> Unit: 
     -> DataType: Histogram
     -> AggregationTemporality: Delta
HistogramDataPoints #0
Data point attributes:
     -> status: Str(200)
     -> subgraph: Str(graphql-diagnostics-api)
StartTimestamp: 2024-11-04 23:42:35.514509 +0000 UTC
Timestamp: 2024-11-04 23:46:05.516619 +0000 UTC
Count: 13
Sum: 1.487104
Min: 0.074787
Max: 0.314462
ExplicitBounds #0: 0.001000
ExplicitBounds #1: 0.005000
ExplicitBounds #2: 0.015000
ExplicitBounds #3: 0.050000
ExplicitBounds #4: 0.100000
ExplicitBounds #5: 0.200000
ExplicitBounds #6: 0.300000
ExplicitBounds #7: 0.400000
ExplicitBounds #8: 0.500000
ExplicitBounds #9: 1.000000
ExplicitBounds #10: 5.000000
ExplicitBounds #11: 10.000000
Buckets #0, Count: 0
Buckets #1, Count: 0
Buckets #2, Count: 0
Buckets #3, Count: 0
Buckets #4, Count: 11
Buckets #5, Count: 0
Buckets #6, Count: 1
Buckets #7, Count: 1
Buckets #8, Count: 0
Buckets #9, Count: 0
Buckets #10, Count: 0
Buckets #11, Count: 0
Buckets #12, Count: 0
HistogramDataPoints #1
Data point attributes:
     -> operation_name: Str(diagnostics_headers)
     -> status: Str(200)
StartTimestamp: 2024-11-04 23:42:35.514509 +0000 UTC
Timestamp: 2024-11-04 23:46:05.516619 +0000 UTC
Count: 13
Sum: 1.548114
Min: 0.076943
Max: 0.344840
ExplicitBounds #0: 0.001000
ExplicitBounds #1: 0.005000
ExplicitBounds #2: 0.015000
ExplicitBounds #3: 0.050000
ExplicitBounds #4: 0.100000
ExplicitBounds #5: 0.200000
ExplicitBounds #6: 0.300000
ExplicitBounds #7: 0.400000
ExplicitBounds #8: 0.500000
ExplicitBounds #9: 1.000000
ExplicitBounds #10: 5.000000
ExplicitBounds #11: 10.000000
Buckets #0, Count: 0
Buckets #1, Count: 0
Buckets #2, Count: 0
Buckets #3, Count: 0
Buckets #4, Count: 11
Buckets #5, Count: 0
Buckets #6, Count: 1
Buckets #7, Count: 1
Buckets #8, Count: 0
Buckets #9, Count: 0
Buckets #10, Count: 0
Buckets #11, Count: 0
Buckets #12, Count: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant