From 4ff27622acfe216c1baed67d963a16c585bbe6d5 Mon Sep 17 00:00:00 2001 From: Geoffroy Couprie Date: Mon, 22 Aug 2022 13:15:32 +0200 Subject: [PATCH 1/6] WIP --- CHANGELOG.md | 509 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 509 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00de516aa7..e083ee6778 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,515 @@ All notable changes to Router will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +# [0.16] (unreleased) - 2022-08-22 + +## ❗ BREAKING ❗ + +### Remove QueryPlannerService ([PR #1552](https://github.com/apollographql/router/pull/1552)) + +This service was redundant, since anything done as part of the `QueryPlannerService` could be done either at the `SupergraphService` or at the `ExecutionService` level. + +By [@o0Ignition0o](https://github.com/o0Ignition0o) + +### Rename map_future_with_context to map_future_with_request_data ([PR #1547](https://github.com/apollographql/router/pull/1547)) + +The function is not very well named since it's in fact used to extract any data from a request for use in a future. This rename makes it clear. + +By [@garypen](https://github.com/garypen) + +### Rename traffic shaping deduplication options ([PR #1540](https://github.com/apollographql/router/pull/1540)) + +In the traffic shaping module: + - `variables_deduplication` configuration option is renamed to `deduplicate_variables`. + - `query_deduplication` configuration option is renamed to `deduplicate_query`. + +```diff +- traffic_shaping: +- variables_deduplication: true # Enable the variables deduplication optimization +- all: +- query_deduplication: true # Enable query deduplication for all subgraphs. +- subgraphs: +- products: +- query_deduplication: false # Disable query deduplication for products. ++ traffic_shaping: ++ deduplicate_variables: true # Enable the variables deduplication optimization ++ all: ++ deduplicate_query: true # Enable query deduplication for all subgraphs. ++ subgraphs: ++ products: ++ deduplicate_query: false # Disable query deduplication for products. +``` + +By [@garypen](https://github.com/garypen) + +### Put `query_plan_options` in private and wrap `QueryPlanContent` in an opaque type ([PR #1486](https://github.com/apollographql/router/pull/1486)) + +`QueryPlanOptions::query_plan_options` is no longer available in public. + +By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/1486 + +### Removed `delay_interval` in telemetry configuration. ([PR #1498](https://github.com/apollographql/router/pull/1498)) + +It was doing nothing. + +```yaml title="router.yaml" +telemetry: + metrics: + common: + # Removed, will now cause an error on Router startup: + delay_interval: + secs: 9 + nanos: 500000000 +``` + +By [@SimonSapin](https://github.com/SimonSapin) + +### Remove telemetry configuration hot reloading ([PR #1463](https://github.com/apollographql/router/pull/1463)) + +Configuration hot reloading is not very useful for telemetry, and is the +source of regular bugs that are hard to fix. + +This removes the support for configuration reloading entirely. Now, the +router will reject a configuration reload with an error log if the +telemetry configuration changed. + +It is now possible to create a subscriber and pass it explicitely to the telemetry plugin +when creating it. It will then be modified to integrate the telemetry plugin's layer. + +By [@geal](https://github.com/geal) in https://github.com/apollographql/router/pull/1463 + +### Reorder query planner execution ([PR #1484](https://github.com/apollographql/router/pull/1484)) + +Query planning is deterministic, it only depends on the query, operation name and query planning +options. As such, we can cache the result of the entire process. + +This changes the pipeline to apply query planner plugins between the cache and the bridge planner, +so those plugins will only be called once on the same query. If changes must be done per query, +they should happen in a supergraph service. + +By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1464 + +### Remove Buffer from Mock*Service ([PR #1440](https://github.com/apollographql/router/pull/1440) + +This removes the usage of `tower_test::mock::Mock` in mocked services because it isolated the service in a task +so panics triggered by mockall were not transmitted up to the unit test that should catch it. +This rewrites the mocked services API to remove the `build()` method, and make them clonable if needed, +using an `expect_clone` call with mockall. + +By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1440 + +### Some items were renamed or moved ([PR #1487](https://github.com/apollographql/router/pull/1487) [PR #1534](https://github.com/apollographql/router/pull/1534) [PR #1555](https://github.com/apollographql/router/pull/1555) [PR #1563](https://github.com/apollographql/router/pull/1563)) + +At the crate root: + +* `SchemaKind` → `SchemaSource` +* `SchemaKind::String(String)` → `SchemaSource::Static { schema_sdl: String }` +* `ConfigurationKind` → `ConfigurationSource` +* `ConfigurationKind::Instance` → `ConfigurationSource::Static` +* `ShutdownKind` → `ShutdownSource` +* `ApolloRouter` → `RouterHttpServer` + +In the `apollo_router::plugin::Plugin` trait: + +* `router_service` → `supergraph_service` + +A new `apollo_router::stages` module replaces `apollo_router::services` in the public API, +reexporting its items and adding `BoxService` and `BoxCloneService` type aliases. +Additionally, the "router stage" is now known as "supergraph stage". +In pseudo-syntax, `use`’ing the old names: + +```rust +mod supergraph { + use apollo_router::services::RouterRequest as Request; + use apollo_router::services::RouterResponse as Response; + type BoxService = tower::util::BoxService; + type BoxCloneService = tower::util::BoxCloneService; +} + +pub mod execution { + use tower::BoxError; + + pub use crate::services::ExecutionRequest as Request; + pub use crate::services::ExecutionResponse as Response; + pub type BoxService = tower::util::BoxService; + pub type BoxCloneService = tower::util::BoxCloneService; + pub type Result = std::result::Result; + + // Reachable from Request or Response: + pub use crate::query_planner::QueryPlan; + pub use crate::services::QueryPlannerContent; +} + +mod subgraph { + use super::*; + use apollo_router::services::SubgraphRequest as Request; + use apollo_router::services::SubgraphResponse as Response; + type BoxService = tower::util::BoxService; + type BoxCloneService = tower::util::BoxCloneService; + + // Reachable from Request or Response: + use apollo_router::query_planner::OperationKind; +} +``` + +Migration example: + +```diff +-use tower::util::BoxService; +-use tower::BoxError; +-use apollo_router::services::{RouterRequest, RouterResponse}; ++use apollo_router::stages::router; + +-async fn example(service: BoxService) -> RouterResponse { ++async fn example(service: router::BoxService) -> router::Response { +- let request = RouterRequest::builder()/*…*/.build(); ++ let request = router::Request::builder()/*…*/.build(); + service.oneshot(request).await + } +``` + +By [@SimonSapin](https://github.com/SimonSapin) + +### Some items were removed from the public API ([PR #1487](https://github.com/apollographql/router/pull/1487) [PR #1535](https://github.com/apollographql/router/pull/1535)) + +If you used some of them and don’t find a replacement, +please [file an issue](https://github.com/apollographql/router/issues/) +with details about the use case. + +``` +apollo_router::Configuration::boxed +apollo_router::Configuration::is_compatible +apollo_router::errors::CacheResolverError +apollo_router::errors::JsonExtError +apollo_router::errors::ParsesError::print +apollo_router::errors::PlanError +apollo_router::errors::PlannerError +apollo_router::errors::PlannerErrors +apollo_router::errors::QueryPlannerError +apollo_router::errors::ServiceBuildError +apollo_router::json_ext +apollo_router::layers::ServiceBuilderExt::cache +apollo_router::mock_service! +apollo_router::plugins +apollo_router::plugin::plugins +apollo_router::plugin::PluginFactory +apollo_router::plugin::DynPlugin +apollo_router::plugin::Handler +apollo_router::plugin::test::IntoSchema +apollo_router::plugin::test::MockSubgraphFactory +apollo_router::plugin::test::PluginTestHarness +apollo_router::query_planner::QueryPlan::execute +apollo_router::services +apollo_router::Schema +``` + +By [@SimonSapin](https://github.com/SimonSapin) + +### Router startup API changes ([PR #1487](https://github.com/apollographql/router/pull/1487)) + +The `RouterHttpServer::serve` method and its return type `RouterHandle` were removed, +their functionality merged into `RouterHttpServer` (formerly `ApolloRouter`). +The builder for `RouterHttpServer` now ends with a `start` method instead of `build`. +This method immediatly starts the server in a new Tokio task. + +```diff + RouterHttpServer::builder() + .configuration(configuration) + .schema(schema) +- .build() +- .serve() ++ .start() + .await +``` + +By [@SimonSapin](https://github.com/SimonSapin) + +### `router_builder_fn` replaced by `shutdown` in the `Executable` builder ([PR #1487](https://github.com/apollographql/router/pull/1487)) + +The builder for `apollo_router::Executable` had a `router_builder_fn` method +allowing to specify how a `RouterHttpServer` (previously `ApolloRouter`) was to be created +with a provided configuration and schema. +The only possible variation there was specifying when the server should shut down +with a `ShutdownSource` parameter, +so `router_builder_fn` was replaced with a new `shutdown` method that takes that. + +```diff + use apollo_router::Executable; +-use apollo_router::RouterHttpServer; + use apollo_router::ShutdownSource; + + Executable::builder() +- .router_builder_fn(|configuration, schema| RouterHttpServer::builder() +- .configuration(configuration) +- .schema(schema) +- .shutdown(ShutdownSource::None) +- .start()) ++ .shutdown(ShutdownSource::None) + .start() + .await +``` + +By [@SimonSapin](https://github.com/SimonSapin) + +### Removed constructors when there is a public builder ([PR #1487](https://github.com/apollographql/router/pull/1487)) + +Many types in the Router API can be constructed with the builder pattern. +We use the [`buildstructor`](https://crates.io/crates/buildstructor) crate +to auto-generate builder boilerplate based on the parameters of a constructor. +These constructors have been made private so that users must go through the builder instead, +which will allow us to add parameters in the future without a breaking API change. +If you were using one of these constructors, the migration generally looks like this: + +```diff +-apollo_router::graphql::Error::new(m, vec![l], Some(p), Default::default()) ++apollo_router::graphql::Error::build() ++ .message(m) ++ .location(l) ++ .path(p) ++ .build() +``` + +By [@SimonSapin](https://github.com/SimonSapin) + +### Removed deprecated type aliases ([PR #1487](https://github.com/apollographql/router/pull/1487)) + +A few versions ago, some types were moved from the crate root to a new `graphql` module. +To help the transition, type aliases were left at the old location with a deprecation warning. +These aliases are now removed, remaining imports must be changed to the new location: + +```diff +-use apollo_router::Error; +-use apollo_router::Request; +-use apollo_router::Response; ++use apollo_router::graphql::Error; ++use apollo_router::graphql::Request; ++use apollo_router::graphql::Response; +``` + +Alternatively, import the module with `use apollo_router::graphql` +then use qualified paths such as `graphql::Request`. +This can help disambiguate when multiple types share a name. + +By [@SimonSapin](https://github.com/SimonSapin) + +### `RouterRequest::fake_builder` defaults to `Content-Type: application/json` ([PR #1487](https://github.com/apollographql/router/pull/1487)) + +`apollo_router::services::RouterRequest` has a builder for creating a “fake” request during tests. +When no `Content-Type` header is specified, this builder will now default to `application/json`. +This will help tests where a request goes through mandatory plugins including CSRF protection. +which makes the request be accepted by CSRF protection. + +If a test requires a request specifically *without* a `Content-Type` header, +this default can be removed from a `RouterRequest` after building it: + +```rust +let mut router_request = RouterRequest::fake_builder().build(); +router_request.originating_request.headers_mut().remove("content-type"); +``` + +By [@SimonSapin](https://github.com/SimonSapin) + +### Plugins return a service for custom endpoints ([Issue #1481](https://github.com/apollographql/router/issues/1481)) + +Rust plugins can implement the `Plugin::custom_endpoint` trait method +to handle some non-GraphQL HTTP requests. + +Previously, the return type of this method was `Option`, +where a `Handler` could be created with: + +```rust +impl Handler { + pub fn new(service: tower::util::BoxService< + apollo_router::http_ext::Request, + apollo_router::http_ext::Response, + tower::BoxError + >) -> Self {/* … */} +} +``` + +`Handler` has been removed from the public API, now plugins return a `BoxService` directly instead. +Additionally, the type for HTTP request and response bodies was changed +from `bytes::Bytes` to `hyper::Body` (which is more flexible, for example can be streamed). + +Changes needed if using custom enpoints are: + +* Replace `Handler::new(service)` with `service` +* To read the full request body, + use [`hyper::body::to_bytes`](https://docs.rs/hyper/latest/hyper/body/fn.to_bytes.html) + or [`hyper::body::aggregate`](https://docs.rs/hyper/latest/hyper/body/fn.aggregate.html). +* A response `Body` can be created through conversion traits from various types. + For example: `"string".into()` + +By [@SimonSapin](https://github.com/SimonSapin) + +## 🚀 Features + +### rhai logging functions now accept Dynamic parameters ([PR #1521](https://github.com/apollographql/router/pull/1521)) + +Prior to this change, rhai logging functions worked with string parameters. This change means that any valid rhai object +may now be passed as a logging parameter. + +By [@garypen](https://github.com/garypen) + +### Reduce initial memory footprint by lazily populating introspection query cache ([#1517](https://github.com/apollographql/router/issues/1517)) + +In an early alpha release of the Router, we only executed certain "known" introspection queries because of prior technical constraints that prohibited us from doing something more flexible. Because the set of introspection queries was "known", it made sense to cache them. + +As of https://github.com/apollographql/router/pull/802, this special-casing is (thankfully) no longer necessary and we no longer need to _know_ (and constrain!) the introspection queries that the Router supports. + +We could have kept caching those "known" queries, however we were finding that the resulting cache size was quite large and making the Router's minimum memory footprint larger than need be since we were caching many introspection results which the Router instance would never encounter. + +This change removes the cache entirely and allows introspection queries served by the Router to merely be lazily calculated and cached on-demand, thereby reducing the initial memory footprint. Disabling introspection entirely will prevent any use of this cache since no introspection will be possible. + +By [@o0Ignition0o](https://github.com/o0Ignition0o) + +### Expose query plan in extensions for GraphQL response (experimental) ([PR #1470](https://github.com/apollographql/router/pull/1470)) + +Expose query plan in extensions for GraphQL response. Only experimental for now, no documentation available. + +By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/1470 + +### Add support of global rate limit and timeout. [PR #1347](https://github.com/apollographql/router/pull/1347) + +Additions to the traffic shaping plugin: +- **Global rate limit** - If you want to rate limit requests to subgraphs or to the router itself. +- **Timeout**: - Set a timeout to subgraphs and router requests. + +```yaml +traffic_shaping: + router: # Rules applied to requests from clients to the router + global_rate_limit: # Accept a maximum of 10 requests per 5 secs. Excess requests must be rejected. + capacity: 10 + interval: 5s # Must not be greater than 18_446_744_073_709_551_615 milliseconds and not less than 0 milliseconds + timeout: 50s # If a request to the router takes more than 50secs then cancel the request (30 sec by default) + subgraphs: # Rules applied to requests from the router to individual subgraphs + products: + global_rate_limit: # Accept a maximum of 10 requests per 5 secs from the router. Excess requests must be rejected. + capacity: 10 + interval: 5s # Must not be greater than 18_446_744_073_709_551_615 milliseconds and not less than 0 milliseconds + timeout: 50s # If a request to the subgraph 'products' takes more than 50secs then cancel the request (30 sec by default) +``` + +By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/1347 + +### Explicit `shutdown` for `RouterHttpServer` handle ([PR #1487](https://github.com/apollographql/router/pull/1487)) + +If you explicitly create a `RouterHttpServer` handle, +dropping it while the server is running instructs the server shut down gracefuly. +However with the handle dropped, there is no way to wait for shutdown to end +or check that it went without error. +Instead, the new `shutdown` async method can be called explicitly +to obtain a `Result`: + +```diff + use RouterHttpServer; + let server = RouterHttpServer::builder().schema("schema").start(); + // … +-drop(server); ++server.shutdown().await.unwrap(); +``` + +By [@SimonSapin](https://github.com/SimonSapin) + +### Added `apollo_router::TestHarness` ([PR #1487](https://github.com/apollographql/router/pull/1487)) + +This is a builder for the part of an Apollo Router that handles GraphQL requests, +as a `tower::Service`. +This allows tests, benchmarks, etc +to manipulate request and response objects in memory without going over the network. +See the API documentation for an example. (It can be built with `cargo doc --open`.) + +By [@SimonSapin](https://github.com/SimonSapin) + +### Remove telemetry configuration hot reloading ([PR #1501](https://github.com/apollographql/router/pull/1501)) + +The `map_deferred_response` method is now available for the router service and execution +service in Rhai. When using the `@defer` directive, we get the data in a serie of graphql +responses. The first one is available with the `map_response` method, where the HTTP headers +and the response body can be modified. The following responses are available through +`map_deferred_response`, which only has access to the response body. + +By [@geal](https://github.com/geal) in https://github.com/apollographql/router/pull/1501 + +## 🐛 Fixes + +### Variables validation: return a 400 if variables validation fails ([#1403](https://github.com/apollographql/router/issues/1403)) + +Failure to validate variables against a query and a schema will now return an HTTP 400. + +By [@o0Ignition0o](https://github.com/o0Ignition0o) + +### Expose query plan: move the behavior to the execution_service ([#1541](https://github.com/apollographql/router/issues/1541)) + +There isn't much use for QueryPlanner plugins. Most of the logic done there can be done in `execution_service`. Moreover users could get inconsistent plugin behavior because it depends on whether the QueryPlanner cache hits or not. + +By [@o0Ignition0o](https://github.com/o0Ignition0o) + +### Include usage reporting data in the context even when the query plan has been cached ([#1559](https://github.com/apollographql/router/issues/1559)) + +Include usage reporting data in the context even when the query plan has been cached when calling `CachingQueryPlanner`. + +By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/1559 + +### Accept SIGTERM as shutdown signal ([PR #1497](https://github.com/apollographql/router/pull/1497)) + +This will make containers stop faster as they will not have to wait until a SIGKILL to stop the router. + +By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1497 + +### Set the response path for deferred responses ([PR #1529](https://github.com/apollographql/router/pull/1529)) + +Some GraphQL clients rely on the response path to find out which +fragment created a deferred response, and generate code that checks the +type of the value at that path. +Previously the router was generating a value that starts at the root +for every deferred response. Now it checks the path returned by the query +plan execution and creates a response for each value that matches that +path. +In particular, for deferred fragments on an ojbect inside an array, it +will create a separate response for each element of the array. + +By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1529 + +### Activate defer support in introspection ([PR #1557](https://github.com/apollographql/router/pull/1557)) + +Introspection queries will now see the `@defer` directive if it was activated in the configuration file. + +By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1557 + +### Support the incremental response field ([PR #1551](https://github.com/apollographql/router/pull/1551)) + +Recent changes in the `@defer` specification now mandate that the deferred responses are transmitted +as an array in the new `incremental` field of the JSON response. + +By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1551 + +## 🛠 Maintenance + +### Display licenses.html diff in CI if the check failed ([#1524](https://github.com/apollographql/router/issues/1524)) + +The CI check that ensures that the `license.html` file is up to date now displays what has changed when the file is out of sync. + +By [@o0Ignition0o](https://github.com/o0Ignition0o) + +## 🚀 Features + +### Helm: Rhai script and Istio virtualservice support ([#1478](https://github.com/apollographql/router/issues/1478)) + +You can now pass a Rhai script file to the helm chart. +You can also provide an Istio VirtualService configuration, as well as custom Egress rules. +Head over to the helm chart [default values](https://github.com/apollographql/router/blob/main/helm/chart/router/values.yaml) to get started. + +By [@o0Ignition0o](https://github.com/o0Ignition0o) + +## 📚 Documentation + +### Clarify path parameter usage ([PR #1473](https://github.com/apollographql/router/pull/1473)) + +Add an inline example of path parameter usage to the [section of the docs](https://www.apollographql.com/docs/router/configuration/overview/#endpoint-path) explaining that you cannot specify a wildcard in the middle of a path. + +By [@EverlastingBugstopper](https://github.com/EverlastingBugstopper) in https://github.com/apollographql/router/pull/1473 + # [0.15.1] - 2022-08-10 ## ⚠️ **SECURITY** ⚠️ From e9b3cd2c513c62c8126d532f99ac212abba0422c Mon Sep 17 00:00:00 2001 From: Geoffroy Couprie Date: Mon, 22 Aug 2022 13:18:19 +0200 Subject: [PATCH 2/6] wip --- CHANGELOG.md | 49 ++--- NEXT_CHANGELOG.md | 485 +--------------------------------------------- 2 files changed, 16 insertions(+), 518 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e083ee6778..65b4d9dc38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -116,43 +116,22 @@ In the `apollo_router::plugin::Plugin` trait: * `router_service` → `supergraph_service` -A new `apollo_router::stages` module replaces `apollo_router::services` in the public API, -reexporting its items and adding `BoxService` and `BoxCloneService` type aliases. -Additionally, the "router stage" is now known as "supergraph stage". -In pseudo-syntax, `use`’ing the old names: +In the `apollo_router::services` module, to new public sub-modules: -```rust -mod supergraph { - use apollo_router::services::RouterRequest as Request; - use apollo_router::services::RouterResponse as Response; - type BoxService = tower::util::BoxService; - type BoxCloneService = tower::util::BoxCloneService; -} - -pub mod execution { - use tower::BoxError; - - pub use crate::services::ExecutionRequest as Request; - pub use crate::services::ExecutionResponse as Response; - pub type BoxService = tower::util::BoxService; - pub type BoxCloneService = tower::util::BoxCloneService; - pub type Result = std::result::Result; +* `SupergraphRequest` → `supergraph::Request` +* `SupergraphResponse` → `supergraph::Response` +* `ExecutionRequest` → `execution::Request` +* `ExecutionResponse` → `execution::Response` +* `SubgraphRequest` → `subgraph::Request` +* `SubgraphResponse` → `subgraph::Response` - // Reachable from Request or Response: - pub use crate::query_planner::QueryPlan; - pub use crate::services::QueryPlannerContent; -} - -mod subgraph { - use super::*; - use apollo_router::services::SubgraphRequest as Request; - use apollo_router::services::SubgraphResponse as Response; - type BoxService = tower::util::BoxService; - type BoxCloneService = tower::util::BoxCloneService; +For convenience, these new sub-modules each contain type aliases +base on their respective `Request` and `Response` types. - // Reachable from Request or Response: - use apollo_router::query_planner::OperationKind; -} +```rust +pub type BoxService = tower::util::BoxService; +pub type BoxCloneService = tower::util::BoxCloneService; +pub type ServiceResult = Result; ``` Migration example: @@ -161,7 +140,7 @@ Migration example: -use tower::util::BoxService; -use tower::BoxError; -use apollo_router::services::{RouterRequest, RouterResponse}; -+use apollo_router::stages::router; ++use apollo_router::services::router; -async fn example(service: BoxService) -> RouterResponse { +async fn example(service: router::BoxService) -> router::Response { diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 3d8c467e4c..183f70f880 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -23,491 +23,10 @@ Description! And a link to a [reference](http://url) By [@USERNAME](https://github.com/USERNAME) in https://github.com/apollographql/router/pull/PULL_NUMBER --> -# [0.16] (unreleased) - 2022-mm-dd +# [x.x.x] (unreleased) - 2022-mm-dd ## ❗ BREAKING ❗ - - -### Remove QueryPlannerService ([PR #1552](https://github.com/apollographql/router/pull/1552)) - -This service was redundant, since anything done as part of the `QueryPlannerService` could be done either at the `SupergraphService` or at the `ExecutionService` level. - -By [@o0Ignition0o](https://github.com/o0Ignition0o) - -### Rename map_future_with_context to map_future_with_request_data ([PR #1547](https://github.com/apollographql/router/pull/1547)) - -The function is not very well named since it's in fact used to extract any data from a request for use in a future. This rename makes it clear. - -By [@garypen](https://github.com/garypen) - -### Rename traffic shaping deduplication options ([PR #1540](https://github.com/apollographql/router/pull/1540)) - -In the traffic shaping module: - - `variables_deduplication` configuration option is renamed to `deduplicate_variables`. - - `query_deduplication` configuration option is renamed to `deduplicate_query`. - -```diff -- traffic_shaping: -- variables_deduplication: true # Enable the variables deduplication optimization -- all: -- query_deduplication: true # Enable query deduplication for all subgraphs. -- subgraphs: -- products: -- query_deduplication: false # Disable query deduplication for products. -+ traffic_shaping: -+ deduplicate_variables: true # Enable the variables deduplication optimization -+ all: -+ deduplicate_query: true # Enable query deduplication for all subgraphs. -+ subgraphs: -+ products: -+ deduplicate_query: false # Disable query deduplication for products. -``` - -By [@garypen](https://github.com/garypen) - -### Put `query_plan_options` in private and wrap `QueryPlanContent` in an opaque type ([PR #1486](https://github.com/apollographql/router/pull/1486)) - -`QueryPlanOptions::query_plan_options` is no longer available in public. - -By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/1486 - -### Removed `delay_interval` in telemetry configuration. ([PR #1498](https://github.com/apollographql/router/pull/1498)) - -It was doing nothing. - -```yaml title="router.yaml" -telemetry: - metrics: - common: - # Removed, will now cause an error on Router startup: - delay_interval: - secs: 9 - nanos: 500000000 -``` - -By [@SimonSapin](https://github.com/SimonSapin) - -### Remove telemetry configuration hot reloading ([PR #1463](https://github.com/apollographql/router/pull/1463)) - -Configuration hot reloading is not very useful for telemetry, and is the -source of regular bugs that are hard to fix. - -This removes the support for configuration reloading entirely. Now, the -router will reject a configuration reload with an error log if the -telemetry configuration changed. - -It is now possible to create a subscriber and pass it explicitely to the telemetry plugin -when creating it. It will then be modified to integrate the telemetry plugin's layer. - -By [@geal](https://github.com/geal) in https://github.com/apollographql/router/pull/1463 - -### Reorder query planner execution ([PR #1484](https://github.com/apollographql/router/pull/1484)) - -Query planning is deterministic, it only depends on the query, operation name and query planning -options. As such, we can cache the result of the entire process. - -This changes the pipeline to apply query planner plugins between the cache and the bridge planner, -so those plugins will only be called once on the same query. If changes must be done per query, -they should happen in a supergraph service. - -By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1464 - -### Remove Buffer from Mock*Service ([PR #1440](https://github.com/apollographql/router/pull/1440) - -This removes the usage of `tower_test::mock::Mock` in mocked services because it isolated the service in a task -so panics triggered by mockall were not transmitted up to the unit test that should catch it. -This rewrites the mocked services API to remove the `build()` method, and make them clonable if needed, -using an `expect_clone` call with mockall. - -By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1440 - -### Some items were renamed or moved ([PR #1487](https://github.com/apollographql/router/pull/1487)) - -At the crate root: - -* `SchemaKind` → `SchemaSource` -* `SchemaKind::String(String)` → `SchemaSource::Static { schema_sdl: String }` -* `ConfigurationKind` → `ConfigurationSource` -* `ConfigurationKind::Instance` → `ConfigurationSource::Static` -* `ShutdownKind` → `ShutdownSource` -* `ApolloRouter` → `RouterHttpServer` - -In the `apollo_router::plugin::Plugin` trait: - -* `router_service` → `supergraph_service` - -In the `apollo_router::services` module, to new public sub-modules: - -* `SupergraphRequest` → `supergraph::Request` -* `SupergraphResponse` → `supergraph::Response` -* `ExecutionRequest` → `execution::Request` -* `ExecutionResponse` → `execution::Response` -* `SubgraphRequest` → `subgraph::Request` -* `SubgraphResponse` → `subgraph::Response` - -For convenience, these new sub-modules each contain type aliases -base on their respective `Request` and `Response` types. - -```rust -pub type BoxService = tower::util::BoxService; -pub type BoxCloneService = tower::util::BoxCloneService; -pub type ServiceResult = Result; -``` - -Migration example: - -```diff --use tower::util::BoxService; --use tower::BoxError; --use apollo_router::services::{RouterRequest, RouterResponse}; -+use apollo_router::services::router; - --async fn example(service: BoxService) -> RouterResponse { -+async fn example(service: router::BoxService) -> router::Response { -- let request = RouterRequest::builder()/*…*/.build(); -+ let request = router::Request::builder()/*…*/.build(); - service.oneshot(request).await - } -``` - -By [@SimonSapin](https://github.com/SimonSapin) - -### Some items were removed from the public API ([PR #1487](https://github.com/apollographql/router/pull/1487)) - -If you used some of them and don’t find a replacement, -please [file an issue](https://github.com/apollographql/router/issues/) -with details about the use case. - -``` -apollo_router::Configuration::boxed -apollo_router::Configuration::is_compatible -apollo_router::errors::CacheResolverError -apollo_router::errors::JsonExtError -apollo_router::errors::ParsesError::print -apollo_router::errors::PlanError -apollo_router::errors::PlannerError -apollo_router::errors::PlannerErrors -apollo_router::errors::QueryPlannerError -apollo_router::errors::ServiceBuildError -apollo_router::json_ext -apollo_router::layers::ServiceBuilderExt::cache -apollo_router::mock_service! -apollo_router::plugins -apollo_router::plugin::plugins -apollo_router::plugin::PluginFactory -apollo_router::plugin::DynPlugin -apollo_router::plugin::Handler -apollo_router::plugin::test::IntoSchema -apollo_router::plugin::test::MockSubgraphFactory -apollo_router::plugin::test::PluginTestHarness -apollo_router::query_planner::QueryPlan::execute -apollo_router::services -apollo_router::Schema -``` - -By [@SimonSapin](https://github.com/SimonSapin) - -### Router startup API changes ([PR #1487](https://github.com/apollographql/router/pull/1487)) - -The `RouterHttpServer::serve` method and its return type `RouterHandle` were removed, -their functionality merged into `RouterHttpServer` (formerly `ApolloRouter`). -The builder for `RouterHttpServer` now ends with a `start` method instead of `build`. -This method immediatly starts the server in a new Tokio task. - -```diff - RouterHttpServer::builder() - .configuration(configuration) - .schema(schema) -- .build() -- .serve() -+ .start() - .await -``` - -By [@SimonSapin](https://github.com/SimonSapin) - -### `router_builder_fn` replaced by `shutdown` in the `Executable` builder ([PR #1487](https://github.com/apollographql/router/pull/1487)) - -The builder for `apollo_router::Executable` had a `router_builder_fn` method -allowing to specify how a `RouterHttpServer` (previously `ApolloRouter`) was to be created -with a provided configuration and schema. -The only possible variation there was specifying when the server should shut down -with a `ShutdownSource` parameter, -so `router_builder_fn` was replaced with a new `shutdown` method that takes that. - -```diff - use apollo_router::Executable; --use apollo_router::RouterHttpServer; - use apollo_router::ShutdownSource; - - Executable::builder() -- .router_builder_fn(|configuration, schema| RouterHttpServer::builder() -- .configuration(configuration) -- .schema(schema) -- .shutdown(ShutdownSource::None) -- .start()) -+ .shutdown(ShutdownSource::None) - .start() - .await -``` - -By [@SimonSapin](https://github.com/SimonSapin) - -### Removed constructors when there is a public builder ([PR #1487](https://github.com/apollographql/router/pull/1487)) - -Many types in the Router API can be constructed with the builder pattern. -We use the [`buildstructor`](https://crates.io/crates/buildstructor) crate -to auto-generate builder boilerplate based on the parameters of a constructor. -These constructors have been made private so that users must go through the builder instead, -which will allow us to add parameters in the future without a breaking API change. -If you were using one of these constructors, the migration generally looks like this: - -```diff --apollo_router::graphql::Error::new(m, vec![l], Some(p), Default::default()) -+apollo_router::graphql::Error::build() -+ .message(m) -+ .location(l) -+ .path(p) -+ .build() -``` - -By [@SimonSapin](https://github.com/SimonSapin) - -### Removed deprecated type aliases ([PR #1487](https://github.com/apollographql/router/pull/1487)) - -A few versions ago, some types were moved from the crate root to a new `graphql` module. -To help the transition, type aliases were left at the old location with a deprecation warning. -These aliases are now removed, remaining imports must be changed to the new location: - -```diff --use apollo_router::Error; --use apollo_router::Request; --use apollo_router::Response; -+use apollo_router::graphql::Error; -+use apollo_router::graphql::Request; -+use apollo_router::graphql::Response; -``` - -Alternatively, import the module with `use apollo_router::graphql` -then use qualified paths such as `graphql::Request`. -This can help disambiguate when multiple types share a name. - -By [@SimonSapin](https://github.com/SimonSapin) - -### `RouterRequest::fake_builder` defaults to `Content-Type: application/json` ([PR #1487](https://github.com/apollographql/router/pull/1487)) - -`apollo_router::services::RouterRequest` has a builder for creating a “fake” request during tests. -When no `Content-Type` header is specified, this builder will now default to `application/json`. -This will help tests where a request goes through mandatory plugins including CSRF protection. -which makes the request be accepted by CSRF protection. - -If a test requires a request specifically *without* a `Content-Type` header, -this default can be removed from a `RouterRequest` after building it: - -```rust -let mut router_request = RouterRequest::fake_builder().build(); -router_request.originating_request.headers_mut().remove("content-type"); -``` - -By [@SimonSapin](https://github.com/SimonSapin) - -### Plugins return a service for custom endpoints ([Issue #1481](https://github.com/apollographql/router/issues/1481)) - -Rust plugins can implement the `Plugin::custom_endpoint` trait method -to handle some non-GraphQL HTTP requests. - -Previously, the return type of this method was `Option`, -where a `Handler` could be created with: - -```rust -impl Handler { - pub fn new(service: tower::util::BoxService< - apollo_router::http_ext::Request, - apollo_router::http_ext::Response, - tower::BoxError - >) -> Self {/* … */} -} -``` - -`Handler` has been removed from the public API, now plugins return a `BoxService` directly instead. -Additionally, the type for HTTP request and response bodies was changed -from `bytes::Bytes` to `hyper::Body` (which is more flexible, for example can be streamed). - -Changes needed if using custom enpoints are: - -* Replace `Handler::new(service)` with `service` -* To read the full request body, - use [`hyper::body::to_bytes`](https://docs.rs/hyper/latest/hyper/body/fn.to_bytes.html) - or [`hyper::body::aggregate`](https://docs.rs/hyper/latest/hyper/body/fn.aggregate.html). -* A response `Body` can be created through conversion traits from various types. - For example: `"string".into()` - -By [@SimonSapin](https://github.com/SimonSapin) - ## 🚀 Features - -### rhai logging functions now accept Dynamic parameters ([PR #1521](https://github.com/apollographql/router/pull/1521)) - -Prior to this change, rhai logging functions worked with string parameters. This change means that any valid rhai object -may now be passed as a logging parameter. - -By [@garypen](https://github.com/garypen) - -### Reduce initial memory footprint by lazily populating introspection query cache ([#1516](https://github.com/apollographql/router/issues/1516)) - -In an early alpha release of the Router, we only executed certain "known" introspection queries because of prior technical constraints that prohibited us from doing something more flexible. Because the set of introspection queries was "known", it made sense to cache them. - -As of https://github.com/apollographql/router/pull/802, this special-casing is (thankfully) no longer necessary and we no longer need to _know_ (and constrain!) the introspection queries that the Router supports. - -We could have kept caching those "known" queries, however we were finding that the resulting cache size was quite large and making the Router's minimum memory footprint larger than need be since we were caching many introspection results which the Router instance would never encounter. - -This change removes the cache entirely and allows introspection queries served by the Router to merely be lazily calculated and cached on-demand, thereby reducing the initial memory footprint. Disabling introspection entirely will prevent any use of this cache since no introspection will be possible. - -By [@o0Ignition0o](https://github.com/o0Ignition0o) - -### Expose query plan in extensions for GraphQL response (experimental) ([PR #1470](https://github.com/apollographql/router/pull/1470)) - -Expose query plan in extensions for GraphQL response. Only experimental for now, no documentation available. - -By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/1470 - -### Add support of global rate limit and timeout. [PR #1347](https://github.com/apollographql/router/pull/1347) - -Additions to the traffic shaping plugin: -- **Global rate limit** - If you want to rate limit requests to subgraphs or to the router itself. -- **Timeout**: - Set a timeout to subgraphs and router requests. - -```yaml -traffic_shaping: - router: # Rules applied to requests from clients to the router - global_rate_limit: # Accept a maximum of 10 requests per 5 secs. Excess requests must be rejected. - capacity: 10 - interval: 5s # Must not be greater than 18_446_744_073_709_551_615 milliseconds and not less than 0 milliseconds - timeout: 50s # If a request to the router takes more than 50secs then cancel the request (30 sec by default) - subgraphs: # Rules applied to requests from the router to individual subgraphs - products: - global_rate_limit: # Accept a maximum of 10 requests per 5 secs from the router. Excess requests must be rejected. - capacity: 10 - interval: 5s # Must not be greater than 18_446_744_073_709_551_615 milliseconds and not less than 0 milliseconds - timeout: 50s # If a request to the subgraph 'products' takes more than 50secs then cancel the request (30 sec by default) -``` - -By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/1347 - -### Explicit `shutdown` for `RouterHttpServer` handle ([PR #1487](https://github.com/apollographql/router/pull/1487)) - -If you explicitly create a `RouterHttpServer` handle, -dropping it while the server is running instructs the server shut down gracefuly. -However with the handle dropped, there is no way to wait for shutdown to end -or check that it went without error. -Instead, the new `shutdown` async method can be called explicitly -to obtain a `Result`: - -```diff - use RouterHttpServer; - let server = RouterHttpServer::builder().schema("schema").start(); - // … --drop(server); -+server.shutdown().await.unwrap(); -``` - -By [@SimonSapin](https://github.com/SimonSapin) - -### Added `apollo_router::TestHarness` ([PR #1487](https://github.com/apollographql/router/pull/1487)) - -This is a builder for the part of an Apollo Router that handles GraphQL requests, -as a `tower::Service`. -This allows tests, benchmarks, etc -to manipulate request and response objects in memory without going over the network. -See the API documentation for an example. (It can be built with `cargo doc --open`.) - -By [@SimonSapin](https://github.com/SimonSapin) - -### Remove telemetry configuration hot reloading ([PR #1501](https://github.com/apollographql/router/pull/1501)) - -The `map_deferred_response` method is now available for the router service and execution -service in Rhai. When using the `@defer` directive, we get the data in a serie of graphql -responses. The first one is available with the `map_response` method, where the HTTP headers -and the response body can be modified. The following responses are available through -`map_deferred_response`, which only has access to the response body. - -By [@geal](https://github.com/geal) in https://github.com/apollographql/router/pull/1501 - ## 🐛 Fixes - -### Variables validation: return a 400 if variables validation fails ([#1403](https://github.com/apollographql/router/issues/1403)) - -Failure to validate variables against a query and a schema will now return an HTTP 400. - -By [@o0Ignition0o](https://github.com/o0Ignition0o) - -### Expose query plan: move the behavior to the execution_service ([#1541](https://github.com/apollographql/router/issues/1541)) - -There isn't much use for QueryPlanner plugins. Most of the logic done there can be done in `execution_service`. Moreover users could get inconsistent plugin behavior because it depends on whether the QueryPlanner cache hits or not. - -By [@o0Ignition0o](https://github.com/o0Ignition0o) - -### Include usage reporting data in the context even when the query plan has been cached ([#1559](https://github.com/apollographql/router/issues/1559)) - -Include usage reporting data in the context even when the query plan has been cached when calling `CachingQueryPlanner`. - -By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/1559 - -### Accept SIGTERM as shutdown signal ([PR #1497](https://github.com/apollographql/router/pull/1497)) - -This will make containers stop faster as they will not have to wait until a SIGKILL to stop the router. - -By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1497 - -### Set the response path for deferred responses ([PR #1529](https://github.com/apollographql/router/pull/1529)) - -Some GraphQL clients rely on the response path to find out which -fragment created a deferred response, and generate code that checks the -type of the value at that path. -Previously the router was generating a value that starts at the root -for every deferred response. Now it checks the path returned by the query -plan execution and creates a response for each value that matches that -path. -In particular, for deferred fragments on an ojbect inside an array, it -will create a separate response for each element of the array. - -By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1529 - -### Activate defer support in introspection ([PR #1557](https://github.com/apollographql/router/pull/1557)) - -Introspection queries will now see the `@defer` directive if it was activated in the configuration file. - -By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1557 - -### Support the incremental response field ([PR #1551](https://github.com/apollographql/router/pull/1551)) - -Recent changes in the `@defer` specification now mandate that the deferred responses are transmitted -as an array in the new `incremental` field of the JSON response. - -By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1551 - ## 🛠 Maintenance - -### Display licenses.html diff in CI if the check failed ([#1524](https://github.com/apollographql/router/issues/1524)) - -The CI check that ensures that the `license.html` file is up to date now displays what has changed when the file is out of sync. - -By [@o0Ignition0o](https://github.com/o0Ignition0o) - -## 🚀 Features - -### Helm: Rhai script and Istio virtualservice support ([#1478](https://github.com/apollographql/router/issues/1478)) - -You can now pass a Rhai script file to the helm chart. -You can also provide an Istio VirtualService configuration, as well as custom Egress rules. -Head over to the helm chart [default values](https://github.com/apollographql/router/blob/main/helm/chart/router/values.yaml) to get started. - -By [@o0Ignition0o](https://github.com/o0Ignition0o) - -## 📚 Documentation - -### Clarify path parameter usage ([PR #1473](https://github.com/apollographql/router/pull/1473)) - -Add an inline example of path parameter usage to the [section of the docs](https://www.apollographql.com/docs/router/configuration/overview/#endpoint-path) explaining that you cannot specify a wildcard in the middle of a path. - -By [@EverlastingBugstopper](https://github.com/EverlastingBugstopper) in https://github.com/apollographql/router/pull/1473 +## 📚 Documentation \ No newline at end of file From 796c8270405c9acd189ee22baa960a9559b2aff0 Mon Sep 17 00:00:00 2001 From: Geoffroy Couprie Date: Mon, 22 Aug 2022 13:29:16 +0200 Subject: [PATCH 3/6] wip --- Cargo.lock | 10 +++++----- apollo-router-scaffold/Cargo.toml | 2 +- apollo-router-scaffold/templates/base/Cargo.toml | 2 +- .../templates/base/xtask/Cargo.toml | 4 ++-- apollo-router/Cargo.toml | 2 +- apollo-spaceport/Cargo.toml | 2 +- dockerfiles/tracing/docker-compose.datadog.yml | 2 +- dockerfiles/tracing/docker-compose.jaeger.yml | 2 +- dockerfiles/tracing/docker-compose.zipkin.yml | 2 +- docs/source/containerization/docker.mdx | 8 ++++---- docs/source/containerization/kubernetes.mdx | 16 ++++++++-------- docs/source/federation-version-support.mdx | 11 +++++++++++ helm/chart/router/Chart.yaml | 4 ++-- helm/chart/router/README.md | 2 +- uplink/Cargo.toml | 2 +- xtask/Cargo.toml | 2 +- 16 files changed, 42 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 433829c3b2..3133a3b88a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -124,7 +124,7 @@ dependencies = [ [[package]] name = "apollo-router" -version = "0.15.1" +version = "0.16.0" dependencies = [ "access-json", "anyhow", @@ -240,7 +240,7 @@ dependencies = [ [[package]] name = "apollo-router-scaffold" -version = "0.15.1" +version = "0.16.0" dependencies = [ "anyhow", "cargo-scaffold", @@ -266,7 +266,7 @@ dependencies = [ [[package]] name = "apollo-spaceport" -version = "0.15.1" +version = "0.16.0" dependencies = [ "bytes", "clap 3.2.17", @@ -287,7 +287,7 @@ dependencies = [ [[package]] name = "apollo-uplink" -version = "0.15.1" +version = "0.16.0" dependencies = [ "futures", "graphql_client", @@ -6456,7 +6456,7 @@ dependencies = [ [[package]] name = "xtask" -version = "0.15.1" +version = "0.16.0" dependencies = [ "ansi_term", "anyhow", diff --git a/apollo-router-scaffold/Cargo.toml b/apollo-router-scaffold/Cargo.toml index 79b226e5be..f416f277be 100644 --- a/apollo-router-scaffold/Cargo.toml +++ b/apollo-router-scaffold/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "apollo-router-scaffold" -version = "0.15.1" +version = "0.16.0" authors = ["Apollo Graph, Inc. "] edition = "2021" license = "Elastic-2.0" diff --git a/apollo-router-scaffold/templates/base/Cargo.toml b/apollo-router-scaffold/templates/base/Cargo.toml index 7a58b1abd1..95d6c27817 100644 --- a/apollo-router-scaffold/templates/base/Cargo.toml +++ b/apollo-router-scaffold/templates/base/Cargo.toml @@ -22,7 +22,7 @@ apollo-router = { path ="{{integration_test}}apollo-router" } apollo-router = { git="https://github.com/apollographql/router.git", branch="{{branch}}" } {{else}} # Note if you update these dependencies then also update xtask/Cargo.toml -apollo-router = { git="https://github.com/apollographql/router.git", tag="v0.15.1" } +apollo-router = { git="https://github.com/apollographql/router.git", tag="v0.16.0" } {{/if}} {{/if}} async-trait = "0.1.52" diff --git a/apollo-router-scaffold/templates/base/xtask/Cargo.toml b/apollo-router-scaffold/templates/base/xtask/Cargo.toml index 00841cda9e..0d8ed07906 100644 --- a/apollo-router-scaffold/templates/base/xtask/Cargo.toml +++ b/apollo-router-scaffold/templates/base/xtask/Cargo.toml @@ -2,7 +2,7 @@ name = "xtask" edition = "2021" publish = false -version = "0.15.1" +version = "0.16.0" [dependencies] # This dependency should stay in line with your router version @@ -13,7 +13,7 @@ apollo-router-scaffold = { path ="{{integration_test}}apollo-router-scaffold" } {{#if branch}} apollo-router-scaffold = { git="https://github.com/apollographql/router.git", branch="{{branch}}" } {{else}} -apollo-router-scaffold = { git="https://github.com/apollographql/router.git", tag="v0.15.1"} +apollo-router-scaffold = { git="https://github.com/apollographql/router.git", tag="v0.16.0"} {{/if}} {{/if}} anyhow = "1.0.58" diff --git a/apollo-router/Cargo.toml b/apollo-router/Cargo.toml index e9cb1866d6..be46751107 100644 --- a/apollo-router/Cargo.toml +++ b/apollo-router/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "apollo-router" -version = "0.15.1" +version = "0.16.0" authors = ["Apollo Graph, Inc. "] edition = "2021" license = "Elastic-2.0" diff --git a/apollo-spaceport/Cargo.toml b/apollo-spaceport/Cargo.toml index e67660e3c7..1967c8ba79 100644 --- a/apollo-spaceport/Cargo.toml +++ b/apollo-spaceport/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "apollo-spaceport" -version = "0.15.1" +version = "0.16.0" authors = ["Apollo Graph, Inc. "] edition = "2021" license = "Elastic-2.0" diff --git a/dockerfiles/tracing/docker-compose.datadog.yml b/dockerfiles/tracing/docker-compose.datadog.yml index 7f419da10b..05d4ebcd0e 100644 --- a/dockerfiles/tracing/docker-compose.datadog.yml +++ b/dockerfiles/tracing/docker-compose.datadog.yml @@ -3,7 +3,7 @@ services: apollo-router: container_name: apollo-router - image: ghcr.io/apollographql/router:v0.15.1 + image: ghcr.io/apollographql/router:v0.16.0 volumes: - ./supergraph.graphql:/etc/config/supergraph.graphql - ./router/datadog.router.yaml:/etc/config/configuration.yaml diff --git a/dockerfiles/tracing/docker-compose.jaeger.yml b/dockerfiles/tracing/docker-compose.jaeger.yml index 1aa14af30d..297c9664c0 100644 --- a/dockerfiles/tracing/docker-compose.jaeger.yml +++ b/dockerfiles/tracing/docker-compose.jaeger.yml @@ -4,7 +4,7 @@ services: apollo-router: container_name: apollo-router #build: ./router - image: ghcr.io/apollographql/router:v0.15.1 + image: ghcr.io/apollographql/router:v0.16.0 volumes: - ./supergraph.graphql:/etc/config/supergraph.graphql - ./router/jaeger.router.yaml:/etc/config/configuration.yaml diff --git a/dockerfiles/tracing/docker-compose.zipkin.yml b/dockerfiles/tracing/docker-compose.zipkin.yml index ba624d68bc..8e9bfad358 100644 --- a/dockerfiles/tracing/docker-compose.zipkin.yml +++ b/dockerfiles/tracing/docker-compose.zipkin.yml @@ -4,7 +4,7 @@ services: apollo-router: container_name: apollo-router build: ./router - image: ghcr.io/apollographql/router:v0.15.1 + image: ghcr.io/apollographql/router:v0.16.0 volumes: - ./supergraph.graphql:/etc/config/supergraph.graphql - ./router/zipkin.router.yaml:/etc/config/configuration.yaml diff --git a/docs/source/containerization/docker.mdx b/docs/source/containerization/docker.mdx index 79a3092564..ed26b6be12 100644 --- a/docs/source/containerization/docker.mdx +++ b/docs/source/containerization/docker.mdx @@ -11,7 +11,7 @@ The default behaviour of the router images is suitable for a quickstart or devel Note: The [docker documentation](https://docs.docker.com/engine/reference/run/) for the run command may be helpful when reading through the examples. -Note: The exact image version to use is your choice depending on which release you wish to use. In the following examples, replace `` with your chosen version. e.g.: `v0.15.1` +Note: The exact image version to use is your choice depending on which release you wish to use. In the following examples, replace `` with your chosen version. e.g.: `v0.16.0` ## Override the configuration @@ -92,10 +92,10 @@ Usage: build_docker_image.sh [-b] [] Example 1: Building HEAD from the repo build_docker_image.sh -b Example 2: Building tag from the repo - build_docker_image.sh -b v0.15.1 + build_docker_image.sh -b v0.16.0 Example 3: Building commit hash from the repo build_docker_image.sh -b 1c220d35acf9ad2537b8edc58c498390b6701d3d - Example 4: Building tag v0.15.1 from the released tarball - build_docker_image.sh v0.15.1 + Example 4: Building tag v0.16.0 from the released tarball + build_docker_image.sh v0.16.0 ``` Note: The script has to be run from the `dockerfiles/diy` directory because it makes assumptions about the relative availability of various files. The example uses [distroless images](https://github.com/GoogleContainerTools/distroless) for the final image build. Feel free to modify the script to use images which better suit your own needs. diff --git a/docs/source/containerization/kubernetes.mdx b/docs/source/containerization/kubernetes.mdx index af80628bd8..c93362b2f5 100644 --- a/docs/source/containerization/kubernetes.mdx +++ b/docs/source/containerization/kubernetes.mdx @@ -13,7 +13,7 @@ import { Link } from 'gatsby'; [Helm](https://helm.sh) is the package manager for kubernetes. -There is a complete [helm chart definition](https://github.com/apollographql/router/tree/v0.15.1/helm/chart/router) in the repo which illustrates how to use helm to deploy the router in kubernetes. +There is a complete [helm chart definition](https://github.com/apollographql/router/tree/v0.16.0/helm/chart/router) in the repo which illustrates how to use helm to deploy the router in kubernetes. In both the following examples, we are using helm to install the router: - into namespace "router-deploy" (create namespace if it doesn't exist) @@ -29,7 +29,7 @@ router docker images. You can use helm to install charts from an OCI registry as follows: ```bash -helm install --set router.configuration.telemetry.metrics.prometheus.enabled=true --set managedFederation.apiKey="REDACTED" --set managedFederation.graphRef="REDACTED" --create-namespace --namespace router-deploy router-test oci://ghcr.io/apollographql/helm-charts/router --version 0.15.1 --values router/values.yaml +helm install --set router.configuration.telemetry.metrics.prometheus.enabled=true --set managedFederation.apiKey="REDACTED" --set managedFederation.graphRef="REDACTED" --create-namespace --namespace router-deploy router-test oci://ghcr.io/apollographql/helm-charts/router --version 0.16.0 --values router/values.yaml ``` For more details about using helm with OCI based registries, see [here](https://helm.sh/docs/topics/registries/) @@ -66,7 +66,7 @@ metadata: labels: app.kubernetes.io/name: router app.kubernetes.io/instance: router-test - app.kubernetes.io/version: "v0.15.1" + app.kubernetes.io/version: "v0.16.0" --- # Source: router/templates/secret.yaml apiVersion: v1 @@ -76,7 +76,7 @@ metadata: labels: app.kubernetes.io/name: router app.kubernetes.io/instance: router-test - app.kubernetes.io/version: "v0.15.1" + app.kubernetes.io/version: "v0.16.0" data: managedFederationApiKey: "REDACTED" --- @@ -88,7 +88,7 @@ metadata: labels: app.kubernetes.io/name: router app.kubernetes.io/instance: router-test - app.kubernetes.io/version: "v0.15.1" + app.kubernetes.io/version: "v0.16.0" data: configuration.yaml: | server: @@ -106,7 +106,7 @@ metadata: labels: app.kubernetes.io/name: router app.kubernetes.io/instance: router-test - app.kubernetes.io/version: "v0.15.1" + app.kubernetes.io/version: "v0.16.0" spec: type: ClusterIP ports: @@ -126,7 +126,7 @@ metadata: labels: app.kubernetes.io/name: router app.kubernetes.io/instance: router-test - app.kubernetes.io/version: "v0.15.1" + app.kubernetes.io/version: "v0.16.0" annotations: prometheus.io/path: /plugins/apollo.telemetry/prometheus prometheus.io/port: "80" @@ -150,7 +150,7 @@ spec: - name: router securityContext: {} - image: "ghcr.io/apollographql/router:v0.15.1" + image: "ghcr.io/apollographql/router:v0.16.0" imagePullPolicy: IfNotPresent args: - --hot-reload diff --git a/docs/source/federation-version-support.mdx b/docs/source/federation-version-support.mdx index e6fdacf2c0..5f9418117c 100644 --- a/docs/source/federation-version-support.mdx +++ b/docs/source/federation-version-support.mdx @@ -20,6 +20,17 @@ Apollo Federation is an evolving project, and it will receive new features and b + + + v0.16.0 + + + 2.1.0-alpha.4 + + + 2022-08-22 + + v0.15.1 diff --git a/helm/chart/router/Chart.yaml b/helm/chart/router/Chart.yaml index af07b902e1..434968ead1 100644 --- a/helm/chart/router/Chart.yaml +++ b/helm/chart/router/Chart.yaml @@ -15,10 +15,10 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.19 +version: 0.1.20 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. -appVersion: "v0.15.1" +appVersion: "v0.16.0" diff --git a/helm/chart/router/README.md b/helm/chart/router/README.md index b21a8ccb7e..794c0f9fe7 100644 --- a/helm/chart/router/README.md +++ b/helm/chart/router/README.md @@ -2,7 +2,7 @@ [router](https://github.com/apollographql/router) Rust Graph Routing runtime for Apollo Federation -![Version: 0.1.19](https://img.shields.io/badge/Version-0.1.19-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.15.1](https://img.shields.io/badge/AppVersion-v0.15.1-informational?style=flat-square) +![Version: 0.1.20](https://img.shields.io/badge/Version-0.1.20-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.16.0](https://img.shields.io/badge/AppVersion-v0.16.0-informational?style=flat-square) ## Prerequisites diff --git a/uplink/Cargo.toml b/uplink/Cargo.toml index 37ac7ec2c6..c787f6e622 100644 --- a/uplink/Cargo.toml +++ b/uplink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "apollo-uplink" -version = "0.15.1" +version = "0.16.0" edition = "2021" build = "build.rs" diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 57b170dedb..53eca203ad 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xtask" -version = "0.15.1" +version = "0.16.0" authors = ["Apollo Graph, Inc. "] edition = "2021" license = "LicenseRef-ELv2" From 8e2829ca7f50889f1dfe8ce7fd9aabfae2b22249 Mon Sep 17 00:00:00 2001 From: Geoffroy Couprie Date: Mon, 22 Aug 2022 13:40:38 +0200 Subject: [PATCH 4/6] fix --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65b4d9dc38..5679885298 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to Router will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -# [0.16] (unreleased) - 2022-08-22 +# [0.16.0] - 2022-08-22 ## ❗ BREAKING ❗ From 11a8d93b218ae10777421dc86adfb16fb3ec7293 Mon Sep 17 00:00:00 2001 From: Geoffroy Couprie Date: Mon, 22 Aug 2022 15:12:43 +0200 Subject: [PATCH 5/6] Apply suggestions from code review Co-authored-by: Jesse Rosenberger Co-authored-by: Gary Pennington --- CHANGELOG.md | 43 ++++++++++++++------- docs/source/containerization/kubernetes.mdx | 2 +- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5679885298..55a2ea867c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,19 +6,35 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm # [0.16.0] - 2022-08-22 +We're getting closer and closer to our 1.0 release and with that we have a lot of polish that we're applying to our API to get it ready for it to be a durable surface area for our consumers to depend on. Due to various learnings we've had during the pre-1.0 phases of the Router, we are evolving our API to match what we now know. + +We do not intend on doing this much moving around of things again soon, but anyone who has been following the repository the last couple weeks knows there has been a lot of activity and discussion about where things should live. This means that this release has an _abnormally high number of breaking changes_, though we believe you'll find **_most_ of them to be relatively straightforward** to pivot away from. + +Please review the full change log to get all the details, but for the most part the changes in this release consist of: + + - a lot of renames of existing symbols + - the re-location of exported symbols to more appropriate modules + - the privatization of functions which we don't believe users needed directly (see below if any of these turn out to be a problem). + + During each step of the migration, we recommend **searching this changelog** for a symbol to find advice on how to migrate it. We've tried to make the instructions and path forward as clear as possible. + +- If you find yourself **needing help migrating** to the new patterns, please first take a close look at the examples provided in this change log and if you still need help, please [**open a discussion**](https://github.com/apollographql/router/discussions/). +- If you find yourself **unable to do something** you had previously been able to do, please [**open an issue**](https://github.com/apollographql/router/issues). Please make sure you include your use-case so we can understand better and document it for posterity! + +We appreciate your patience working through these and we're excited for the steps ahead! ## ❗ BREAKING ❗ -### Remove QueryPlannerService ([PR #1552](https://github.com/apollographql/router/pull/1552)) +### Remove `QueryPlannerService` ([PR #1552](https://github.com/apollographql/router/pull/1552)) This service was redundant, since anything done as part of the `QueryPlannerService` could be done either at the `SupergraphService` or at the `ExecutionService` level. -By [@o0Ignition0o](https://github.com/o0Ignition0o) +By [@o0Ignition0o](https://github.com/o0Ignition0o) in https://github.com/apollographql/router/pull/1552 -### Rename map_future_with_context to map_future_with_request_data ([PR #1547](https://github.com/apollographql/router/pull/1547)) +### Rename `map_future_with_context` to `map_future_with_request_data` ([PR #1547](https://github.com/apollographql/router/pull/1547)) The function is not very well named since it's in fact used to extract any data from a request for use in a future. This rename makes it clear. -By [@garypen](https://github.com/garypen) +By [@garypen](https://github.com/garypen) in https://github.com/apollographql/router/pull/1547 ### Rename traffic shaping deduplication options ([PR #1540](https://github.com/apollographql/router/pull/1540)) @@ -43,11 +59,11 @@ In the traffic shaping module: + deduplicate_query: false # Disable query deduplication for products. ``` -By [@garypen](https://github.com/garypen) +By [@garypen](https://github.com/garypen) in https://github.com/apollographql/router/pull/1540 -### Put `query_plan_options` in private and wrap `QueryPlanContent` in an opaque type ([PR #1486](https://github.com/apollographql/router/pull/1486)) +### Make `query_plan_options` private and wrap `QueryPlanContent` in an opaque type ([PR #1486](https://github.com/apollographql/router/pull/1486)) -`QueryPlanOptions::query_plan_options` is no longer available in public. +`QueryPlanOptions::query_plan_options` is no longer public. If you still necessitate usage of this, please open an issue with your use case. By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/1486 @@ -65,7 +81,7 @@ telemetry: nanos: 500000000 ``` -By [@SimonSapin](https://github.com/SimonSapin) +By [@SimonSapin](https://github.com/SimonSapin) in https://github.com/apollographql/router/pull/1498 ### Remove telemetry configuration hot reloading ([PR #1463](https://github.com/apollographql/router/pull/1463)) @@ -83,7 +99,7 @@ By [@geal](https://github.com/geal) in https://github.com/apollographql/router/p ### Reorder query planner execution ([PR #1484](https://github.com/apollographql/router/pull/1484)) -Query planning is deterministic, it only depends on the query, operation name and query planning +Query planning is deterministic and only depends on the query, operation name and query planning options. As such, we can cache the result of the entire process. This changes the pipeline to apply query planner plugins between the cache and the bridge planner, @@ -92,7 +108,7 @@ they should happen in a supergraph service. By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1464 -### Remove Buffer from Mock*Service ([PR #1440](https://github.com/apollographql/router/pull/1440) +### Remove `Buffer` from `Mock*Service` ([PR #1440](https://github.com/apollographql/router/pull/1440) This removes the usage of `tower_test::mock::Mock` in mocked services because it isolated the service in a task so panics triggered by mockall were not transmitted up to the unit test that should catch it. @@ -209,11 +225,10 @@ By [@SimonSapin](https://github.com/SimonSapin) ### `router_builder_fn` replaced by `shutdown` in the `Executable` builder ([PR #1487](https://github.com/apollographql/router/pull/1487)) The builder for `apollo_router::Executable` had a `router_builder_fn` method -allowing to specify how a `RouterHttpServer` (previously `ApolloRouter`) was to be created +allowing the specification of how a `RouterHttpServer` (previously `ApolloRouter`) was to be created with a provided configuration and schema. -The only possible variation there was specifying when the server should shut down -with a `ShutdownSource` parameter, -so `router_builder_fn` was replaced with a new `shutdown` method that takes that. +Since the only possible variation was specifying _when_ the server should shut down +(with a `ShutdownSource` parameter) the `router_builder_fn` was replaced with a new `shutdown` method. ```diff use apollo_router::Executable; diff --git a/docs/source/containerization/kubernetes.mdx b/docs/source/containerization/kubernetes.mdx index c93362b2f5..3ca60bce43 100644 --- a/docs/source/containerization/kubernetes.mdx +++ b/docs/source/containerization/kubernetes.mdx @@ -29,7 +29,7 @@ router docker images. You can use helm to install charts from an OCI registry as follows: ```bash -helm install --set router.configuration.telemetry.metrics.prometheus.enabled=true --set managedFederation.apiKey="REDACTED" --set managedFederation.graphRef="REDACTED" --create-namespace --namespace router-deploy router-test oci://ghcr.io/apollographql/helm-charts/router --version 0.16.0 --values router/values.yaml +helm install --set router.configuration.telemetry.metrics.prometheus.enabled=true --set managedFederation.apiKey="REDACTED" --set managedFederation.graphRef="REDACTED" --create-namespace --namespace router-deploy router-test oci://ghcr.io/apollographql/helm-charts/router --version 0.1.20 --values router/values.yaml ``` For more details about using helm with OCI based registries, see [here](https://helm.sh/docs/topics/registries/) From 2e7675e3e661f6edf71e70f8ac83d692f30655ad Mon Sep 17 00:00:00 2001 From: Geoffroy Couprie Date: Mon, 22 Aug 2022 15:26:26 +0200 Subject: [PATCH 6/6] Apply suggestions from code review Co-authored-by: Jesse Rosenberger --- CHANGELOG.md | 76 +++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55a2ea867c..f1b91baad0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -166,7 +166,7 @@ Migration example: } ``` -By [@SimonSapin](https://github.com/SimonSapin) +By [@SimonSapin](https://github.com/SimonSapin) in https://github.com/apollographql/router/pull/1487, https://github.com/apollographql/router/pull/1534, https://github.com/apollographql/router/pull/1555, https://github.com/apollographql/router/pull/1563 ### Some items were removed from the public API ([PR #1487](https://github.com/apollographql/router/pull/1487) [PR #1535](https://github.com/apollographql/router/pull/1535)) @@ -220,7 +220,7 @@ This method immediatly starts the server in a new Tokio task. .await ``` -By [@SimonSapin](https://github.com/SimonSapin) +By [@SimonSapin](https://github.com/SimonSapin) in https://github.com/apollographql/router/pull/1487 ### `router_builder_fn` replaced by `shutdown` in the `Executable` builder ([PR #1487](https://github.com/apollographql/router/pull/1487)) @@ -246,7 +246,7 @@ Since the only possible variation was specifying _when_ the server should shut d .await ``` -By [@SimonSapin](https://github.com/SimonSapin) +By [@SimonSapin](https://github.com/SimonSapin) in https://github.com/apollographql/router/pull/1487 ### Removed constructors when there is a public builder ([PR #1487](https://github.com/apollographql/router/pull/1487)) @@ -266,13 +266,13 @@ If you were using one of these constructors, the migration generally looks like + .build() ``` -By [@SimonSapin](https://github.com/SimonSapin) +By [@SimonSapin](https://github.com/SimonSapin) in https://github.com/apollographql/router/pull/1487 ### Removed deprecated type aliases ([PR #1487](https://github.com/apollographql/router/pull/1487)) A few versions ago, some types were moved from the crate root to a new `graphql` module. To help the transition, type aliases were left at the old location with a deprecation warning. -These aliases are now removed, remaining imports must be changed to the new location: +These aliases are now removed and remaining imports must be changed to the new locations: ```diff -use apollo_router::Error; @@ -287,13 +287,13 @@ Alternatively, import the module with `use apollo_router::graphql` then use qualified paths such as `graphql::Request`. This can help disambiguate when multiple types share a name. -By [@SimonSapin](https://github.com/SimonSapin) +By [@SimonSapin](https://github.com/SimonSapin) in https://github.com/apollographql/router/pull/1487 ### `RouterRequest::fake_builder` defaults to `Content-Type: application/json` ([PR #1487](https://github.com/apollographql/router/pull/1487)) `apollo_router::services::RouterRequest` has a builder for creating a “fake” request during tests. When no `Content-Type` header is specified, this builder will now default to `application/json`. -This will help tests where a request goes through mandatory plugins including CSRF protection. +This will help tests where a request goes through mandatory plugins, including CSRF protection, which makes the request be accepted by CSRF protection. If a test requires a request specifically *without* a `Content-Type` header, @@ -304,12 +304,12 @@ let mut router_request = RouterRequest::fake_builder().build(); router_request.originating_request.headers_mut().remove("content-type"); ``` -By [@SimonSapin](https://github.com/SimonSapin) +By [@SimonSapin](https://github.com/SimonSapin) in https://github.com/apollographql/router/pull/1487 -### Plugins return a service for custom endpoints ([Issue #1481](https://github.com/apollographql/router/issues/1481)) +### Plugins return a `service` to create custom endpoints ([Issue #1481](https://github.com/apollographql/router/issues/1481)) Rust plugins can implement the `Plugin::custom_endpoint` trait method -to handle some non-GraphQL HTTP requests. +to handle non-GraphQL HTTP requests. Previously, the return type of this method was `Option`, where a `Handler` could be created with: @@ -324,11 +324,11 @@ impl Handler { } ``` -`Handler` has been removed from the public API, now plugins return a `BoxService` directly instead. +`Handler` has been removed from the public API and plugins now return a `BoxService` directly. Additionally, the type for HTTP request and response bodies was changed -from `bytes::Bytes` to `hyper::Body` (which is more flexible, for example can be streamed). +from `bytes::Bytes` to `hyper::Body` which is more flexible and is compatible with streams (which are necessary in future versions of the Router). -Changes needed if using custom enpoints are: +The changes needed if using custom endpoints are: * Replace `Handler::new(service)` with `service` * To read the full request body, @@ -337,7 +337,7 @@ Changes needed if using custom enpoints are: * A response `Body` can be created through conversion traits from various types. For example: `"string".into()` -By [@SimonSapin](https://github.com/SimonSapin) +By [@SimonSapin](https://github.com/SimonSapin) in https://github.com/apollographql/router/pull/1533 ## 🚀 Features @@ -348,7 +348,7 @@ may now be passed as a logging parameter. By [@garypen](https://github.com/garypen) -### Reduce initial memory footprint by lazily populating introspection query cache ([#1517](https://github.com/apollographql/router/issues/1517)) +### Reduce initial memory footprint by lazily populating introspection query cache ([Issue #1517](https://github.com/apollographql/router/issues/1517)) In an early alpha release of the Router, we only executed certain "known" introspection queries because of prior technical constraints that prohibited us from doing something more flexible. Because the set of introspection queries was "known", it made sense to cache them. @@ -358,11 +358,11 @@ We could have kept caching those "known" queries, however we were finding that t This change removes the cache entirely and allows introspection queries served by the Router to merely be lazily calculated and cached on-demand, thereby reducing the initial memory footprint. Disabling introspection entirely will prevent any use of this cache since no introspection will be possible. -By [@o0Ignition0o](https://github.com/o0Ignition0o) +By [@o0Ignition0o](https://github.com/o0Ignition0o) in https://github.com/apollographql/router/pull/1517 -### Expose query plan in extensions for GraphQL response (experimental) ([PR #1470](https://github.com/apollographql/router/pull/1470)) +### Expose query plan in extensions of GraphQL response (experimental) ([PR #1470](https://github.com/apollographql/router/pull/1470)) -Expose query plan in extensions for GraphQL response. Only experimental for now, no documentation available. +When enabled in configuration, it is now possible to expose the query plan in the GraphQL response `extensions`. This is only experimental at the moment, and we plan to integrate it into an upcoming version of Apollo Studio. Currently, no documentation is available. By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/1470 @@ -377,13 +377,13 @@ traffic_shaping: router: # Rules applied to requests from clients to the router global_rate_limit: # Accept a maximum of 10 requests per 5 secs. Excess requests must be rejected. capacity: 10 - interval: 5s # Must not be greater than 18_446_744_073_709_551_615 milliseconds and not less than 0 milliseconds + interval: 5s # Value in milliseconds must be greater than 0 and less than the max of a 64-bit integer (2^64-1). timeout: 50s # If a request to the router takes more than 50secs then cancel the request (30 sec by default) subgraphs: # Rules applied to requests from the router to individual subgraphs products: global_rate_limit: # Accept a maximum of 10 requests per 5 secs from the router. Excess requests must be rejected. capacity: 10 - interval: 5s # Must not be greater than 18_446_744_073_709_551_615 milliseconds and not less than 0 milliseconds + interval: 5s # Value in milliseconds must be greater than 0 and less than the max of a 64-bit integer (2^64-1). timeout: 50s # If a request to the subgraph 'products' takes more than 50secs then cancel the request (30 sec by default) ``` @@ -406,7 +406,7 @@ to obtain a `Result`: +server.shutdown().await.unwrap(); ``` -By [@SimonSapin](https://github.com/SimonSapin) +By [@SimonSapin](https://github.com/SimonSapin) in https://github.com/apollographql/router/pull/1487 ### Added `apollo_router::TestHarness` ([PR #1487](https://github.com/apollographql/router/pull/1487)) @@ -416,9 +416,9 @@ This allows tests, benchmarks, etc to manipulate request and response objects in memory without going over the network. See the API documentation for an example. (It can be built with `cargo doc --open`.) -By [@SimonSapin](https://github.com/SimonSapin) +By [@SimonSapin](https://github.com/SimonSapin) in https://github.com/apollographql/router/pull/1487 -### Remove telemetry configuration hot reloading ([PR #1501](https://github.com/apollographql/router/pull/1501)) +### Introduce `map_deferred_response` method for deferred responses ([PR #1501](https://github.com/apollographql/router/pull/1501)) The `map_deferred_response` method is now available for the router service and execution service in Rhai. When using the `@defer` directive, we get the data in a serie of graphql @@ -430,15 +430,9 @@ By [@geal](https://github.com/geal) in https://github.com/apollographql/router/p ## 🐛 Fixes -### Variables validation: return a 400 if variables validation fails ([#1403](https://github.com/apollographql/router/issues/1403)) - -Failure to validate variables against a query and a schema will now return an HTTP 400. - -By [@o0Ignition0o](https://github.com/o0Ignition0o) - -### Expose query plan: move the behavior to the execution_service ([#1541](https://github.com/apollographql/router/issues/1541)) +### Return HTTP status code 400 when `variables` validation fails ([Issue #1403](https://github.com/apollographql/router/issues/1403)) -There isn't much use for QueryPlanner plugins. Most of the logic done there can be done in `execution_service`. Moreover users could get inconsistent plugin behavior because it depends on whether the QueryPlanner cache hits or not. +Failure to validate out-of-band `variables` against both the `query` and the corresponding schema will now result in an HTTP status code of 400 being returned to the client. This instructs the client not to bother retrying without changing something about what it previously sent since subsequent retries would just fail validation again and again. By [@o0Ignition0o](https://github.com/o0Ignition0o) @@ -448,22 +442,22 @@ Include usage reporting data in the context even when the query plan has been ca By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/1559 -### Accept SIGTERM as shutdown signal ([PR #1497](https://github.com/apollographql/router/pull/1497)) +### Accept `SIGTERM` as shutdown signal ([PR #1497](https://github.com/apollographql/router/pull/1497)) -This will make containers stop faster as they will not have to wait until a SIGKILL to stop the router. +This will make containers stop faster as they will not have to wait until a `SIGKILL` to stop the router (which generally comes several seconds later). By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1497 -### Set the response path for deferred responses ([PR #1529](https://github.com/apollographql/router/pull/1529)) +### Set the response `path` for deferred responses ([PR #1529](https://github.com/apollographql/router/pull/1529)) -Some GraphQL clients rely on the response path to find out which +Some GraphQL clients rely on the response `path` to find out which fragment created a deferred response, and generate code that checks the type of the value at that path. Previously the router was generating a value that starts at the root -for every deferred response. Now it checks the path returned by the query +for every deferred response. Now it checks the `path` returned by the query plan execution and creates a response for each value that matches that path. -In particular, for deferred fragments on an ojbect inside an array, it +In particular, for deferred fragments on an object inside an array, it will create a separate response for each element of the array. By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1529 @@ -483,7 +477,9 @@ By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/p ## 🛠 Maintenance -### Display licenses.html diff in CI if the check failed ([#1524](https://github.com/apollographql/router/issues/1524)) +These are generally internal improvements to the Router repository on GitHub. + +### Display `licenses.html` diff in CI if the check failed ([#1524](https://github.com/apollographql/router/issues/1524)) The CI check that ensures that the `license.html` file is up to date now displays what has changed when the file is out of sync. @@ -494,10 +490,10 @@ By [@o0Ignition0o](https://github.com/o0Ignition0o) ### Helm: Rhai script and Istio virtualservice support ([#1478](https://github.com/apollographql/router/issues/1478)) You can now pass a Rhai script file to the helm chart. -You can also provide an Istio VirtualService configuration, as well as custom Egress rules. +You can also provide an Istio `VirtualService` configuration, as well as custom `Egress` rules. Head over to the helm chart [default values](https://github.com/apollographql/router/blob/main/helm/chart/router/values.yaml) to get started. -By [@o0Ignition0o](https://github.com/o0Ignition0o) +By [@o0Ignition0o](https://github.com/o0Ignition0o) in https://github.com/apollographql/router/pull/1478 ## 📚 Documentation