Skip to content

Commit

Permalink
merge dev (#6039)
Browse files Browse the repository at this point in the history
  • Loading branch information
lennyburdette authored Sep 23, 2024
2 parents b4e8a43 + 9199749 commit 7bbc346
Show file tree
Hide file tree
Showing 321 changed files with 9,041 additions and 4,287 deletions.
14 changes: 14 additions & 0 deletions .changesets/config_introspection_both.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### Enable both introspection implementation by default ([PR #6014](https://github.com/apollographql/router/pull/6014))

As part of the process to replace JavaScript schema introspection with a more performant Rust implementation in the router, we are enabling the router to run both implementations as a default. This allows us to definitively assess reliability and stability of Rust implementation before completely removing JavaScript one. As before, it's possible to toggle between implementations using the `experimental_introspection_mode` config key. Possible values are: `new` (runs only Rust-based validation), `legacy` (runs only JS-based validation), `both` (runs both in comparison, logging errors if a difference arises).

The `both` mode is now the default, which will result in **no client-facing impact** but will record the metrics for the outcome of comparison as a `apollo.router.operations.introspection.both` counter. If this counter in your metrics has `rust_error = true` or `is_matched = false`, please open an issue.

Schema introspection itself is disabled by default, so the above has no effect unless it is enabled in configuration:

```yaml
supergraph:
introspection: true
```
By [@SimonSapin](https://github.com/SimonSapin) in https://github.com/apollographql/router/pull/6014
9 changes: 9 additions & 0 deletions .changesets/feat_feat_key_from_file.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### feat: allow users to load apollo key from file ([PR #5917](https://github.com/apollographql/router/pull/5917))

Users sometimes would rather not pass sensitive keys to the router through environment variables out of an abundance of caution. To help address this, you can now pass an argument `--apollo-key-path` or env var `APOLLO_KEY_PATH`, that takes a file location as an argument which is read and then used as the Apollo key for use with Uplink and usage reporting.

This addresses a portion of #3264, specifically the APOLLO_KEY.

Note: This feature is not available on Windows.

By [@lleadbet](https://github.com/lleadbet) in https://github.com/apollographql/router/pull/5917
7 changes: 7 additions & 0 deletions .changesets/fix_bryn_datadog_sample_propagation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Fix datadog sample propagation ([PR #6005](https://github.com/apollographql/router/pull/6005))

#5788 introduced a regression where samping was being set on propagated headers regardless of the sampling decision in the router or upstream.

This PR reverts the code in question and adds a test to check that a non-sampled request will not result in sampling in the downstream subgraph service.

By [@BrynCooke](https://github.com/BrynCooke) in https://github.com/apollographql/router/pull/6005
14 changes: 14 additions & 0 deletions .changesets/fix_bryn_fix_gauges.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### Gauges stop working after hot reload ([PR #5996](https://github.com/apollographql/router/pull/5996), [PR #5999](https://github.com/apollographql/router/pull/5999), [PR #5999](https://github.com/apollographql/router/pull/6012))

When the router reloads the schema or config, some gauges stopped working. These were:
* `apollo.router.cache.storage.estimated_size`
* `apollo_router_cache_size`
* `apollo.router.v8.heap.used`
* `apollo.router.v8.heap.total`
* `apollo.router.query_planning.queued`

The gauges will now continue to function after a router hot reload.

As a result of this change, introspection queries will now share the same cache even when query planner pooling is used.

By [@BrynCooke](https://github.com/BrynCooke) in https://github.com/apollographql/router/pull/5996 and https://github.com/apollographql/router/pull/5999 and https://github.com/apollographql/router/pull/6012
5 changes: 5 additions & 0 deletions .changesets/fix_tninesling_demand_control_variable_check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Include request variables in demand control scoring ([PR #5995](https://github.com/apollographql/router/pull/5995))

Fix demand control scoring for queries which use variables.

By [@tninesling](https://github.com/tninesling) in https://github.com/apollographql/router/pull/5995
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
version: 2.1

# These "CircleCI Orbs" are reusable bits of configuration that can be shared
# across projects. See https://circleci.com/orbs/ for more information.
orbs:
Expand Down
54 changes: 4 additions & 50 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"

[[package]]
name = "apollo-compiler"
version = "1.0.0-beta.22"
version = "1.0.0-beta.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6feccaf8fab00732a73dd3a40e4aaa7a1106ceef3c0bfbc591c4e0ba27e07774"
checksum = "875f39060728ac3e775fc3fe5421225d6df92c4d5155a9524cdb198f05006d36"
dependencies = [
"ahash",
"apollo-parser",
Expand Down Expand Up @@ -372,7 +372,6 @@ dependencies = [
"sys-info",
"tempfile",
"test-log",
"test-span",
"thiserror",
"tikv-jemallocator",
"time",
Expand Down Expand Up @@ -457,9 +456,9 @@ dependencies = [

[[package]]
name = "apollo-smith"
version = "0.12.0"
version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10e88b295221ae9d2af63d5eac86cb1f47ec8449e7440253d7772fc305a6c200"
checksum = "40cff1a5989a471714cfdf53f24d0948b7f77631ab3dbd25b2f6eacbf58e5261"
dependencies = [
"apollo-compiler",
"apollo-parser",
Expand Down Expand Up @@ -1997,16 +1996,6 @@ dependencies = [
"syn 1.0.109",
]

[[package]]
name = "daggy"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91a9304e55e9d601a39ae4deaba85406d5c0980e106f65afcf0460e9af1e7602"
dependencies = [
"petgraph",
"serde",
]

[[package]]
name = "darling"
version = "0.20.10"
Expand Down Expand Up @@ -3989,9 +3978,6 @@ name = "linked-hash-map"
version = "0.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
dependencies = [
"serde",
]

[[package]]
name = "linkme"
Expand Down Expand Up @@ -6599,38 +6585,6 @@ dependencies = [
"syn 2.0.76",
]

[[package]]
name = "test-span"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39ada8d8deb7460522e606aa5a66568a7ef9f61dfeee8a3c563c69f4d43b1c96"
dependencies = [
"daggy",
"derivative",
"indexmap 2.2.6",
"linked-hash-map",
"once_cell",
"serde",
"serde_json",
"test-span-macro",
"tokio",
"tracing",
"tracing-core",
"tracing-futures",
"tracing-subscriber",
]

[[package]]
name = "test-span-macro"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a30d7cc64c67cb4ac13f4eeb08252f1ae9f1558cd30a336380da6a0a9cf0aef"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.76",
]

[[package]]
name = "text-size"
version = "1.1.1"
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ debug = 1
# Dependencies used in more than one place are specified here in order to keep versions in sync:
# https://doc.rust-lang.org/cargo/reference/workspaces.html#the-dependencies-table
[workspace.dependencies]
apollo-compiler = "=1.0.0-beta.22"
apollo-compiler = "=1.0.0-beta.23"
apollo-parser = "0.8.0"
apollo-smith = "0.12.0"
apollo-smith = "0.13.0"
async-trait = "0.1.77"
hex = { version = "0.4.3", features = ["serde"] }
http = "0.2.11"
Expand Down
10 changes: 2 additions & 8 deletions RELEASE_CHECKLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,7 @@ Start following the steps below to start a release PR. The process is **not ful
git commit -m "prep release: v${APOLLO_ROUTER_RELEASE_VERSION}${APOLLO_ROUTER_PRERELEASE_SUFFIX}"
```
9. Push this commit up to the existing release PR:
```
git push "${APOLLO_ROUTER_RELEASE_GIT_ORIGIN}" "${APOLLO_ROUTER_RELEASE_VERSION}"
```
10. Git tag the current commit and & push the branch and the pre-release tag simultaneously:
9. Git tag the current commit and & push the branch and the pre-release tag simultaneously:
This process will kick off the bulk of the release process on CircleCI, including building each architecture on its own infrastructure and notarizing the macOS binary.
Expand All @@ -202,7 +196,7 @@ Start following the steps below to start a release PR. The process is **not ful
git push "${APOLLO_ROUTER_RELEASE_GIT_ORIGIN}" "${APOLLO_ROUTER_RELEASE_VERSION}" "v${APOLLO_ROUTER_RELEASE_VERSION}${APOLLO_ROUTER_PRERELEASE_SUFFIX}"
```
11. Finally, publish the Crates from your local computer (this also needs to be moved to CI, but requires changing the release containers to be Rust-enabled and to restore the caches):
10. Finally, publish the Crates from your local computer (this also needs to be moved to CI, but requires changing the release containers to be Rust-enabled and to restore the caches):
> Note: This command may appear unnecessarily specific, but it will help avoid publishing a version to Crates.io that doesn't match what you're currently releasing. (e.g., in the event that you've changed branches in another window)
Expand Down
2 changes: 1 addition & 1 deletion apollo-federation/cli/src/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub(crate) fn run_bench(
}
};
let now = Instant::now();
let plan = planner.build_query_plan(&document, None);
let plan = planner.build_query_plan(&document, None, Default::default());
let elapsed = now.elapsed().as_secs_f64() * 1000.0;
let mut eval_plans = None;
let mut error = None;
Expand Down
5 changes: 4 additions & 1 deletion apollo-federation/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,10 @@ fn cmd_plan(

let query_doc =
ExecutableDocument::parse_and_validate(planner.api_schema().schema(), query, query_path)?;
print!("{}", planner.build_query_plan(&query_doc, None)?);
print!(
"{}",
planner.build_query_plan(&query_doc, None, Default::default())?
);
Ok(())
}

Expand Down
2 changes: 0 additions & 2 deletions apollo-federation/src/error/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ impl From<SchemaRootKind> for String {

#[derive(Clone, Debug, strum_macros::Display, PartialEq, Eq)]
pub enum UnsupportedFeatureKind {
#[strum(to_string = "progressive overrides")]
ProgressiveOverrides,
#[strum(to_string = "defer")]
Defer,
#[strum(to_string = "context")]
Expand Down
32 changes: 32 additions & 0 deletions apollo-federation/src/link/federation_spec_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use lazy_static::lazy_static;
use crate::error::FederationError;
use crate::error::SingleFederationError;
use crate::link::argument::directive_optional_boolean_argument;
use crate::link::argument::directive_optional_string_argument;
use crate::link::argument::directive_required_string_argument;
use crate::link::cost_spec_definition::CostSpecDefinition;
use crate::link::cost_spec_definition::COST_VERSIONS;
Expand Down Expand Up @@ -51,6 +52,11 @@ pub(crate) struct ProvidesDirectiveArguments<'doc> {
pub(crate) fields: &'doc str,
}

pub(crate) struct OverrideDirectiveArguments<'doc> {
pub(crate) from: &'doc str,
pub(crate) label: Option<&'doc str>,
}

#[derive(Debug)]
pub(crate) struct FederationSpecDefinition {
url: Url,
Expand Down Expand Up @@ -361,6 +367,19 @@ impl FederationSpecDefinition {
})
}

pub(crate) fn override_directive_definition<'schema>(
&self,
schema: &'schema FederationSchema,
) -> Result<&'schema Node<DirectiveDefinition>, FederationError> {
self.directive_definition(schema, &FEDERATION_OVERRIDE_DIRECTIVE_NAME_IN_SPEC)?
.ok_or_else(|| {
FederationError::internal(format!(
"Unexpectedly could not find federation spec's \"@{}\" directive definition",
FEDERATION_OVERRIDE_DIRECTIVE_NAME_IN_SPEC
))
})
}

pub(crate) fn override_directive(
&self,
schema: &FederationSchema,
Expand Down Expand Up @@ -390,6 +409,19 @@ impl FederationSpecDefinition {
})
}

pub(crate) fn override_directive_arguments<'doc>(
&self,
application: &'doc Node<Directive>,
) -> Result<OverrideDirectiveArguments<'doc>, FederationError> {
Ok(OverrideDirectiveArguments {
from: directive_required_string_argument(application, &FEDERATION_FROM_ARGUMENT_NAME)?,
label: directive_optional_string_argument(
application,
&FEDERATION_OVERRIDE_LABEL_ARGUMENT_NAME,
)?,
})
}

pub(crate) fn get_cost_spec_definition(
&self,
schema: &FederationSchema,
Expand Down
18 changes: 12 additions & 6 deletions apollo-federation/src/operation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ mod field_selection {
}

pub(crate) fn as_path_element(&self) -> FetchDataPathElement {
FetchDataPathElement::Key(self.response_name())
FetchDataPathElement::Key(self.response_name(), Default::default())
}
}

Expand Down Expand Up @@ -2772,7 +2772,7 @@ impl SelectionSet {
response_name,
alias,
}| {
path.push(FetchDataPathElement::Key(alias));
path.push(FetchDataPathElement::Key(alias, Default::default()));
Arc::new(FetchDataRewrite::KeyRenamer(FetchDataKeyRenamer {
path,
rename_key_to: response_name,
Expand Down Expand Up @@ -2801,7 +2801,7 @@ impl SelectionSet {
remaining.push(alias);
} else {
at_current_level.insert(
FetchDataPathElement::Key(alias.response_name.clone()),
FetchDataPathElement::Key(alias.response_name.clone(), Default::default()),
alias,
);
}
Expand Down Expand Up @@ -3110,7 +3110,10 @@ fn compute_aliases_for_non_merging_fields(
Some(s) => {
let mut selections = s.clone();
let mut p = path.clone();
p.push(FetchDataPathElement::Key(response_name.clone()));
p.push(FetchDataPathElement::Key(
response_name.clone(),
Default::default(),
));
selections.push(SelectionSetAtPath {
path: p,
selections: field.selection_set.clone(),
Expand All @@ -3136,7 +3139,7 @@ fn compute_aliases_for_non_merging_fields(
let selections = match field.selection_set.as_ref() {
Some(s) => {
let mut p = path.clone();
p.push(FetchDataPathElement::Key(alias.clone()));
p.push(FetchDataPathElement::Key(alias.clone(), Default::default()));
Some(vec![SelectionSetAtPath {
path: p,
selections: Some(s.clone()),
Expand Down Expand Up @@ -3167,7 +3170,10 @@ fn compute_aliases_for_non_merging_fields(
let selections: Option<Vec<SelectionSetAtPath>> = match field.selection_set.as_ref()
{
Some(s) => {
path.push(FetchDataPathElement::Key(response_name.clone()));
path.push(FetchDataPathElement::Key(
response_name.clone(),
Default::default(),
));
Some(vec![SelectionSetAtPath {
path,
selections: Some(s.clone()),
Expand Down
Loading

0 comments on commit 7bbc346

Please sign in to comment.