-
Notifications
You must be signed in to change notification settings - Fork 340
fix(telemetry): export properly resources configured on prometheus #7394
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
76c1108
fix(telemetry): export properly resources configured on prometheus
bnjjj 785f026
add changelog
bnjjj 187c5ac
fix snapshots to exclude version
bnjjj 71f461d
do not include non static labels in prometheus metrics
bnjjj 65bb39a
update changelog
bnjjj aef3559
fix tests
bnjjj 8240c73
fix tests
bnjjj 67df58c
fix other tests
bnjjj 0f8d69f
Merge branch 'dev' of github.com:apollographql/router into bnjjj/fix_…
bnjjj 9a0d304
fix tests for windows
bnjjj 1eeecf4
add changelog
bnjjj a5b5cc8
fix metrics test
bnjjj 889829e
fix metrics test for windows
bnjjj c901c74
fix metrics test for windows
bnjjj 3824889
Merge branch 'dev' into bnjjj/fix_telemetry_prom_resource
smyrick 2768221
Merge branch 'dev' into bnjjj/fix_telemetry_prom_resource
bnjjj 11fe250
do not include other resources in prom
bnjjj dde3c02
Merge branch 'bnjjj/fix_telemetry_prom_resource' of github.com:apollo…
bnjjj 705ee16
fix lint
bnjjj cdc3ab6
changelog
bnjjj 2c3d274
fix lint
bnjjj 151f3c2
add new option for prom
bnjjj 163be41
add docs
bnjjj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,22 @@ | ||
| ### Telemetry: export properly resources on metrics configured on prometheus ([PR #7394](https://github.com/apollographql/router/pull/7394)) | ||
|
|
||
| When configuring `resource` to globally add labels on metrics like this: | ||
|
|
||
| ```yaml | ||
| 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 `resource`s. | ||
|
|
||
| By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/7394 | ||
This file contains hidden or 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 hidden or 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
28 changes: 14 additions & 14 deletions
28
...metry/snapshots/apollo_router__plugins__telemetry__tests__it_test_prometheus_metrics.snap
This file contains hidden or 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 |
|---|---|---|
| @@ -1,17 +1,17 @@ | ||
| --- | ||
| source: apollo-router/src/plugins/telemetry/mod.rs | ||
| expression: prometheus_metrics | ||
| expression: "prometheus_metrics.replace(& format!\n(r#\"service_version=\"{}\"\"#, std :: env! (\"CARGO_PKG_VERSION\")),\nr#\"service_version=\"X\"\"#)" | ||
| --- | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="+Inf"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="0.001"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="0.005"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="0.015"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="0.05"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="0.1"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="0.2"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="0.3"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="0.4"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="0.5"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="1"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="10"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="5"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="+Inf"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.001"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.005"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.015"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.05"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.1"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.2"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.3"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.4"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.5"} 0 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="1"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="10"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="5"} 1 |
10 changes: 5 additions & 5 deletions
10
.../apollo_router__plugins__telemetry__tests__it_test_prometheus_metrics_custom_buckets.snap
This file contains hidden or 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 |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| --- | ||
| source: apollo-router/src/plugins/telemetry/mod.rs | ||
| expression: prometheus_metrics | ||
| expression: "prometheus_metrics.replace(& format!\n(r#\"service_version=\"{}\"\"#, std :: env! (\"CARGO_PKG_VERSION\")),\nr#\"service_version=\"X\"\"#)" | ||
| --- | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="+Inf"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="10"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="20"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="5"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",le="+Inf"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",le="10"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",le="20"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",le="5"} 1 |
14 changes: 7 additions & 7 deletions
14
...ns__telemetry__tests__it_test_prometheus_metrics_custom_buckets_for_specific_metrics.snap
This file contains hidden or 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 |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| --- | ||
| source: apollo-router/src/plugins/telemetry/mod.rs | ||
| expression: prometheus_metrics | ||
| expression: "prometheus_metrics.replace(& format!\n(r#\"service_version=\"{}\"\"#, std :: env! (\"CARGO_PKG_VERSION\")),\nr#\"service_version=\"X\"\"#)" | ||
| --- | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="+Inf"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="1"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="2"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="3"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="4"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",le="5"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",le="+Inf"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",le="1"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",le="2"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",le="3"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",le="4"} 1 | ||
| apollo_test_histo_bucket{otel_scope_name="apollo/router",service_version="X",le="5"} 1 |
5 changes: 5 additions & 0 deletions
5
...pollo_router__plugins__telemetry__tests__it_test_prometheus_metrics_custom_view_drop.snap
This file contains hidden or 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,5 @@ | ||
| --- | ||
| source: apollo-router/src/plugins/telemetry/mod.rs | ||
| expression: "prometheus_metrics.replace(& format!\n(r#\"service_version=\"{}\"\"#, std :: env! (\"CARGO_PKG_VERSION\")),\nr#\"service_version=\"X\"\"#)" | ||
| --- | ||
|
|
54 changes: 27 additions & 27 deletions
54
...llo_router__plugins__telemetry__tests__it_test_prometheus_metrics_units_are_included.snap
This file contains hidden or 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 |
|---|---|---|
| @@ -1,30 +1,30 @@ | ||
| --- | ||
| source: apollo-router/src/plugins/telemetry/mod.rs | ||
| expression: prometheus_metrics | ||
| expression: "prometheus_metrics.replace(& format!\n(r#\"service_version=\"{}\"\"#, std :: env! (\"CARGO_PKG_VERSION\")),\nr#\"service_version=\"X\"\"#)" | ||
| --- | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",le="+Inf"} 1 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",le="0.001"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",le="0.005"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",le="0.015"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",le="0.05"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",le="0.1"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",le="0.2"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",le="0.3"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",le="0.4"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",le="0.5"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",le="1"} 1 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",le="10"} 1 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",le="5"} 1 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",le="+Inf"} 1 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",le="0.001"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",le="0.005"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",le="0.015"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",le="0.05"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",le="0.1"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",le="0.2"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",le="0.3"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",le="0.4"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",le="0.5"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",le="1"} 1 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",le="10"} 1 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",le="5"} 1 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="+Inf"} 1 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.001"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.005"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.015"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.05"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.1"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.2"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.3"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.4"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.5"} 0 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="1"} 1 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="10"} 1 | ||
| apollo_test_histo1_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="5"} 1 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="+Inf"} 1 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.001"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.005"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.015"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.05"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.1"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.2"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.3"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.4"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="0.5"} 0 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="1"} 1 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="10"} 1 | ||
| apollo_test_histo2_seconds_bucket{otel_scope_name="apollo/router",service_version="X",test_resource="test",le="5"} 1 |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.