Releases: apollographql/router
v2.0.0-preview.1
2.0.0-preview.1
v1.57.1
🐛 Fixes
Progressive override: fix query planner cache warmup (PR #6108)
This fixes an issue in progressive override where the override labels were not transmitted to the query planner during cache warmup. Queries were correctly using the overridden fields at first, but after an update, reverted to non overridden fields, and could not recover.
v1.57.1-rc.0
prep release: v1.57.1-rc.0
v1.57.0
Important
If you have enabled Distributed query plan caching, updates to the query planner in this release will result in query plan caches being re-generated rather than re-used. On account of this, you should anticipate additional cache regeneration cost when updating between these versions while the new query plans come into service.
🚀 Features
Remove legacy schema introspection (PR #6139)
Schema introspection in the router now runs natively without JavaScript. We have high confidence that the new native implementation returns responses that match the previous Javascript implementation, based on differential testing: fuzzing arbitrary queries against a large schema, and testing a corpus of customer schemas against a comprehensive query.
Changes to the router's YAML configuration:
- The
experimental_introspection_mode
key has been removed, with thenew
mode as the only behavior in this release. - The
supergraph.query_planning.legacy_introspection_caching
key is removed, with the behavior in this release now similar to what wasfalse
: introspection responses are not part of the query plan cache but instead in a separate, small in-memory—only cache.
When using the above deprecated configuration options, the router's automatic configuration migration will ensure that existing configuration continue to work until the next major version of the router. To simplify major upgrades, we recommend reviewing incremental updates to your YAML configuration by comparing the output of ./router config upgrade --config path/to/config.yaml
with your existing configuration.
By @SimonSapin in #6139
Support new request_context
selector for telemetry (PR #6160)
The router supports a new request_context
selector for telemetry that enables access to the supergraph schema ID.
You can configure the context to access the supergraph schema ID at the router service level:
telemetry:
instrumentation:
events:
router:
my.request_event:
message: "my request event message"
level: info
on: request
attributes:
schema.id:
request_context: "apollo::supergraph_schema_id" # The key containing the supergraph schema id
You can use the selector in any service at any stage. While this example applies to events
attributes, the selector can also be used on spans and instruments.
Support reading and setting port
on request URIs using Rhai (Issue #5437)
Custom Rhai scripts in the router now support the request.uri.port
and request.subgraph.uri.port
functions for reading and setting URI ports. These functions enable you to update the full URI for subgraph fetches. For example:
fn subgraph_service(service, subgraph){
service.map_request(|request|{
log_info(``);
if request.subgraph.uri.port == {} {
log_info("Port is not explicitly set");
}
request.subgraph.uri.host = "api.apollographql.com";
request.subgraph.uri.path = "/api/graphql";
request.subgraph.uri.port = 1234;
log_info(``);
});
}
🐛 Fixes
Fix various edge cases for __typename
field (PR #6009)
The router now correctly handles the __typename
field used on operation root types, even when the subgraph's root type has a name that differs from the supergraph's root type.
For example, given a query like this:
{
...RootFragment
}
fragment RootFragment on Query {
__typename
me {
name
}
}
Even if the subgraph's root type returns a __typename
that differs from Query
, the router will still use Query
as the value of the __typename
field.
This change also includes fixes for other edge cases related to the handling of __typename
fields. For a detailed technical description of the edge cases that were fixed, please see this description.
By @IvanGoncharov in #6009
Support uri
and method
properties on router "request" objects in Rhai (PR #6147)
The router now supports accessing request.uri
and request.method
properties from custom Rhai scripts. Previously, when trying to access request.uri
and request.method
on a router request in Rhai, the router would return error messages stating the properties were undefined.
An example Rhai script using these properties:
fn router_service(service) {
let router_request_callback = Fn("router_request_callback");
service.map_request(router_request_callback);
}
fn router_request_callback (request) {
log_info(`Router Request... Host: , Path: `);
}
By @andrewmcgivery in #6114
Cost calculation for subgraph requests with named fragments (PR #6162)
In some cases where subgraph GraphQL operations contain named fragments and abstract types, demand control used the wrong type for cost calculation, and could reject valid operations. Now, the correct type is used.
This fixes errors of the form:
Attempted to look up a field on type MyInterface, but the field does not exist
By @goto-bus-stop in #6162
Federation v2.9.3 (PR #6161)
This release updates to Federation v2.9.3, with query planner fixes:
- Fixes a query planning bug where operation variables for a subgraph query wouldn't match what's used in that query.
- Fixes a query planning bug where directives applied to
__typename
may be omitted in the subgraph query. - Fixes a query planning inefficiency where some redundant subgraph queries were not removed.
- Fixes a query planning inefficiency where some redundant inline fragments in
@key
/@requires
selection sets were not optimized away. - Fixes a query planning inefficiency where unnecessary subgraph jumps were being added when using
@context
/@fromContext
.
By @sachindshinde in #6161
v1.57.0-rc.0
1.57.0-rc.0
v2.0.0-preview.0
Learn more about migrating from 1.x to 2.0.
🚀 Features
Apollo Connectors Public Preview
Apollo Connectors are a new declarative programming model for GraphQL, allowing you to plug your existing REST services directly into your graph.
type Query {
posts(first: Int): [Post]
@connect(
http: { GET: "https://my.api/posts?limit={$args.first}" }
selection: "$.results { id title body }"
)
}
Apollo Connectors are available for Enterprise and free GraphOS Trial accounts. Get started with the Connectors Quickstart and visit the "connectors" tag on the community forums to leave feedback during the preview.
Apollo operation usage reporting via OTLP
The router supports reporting operation usage metrics to GraphOS via OpenTelemetry Protocol (OTLP).
Prior to version 1.49.0 of the router, all GraphOS reporting was performed using a private tracing format. In v1.49.0, we introduced support for using OTEL to perform this reporting. In v1.x, this is controlled using the experimental_otlp_tracing_sampler flag, and it's disabled by default.
Now in v2.x, this flag is renamed to otlp_tracing_sampler, and it's enabled by default.
Learn more about configuring usage reporting via OTLP.
📃 Configuration
Metrics reporting defaults
Default values of some GraphOS reporting metrics have been changed from v1.x to the following in v2.x:
telemetry.apollo.signature_normalization_algorithm
now defaults toenhanced
. (In v1.x the default islegacy
.)telemetry.apollo.metrics_reference_mode
now defaults toextended
. (In v1.x the default isstandard
.)
v1.56.0
Important
If you have enabled Distributed query plan caching, this release changes the hashing algorithm used for the cache keys. On account of this, you should anticipate additional cache regeneration cost when updating between these versions while the new hashing algorithm comes into service.
🚀 Features
Native query planner is now in public preview
The native query planner is now in public preview. You can configure the experimental_query_planner_mode
option in the router configuration YAML to change the mode of the native query planner. The following modes are available:
new
: Enable only the new Rust-native query planner in the hot-path of query execution.legacy
: Enable only the legacy JavaScript query planner in the hot-path of query execution.both_best_effort
: Enables both the new and legacy query planners. They are configured in a comparison-based mode of operation with the legacy planner in the hot-path and the and the new planner in the cold-path. Comparisons are made between the two plans on a sampled basis and metrics are available to analyze the differences in aggregate.
Support loading Apollo key from file (PR #5917)
You can now specific the location to a file containing the Apollo key that's used by Apollo Uplink and usage reporting. The router now supports both the --apollo-key-path
CLI argument and the APOLLO_KEY_PATH
environment variable for passing the file containing your Apollo key.
Previously, the router supported only the APOLLO_KEY
environment variable to provide the key. The new CLI argument and environment variable help users who prefer not to pass sensitive keys through environment variables.
Note: This feature is unavailable for Windows.
🐛 Fixes
Prevent sending internal apollo_private.*
attributes to Jaeger collector (PR #6033)
When using the router's Jaeger collector to send traces, you will no longer receive span attributes with the apollo_private.
prefix. Those attributes were incorrectly sent, as that prefix is reserved for internal attributes.
Fix displaying custom event attributes on subscription events (PR #6033)
The router now properly displays custom event attributes that are set with selectors at the supergraph level.
An example configuration:
telemetry:
instrumentation:
events:
supergraph:
supergraph.event:
message: supergraph event
on: event_response # on every supergraph event (like subscription event for example)
level: info
attributes:
test:
static: foo
response.data:
response_data: $ # Display all the response data payload
response.errors:
response_errors: $ # Display all the response errors payload
Update to Federation v2.9.2 (PR #6069)
This release updates to Federation v2.9.2, with a small fix to the internal __typename
optimization and a fix to prevent argument name collisions in the @context
/@fromContext
directives.
By @dariuszkuc in #6069
📃 Configuration
Add metrics for Rust vs. Deno configuration values (PR #6056)
To help track the migration from JavaScript (Deno) to native Rust implementations, the router now reports the values of the following configuration options to Apollo:
apollo.router.config.experimental_query_planner_mode
apollo.router.config.experimental_introspection_mode
By @goto-bus-stop in #6056
v1.56.0-rc.0
1.56.0-rc.0
v1.55.1-rc.1
1.55.1-rc.1
v1.55.1-rc.0
1.55.1-rc.0