Skip to content

Commit

Permalink
Merge branch 'dev' into bryn/datadog-agent-support
Browse files Browse the repository at this point in the history
  • Loading branch information
BrynCooke authored Oct 25, 2024
2 parents 98624c7 + 79b0aca commit 067eb56
Show file tree
Hide file tree
Showing 104 changed files with 2,512 additions and 1,647 deletions.
28 changes: 28 additions & 0 deletions .changesets/feat_add_dns_resolution_strategy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
### Add ability to configure DNS resolution strategy ([PR #6109](https://github.com/apollographql/router/pull/6109))

The router now supports choosing a DNS resolution strategy for the coprocessor's and subgraph's URLs.
The new option is called `dns_resolution_strategy` and supports the following values:
* `ipv4_only` - Only query for `A` (IPv4) records.
* `ipv6_only` - Only query for `AAAA` (IPv6) records.
* `ipv4_and_ipv6` - Query for both `A` (IPv4) and `AAAA` (IPv6) records in parallel.
* `ipv6_then_ipv4` - Query for `AAAA` (IPv6) records first; if that fails, query for `A` (IPv4) records.
* `ipv4_then_ipv6`(default) - Query for `A` (IPv4) records first; if that fails, query for `AAAA` (IPv6) records.

To change the DNS resolution strategy applied to the subgraph's URL:
```yaml title="router.yaml"
traffic_shaping:
all:
dns_resolution_strategy: ipv4_then_ipv6

```

You can also change the DNS resolution strategy applied to the coprocessor's URL:
```yaml title="router.yaml"
coprocessor:
url: http://coprocessor.example.com:8081
client:
dns_resolution_strategy: ipv4_then_ipv6

```

