Skip to content

fix(telemetry): export properly resources configured on prometheus (backport #7394) #7615

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

Closed
wants to merge 1 commit into from

Conversation

bnjjj
Copy link
Contributor

@bnjjj bnjjj commented Jun 6, 2025

When configuring resource to globally add labels on metrics like this:

telemetry:
  apollo:
    client_name_header: name_header
    client_version_header: version_header
  exporters:
    metrics:
      common:
        resource:
          "test-resource": "test"
      prometheus:
        enabled: true

test-resource label was never exported to prometheus, this bug only occurs with prometheus and not otlp.
This PR fixes this behavior and will no longer filter resources.


Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

  • Changes are compatible1
  • Documentation2 completed
  • Performance impact assessed and acceptable
  • Tests added and passing3
    • Unit Tests
    • Integration Tests
    • Manual Tests

Exceptions

Note any exceptions here

Notes

[ROUTER-1282]: https://apollographql.atlassian.net/browse/ROUTER-1282?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ


This is an automatic backport of pull request #7394 done by Mergify.

Footnotes

  1. It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this.

  2. Configuration is an important part of many changes. Where applicable please try to document configuration examples.

  3. Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

…7394)

Signed-off-by: Benjamin <[email protected]>
(cherry picked from commit 731fd23)

# Conflicts:
#	apollo-router/src/plugins/telemetry/metrics/prometheus.rs
#	apollo-router/src/plugins/telemetry/mod.rs
#	apollo-router/src/plugins/telemetry/snapshots/apollo_router__plugins__telemetry__tests__it_test_prometheus_metrics.snap
#	apollo-router/src/plugins/telemetry/snapshots/apollo_router__plugins__telemetry__tests__it_test_prometheus_metrics_units_are_included.snap
#	apollo-router/tests/integration/telemetry/metrics.rs
#	docs/source/routing/observability/telemetry/metrics-exporters/prometheus.mdx
@mergify mergify bot added the conflicts label Jun 6, 2025
@bnjjj bnjjj requested a review from a team as a code owner June 6, 2025 12:05
@mergify mergify bot assigned bnjjj Jun 6, 2025
@bnjjj bnjjj requested review from a team as code owners June 6, 2025 12:05
Copy link
Contributor

mergify bot commented Jun 6, 2025

Cherry-pick of 731fd23 has failed:

On branch mergify/bp/1.x/pr-7394
Your branch is up to date with 'origin/1.x'.

You are currently cherry-picking commit 731fd23c.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   .changesets/fix_bnjjj_fix_telemetry_prom_resource.md
	modified:   apollo-router/src/configuration/snapshots/apollo_router__configuration__tests__schema_generation.snap
	modified:   apollo-router/src/plugins/telemetry/snapshots/apollo_router__plugins__telemetry__tests__it_test_prometheus_metrics_custom_buckets.snap
	modified:   apollo-router/src/plugins/telemetry/snapshots/apollo_router__plugins__telemetry__tests__it_test_prometheus_metrics_custom_buckets_for_specific_metrics.snap
	new file:   apollo-router/src/plugins/telemetry/snapshots/apollo_router__plugins__telemetry__tests__it_test_prometheus_metrics_custom_view_drop.snap
	modified:   apollo-router/src/plugins/telemetry/testdata/prometheus.router.yaml

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	both modified:   apollo-router/src/plugins/telemetry/metrics/prometheus.rs
	both modified:   apollo-router/src/plugins/telemetry/mod.rs
	both modified:   apollo-router/src/plugins/telemetry/snapshots/apollo_router__plugins__telemetry__tests__it_test_prometheus_metrics.snap
	deleted by us:   apollo-router/src/plugins/telemetry/snapshots/apollo_router__plugins__telemetry__tests__it_test_prometheus_metrics_units_are_included.snap
	both modified:   apollo-router/tests/integration/telemetry/metrics.rs
	both modified:   docs/source/routing/observability/telemetry/metrics-exporters/prometheus.mdx

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@svc-apollo-docs
Copy link
Collaborator

svc-apollo-docs commented Jun 6, 2025

✅ Docs preview ready

The preview is ready to be viewed. View the preview

File Changes

0 new, 2 changed, 0 removed
* graphos/routing/(latest)/observability/telemetry/metrics-exporters/prometheus.mdx
* graphos/routing/v1/observability/telemetry/metrics-exporters/prometheus.mdx

Build ID: 301ecbf78bf69bfaf69bb392

URL: https://www.apollographql.com/docs/deploy-preview/301ecbf78bf69bfaf69bb392

@bnjjj bnjjj closed this Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants