Repository navigation
feat(federation): add env var for MAX_NON_LOCAL_SELECTIONS #10349
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
Open
lrlna
wants to merge
10
commits into
dev
Choose a base branch
from
lrlna/RH-1408
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+141
−14
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
24f7098
replace const MAX_NON_LOCAL_SELECTIONS with an fn
lrlna ede23dd
add a changeset
lrlna bd5952e
add a histogram for tracking the number of non_local_selections
lrlna 507d311
update PR number in changeset
lrlna 7c77228
change british english spelling
lrlna 124edbc
cargo fmt
lrlna 46dc665
set max_non_local_selections on query planning config to make sure ca…
lrlna ca054d3
cargo fmt
lrlna 3d1bd14
xtask lint
lrlna 9c98942
fix integration tests
lrlna 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
10 changes: 10 additions & 0 deletions
10
.changesets/feat_lrlna_router_2150_max_non_local_selections.md
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,10 @@ | ||
| ### Add a metric to track non-local selection sets observed during query planning | ||
|
|
||
|
|
||
| `apollo.router.query_planning.plan.non_local_selections` is a histogram of the | ||
| number of non-local selections estimated during query planning traversal used to | ||
| limit the number of options explored. The non-local selections limit defaults to | ||
| 100_000. Numbers observed to be close to this limit may warrant an investigation | ||
| into complexity of the operations. | ||
|
|
||
| By [@lrlna](https://github.com/lrlna) in https://github.com/apollographql/router/pull/10349 |
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
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
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
44 changes: 44 additions & 0 deletions
44
apollo-router/tests/integration/query_planner/non_local_selections.rs
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,44 @@ | ||
| use serde_json::json; | ||
|
|
||
| use crate::integration::IntegrationTest; | ||
| use crate::integration::common::Query; | ||
|
|
||
| const QUERY: &str = r#"{ t { v1 v2 v3 v4 } }"#; | ||
|
|
||
| #[tokio::test(flavor = "multi_thread")] | ||
| async fn reports_non_local_selections() { | ||
| let mut router = IntegrationTest::builder() | ||
| .config( | ||
| r#" | ||
| telemetry: | ||
| exporters: | ||
| metrics: | ||
| prometheus: | ||
| enabled: true | ||
| "#, | ||
| ) | ||
| .supergraph("tests/integration/fixtures/query_planner_max_evaluated_plans.graphql") | ||
| .build() | ||
| .await; | ||
| router.start().await; | ||
| router.assert_started().await; | ||
| router | ||
| .execute_query( | ||
| Query::builder() | ||
| .body(json!({ | ||
| "query": QUERY, | ||
| "variables": {}, | ||
| })) | ||
| .build(), | ||
| ) | ||
| .await; | ||
|
|
||
| router | ||
| .assert_metrics_contains( | ||
| r#"apollo_router_query_planning_plan_non_local_selections_sum{<any>} 10"#, | ||
| None, | ||
| ) | ||
| .await; | ||
|
|
||
| router.graceful_shutdown().await; | ||
| } |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This histogram inherits the default bucket boundaries, which stop at 10, so estimates near the 100,000 limit all fall into the +Inf bucket. Provide count-appropriate boundaries (including the region around the limit) and test bucket placement; otherwise drop it from this change.