By [@IvanGoncharov](https://github.com/IvanGoncharov) in https://github.com/apollographql/router/pull/6109
5 changes: 5 additions & 0 deletions .changesets/feat_geal_subgraph_request_id.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Add a subgraph request id ([PR #5858](https://github.com/apollographql/router/pull/5858))

This is a unique string identifying a subgraph request and response, allowing plugins and coprocessors to keep some state per subgraph request by matching on this id. It is available in coprocessors as `subgraphRequestId` and rhai scripts as `request.subgraph.id` and `response.subgraph.id`.

By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/5858
16 changes: 0 additions & 16 deletions .changesets/fix_feature_rhairouterrequesturi.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### If subgraph batching, do not log response data for notification failure ([PR #6150](https://github.com/apollographql/router/pull/6150))

A subgraph response may contain a lot of data and/or PII data.

For a subgraph batching operation, we should not log out the entire subgraph response when failing to notify a waiting batch participant.

By [@garypen](https://github.com/garypen) in https://github.com/apollographql/router/pull/6150
5 changes: 0 additions & 5 deletions .changesets/maint_feature_rhaitelemetry.md

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/docs-publish.yml

This file was deleted.

135 changes: 135 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,141 @@ All notable changes to Router will be documented in this file.

This project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec/v2.0.0.html).

# [1.57.0] - 2024-10-22

> [!IMPORTANT]
> If you have enabled [Distributed query plan caching](https://www.apollographql.com/docs/router/configuration/distributed-caching/#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](https://github.com/apollographql/router/pull/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 the `new` 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 was `false`: 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](https://github.com/SimonSapin) in https://github.com/apollographql/router/pull/6139

### Support new `request_context` selector for telemetry ([PR #6160](https://github.com/apollographql/router/pull/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:

```yaml
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.

By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/6160

### Support reading and setting `port` on request URIs using Rhai ([Issue #5437](https://github.com/apollographql/router/issues/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:

```rust
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(``);
});
}
```

By [@lleadbet](https://github.com/lleadbet) in https://github.com/apollographql/router/pull/5439

## 🐛 Fixes

### Fix various edge cases for `__typename` field ([PR #6009](https://github.com/apollographql/router/pull/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:

```graphql
{
...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](https://github.com/apollographql/router/pull/6009#issue-2529717207).

By [@IvanGoncharov](https://github.com/IvanGoncharov) in https://github.com/apollographql/router/pull/6009

### Support `uri` and `method` properties on router "request" objects in Rhai ([PR #6147](https://github.com/apollographql/router/pull/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:

```rhai
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](https://github.com/andrewmcgivery) in https://github.com/apollographql/router/pull/6114

### Cost calculation for subgraph requests with named fragments ([PR #6162](https://github.com/apollographql/router/issues/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](https://github.com/goto-bus-stop) in https://github.com/apollographql/router/pull/6162

### Federation v2.9.3 ([PR #6161](https://github.com/apollographql/router/pull/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](https://github.com/sachindshinde) in https://github.com/apollographql/router/pull/6161

# [1.56.0] - 2024-10-01

> [!IMPORTANT]
Expand Down
105 changes: 52 additions & 53 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ dependencies = [

[[package]]
name = "apollo-federation"
version = "1.56.0"
version = "1.57.0"
dependencies = [
"apollo-compiler",
"derive_more",
Expand Down Expand Up @@ -229,7 +229,7 @@ dependencies = [

[[package]]
name = "apollo-router"
version = "1.56.0"
version = "1.57.0"
dependencies = [
"access-json",
"ahash",
Expand Down Expand Up @@ -275,6 +275,7 @@ dependencies = [
"graphql_client",
"heck 0.5.0",
"hex",
"hickory-resolver",
"hmac",
"http 0.2.12",
"http-body 0.4.6",
Expand Down Expand Up @@ -382,7 +383,6 @@ dependencies = [
"tracing-serde",
"tracing-subscriber",
"tracing-test",
"trust-dns-resolver",
"uname",
"url",
"urlencoding",
Expand All @@ -397,7 +397,7 @@ dependencies = [

[[package]]
name = "apollo-router-benchmarks"
version = "1.56.0"
version = "1.57.0"
dependencies = [
"apollo-parser",
"apollo-router",
Expand All @@ -413,7 +413,7 @@ dependencies = [

[[package]]
name = "apollo-router-scaffold"
version = "1.56.0"
version = "1.57.0"
dependencies = [
"anyhow",
"cargo-scaffold",
Expand Down Expand Up @@ -3167,6 +3167,51 @@ dependencies = [
"serde",
]

[[package]]
name = "hickory-proto"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07698b8420e2f0d6447a436ba999ec85d8fbf2a398bbd737b82cac4a2e96e512"
dependencies = [
"async-trait",
"cfg-if",
"data-encoding",
"enum-as-inner",
"futures-channel",
"futures-io",
"futures-util",
"idna 0.4.0",
"ipnet",
"once_cell",
"rand 0.8.5",
"thiserror",
"tinyvec",
"tokio",
"tracing",
"url",
]

[[package]]
name = "hickory-resolver"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28757f23aa75c98f254cf0405e6d8c25b831b32921b050a66692427679b1f243"
dependencies = [
"cfg-if",
"futures-util",
"hickory-proto",
"ipconfig",
"lru-cache",
"once_cell",
"parking_lot",
"rand 0.8.5",
"resolv-conf",
"smallvec",
"thiserror",
"tokio",
"tracing",
]

[[package]]
name = "hmac"
version = "0.12.1"
Expand Down Expand Up @@ -5492,9 +5537,9 @@ dependencies = [

[[package]]
name = "router-bridge"
version = "0.6.3+v2.9.2"
version = "0.6.4+v2.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f183e217b4010e7d37d581b7919ca5e0136a46b6d6b1ff297c52e702bce1089"
checksum = "0bcc6f2aa0c619a4fb74ce271873a500f5640c257ca2e7aa8ea6be6226262855"
dependencies = [
"anyhow",
"async-channel 1.9.0",
Expand Down Expand Up @@ -6993,52 +7038,6 @@ dependencies = [
"stable_deref_trait",
]

[[package]]
name = "trust-dns-proto"
version = "0.23.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3119112651c157f4488931a01e586aa459736e9d6046d3bd9105ffb69352d374"
dependencies = [
"async-trait",
"cfg-if",
"data-encoding",
"enum-as-inner",
"futures-channel",
"futures-io",
"futures-util",
"idna 0.4.0",
"ipnet",
"once_cell",
"rand 0.8.5",
"smallvec",
"thiserror",
"tinyvec",
"tokio",
"tracing",
"url",
]

[[package]]
name = "trust-dns-resolver"
version = "0.23.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a3e6c3aff1718b3c73e395d1f35202ba2ffa847c6a62eea0db8fb4cfe30be6"
dependencies = [
"cfg-if",
"futures-util",
"ipconfig",
"lru-cache",
"once_cell",
"parking_lot",
"rand 0.8.5",
"resolv-conf",
"smallvec",
"thiserror",
"tokio",
"tracing",
"trust-dns-proto",
]

[[package]]
name = "try-lock"
version = "0.2.5"
Expand Down
Loading

0 comments on commit 067eb56

Please sign in to comment.