Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: v1.16.0 #3033

Merged
merged 47 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
dd8ca62
linux: replace default allocator with jemalloc (#2882)
garypen Apr 18, 2023
7d0f173
Add a private part to the Context structure (#2802)
Geal Apr 18, 2023
fbc4b4a
lighter path manipulation in response formatting (#2854)
Geal Apr 18, 2023
c0218a3
use a parking-lot mutex in cache storage (#2887)
Geal Apr 18, 2023
efd0033
prevent span attributes from being formatted to write logs (#2890)
Geal Apr 18, 2023
1e6bd0d
Reconcile `dev` after merge to `main` for v1.15.1 (#2972)
abernix Apr 18, 2023
028f6d9
Parse `Accept` headers once instead of three times (#2847)
SimonSapin Apr 18, 2023
de4b1f2
Rate limit otel errors (#2954)
BrynCooke Apr 19, 2023
6cc999b
feat: add support of operationCountByType for apollo studio (#2979)
bnjjj Apr 20, 2023
e691bde
use a parking-lot mutex in Context (#2885)
Geal Apr 20, 2023
e34906b
Fix: Traffic shaping configuration fallback for experimental_enable_h…
o0Ignition0o Apr 20, 2023
c541edf
improve handling of deferred response errors in rhai scripts (#2945)
garypen Apr 20, 2023
af58509
deps: Use nu-ansi-term to replace unmaintained ansi_term (#2844)
yanns Apr 20, 2023
737dc05
Revert "use a parking-lot mutex in cache storage (#2887)" (#2980)
Geal Apr 21, 2023
d50aed1
update h2 (#2982)
Geal Apr 24, 2023
abae695
activate the compression layer for all requests
Geal Apr 24, 2023
0c6b312
Merge branch 'dev' into geal/fix-defer-compression
Geal Apr 24, 2023
3cd2e3f
vendor encoders from async-compression
Geal Apr 24, 2023
3a3412c
implement streaming compression
Geal Apr 24, 2023
cce57c4
add more algorithms
Geal Apr 24, 2023
0d8cb2d
generate the compressor from the Accept-Encoding header
Geal Apr 24, 2023
0f6de99
lint
Geal Apr 24, 2023
e33a9cf
fmt
Geal Apr 24, 2023
f7f6d78
fix the Content-Encoding header
Geal Apr 24, 2023
992fb74
fix tests
Geal Apr 24, 2023
177e837
Merge branch 'dev' into geal/merge-dev-in-staging-perf
Geal Apr 25, 2023
19a3a66
merge dev in staging perf (#2989)
Geal Apr 25, 2023
bc63b32
Revert "merge dev in staging perf"
Geal Apr 25, 2023
1e433fd
Revert "merge dev in staging perf" (#2990)
Geal Apr 25, 2023
0fb0ba9
fixes
Geal Apr 25, 2023
07f6fff
lint
Geal Apr 25, 2023
faaa7f0
Merge branch 'dev' into geal/fix-defer-compression
Geal Apr 26, 2023
aa341a6
Update apollo-router/src/axum_factory/axum_http_server_factory.rs
Geal Apr 26, 2023
56b47fd
remove zlib
Geal Apr 26, 2023
2e4cec7
changeset
Geal Apr 26, 2023
0fbaed1
lint
Geal Apr 27, 2023
f9ec392
Ensure `--prerelease` flag is passed to `gh create release` for pre-r…
abernix Apr 27, 2023
1addfdc
improved error message to address issue #2941 (#2955)
kushal-93 Apr 27, 2023
56f121e
Fix compression for deferred responses (#2986)
Geal Apr 27, 2023
dc252df
fix(telemetry): limit the memory usage of apollo telemetry exporter (…
bnjjj Apr 27, 2023
95cceb4
Time-based forced hot-reload for chaos testing (#2988)
SimonSapin Apr 27, 2023
ebd7908
Re-structure the rhai logging output (#2975)
garypen May 2, 2023
44f9a26
Also support "preview" features, in addition to "experimental" featur…
abernix May 2, 2023
207c686
docs: Rename router docset (#3021)
May 2, 2023
10b7efa
feat(telemetry): selectively transmit/redact subgraph ftv1 error mess…
bnjjj May 3, 2023
7897f81
fix(deps): update rust crate router-bridge to v0.2.2+v2.4.2 (#2910)
renovate[bot] May 3, 2023
60285d1
prep release: v1.16.0
abernix May 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -649,8 +649,19 @@ jobs:
command: >
cd artifacts && sha1sum *.tar.gz > sha1sums.txt
- run:
name: Create GitHub Release
command: >
gh release create $VERSION --notes-file /dev/null --title $VERSION artifacts/*
case "$VERSION" in

# If the VERSION contains a dash, consider it a pre-release version.
# This is in-line with SemVer's expectations/designations!
*-*) gh release create $VERSION --prerelease --notes-file /dev/null --title $VERSION artifacts/* ;;

# In all other cases, publish it as the latest version.
*) gh release create $VERSION --notes-file /dev/null --title $VERSION artifacts/* ;;

esac

- setup_remote_docker:
version: 20.10.11
docker_layer_caching: true
Expand Down
191 changes: 191 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,197 @@ 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.16.0] - 2023-05-03

## 🚀 Features

### Add ability to transmit un-redacted errors from federated traces to Apollo Studio

When using subgraphs which are enabled with [Apollo Federated Tracing](https://www.apollographql.com/docs/router/configuration/apollo-telemetry/#enabling-field-level-instrumentation), the error messages within those traces will be **redacted by default**.

New configuration (`tracing.apollo.errors.subgraph.all.redact`, which defaults to `true`) enables or disables the redaction mechanism. Similar configuration (`tracing.apollo.errors.subgraph.all.send`, which also defaults to `true`) enables or disables the entire transmission of the error to Studio.

The error messages returned to the clients are **not** changed or redacted from their previous behavior.

To enable sending subgraphs' federated trace error messages to Studio **without redaction**, you can set the following configuration:

```yaml title="router.yaml"
telemetry:
apollo:
errors:
subgraph:
all:
send: true # (true = Send to Studio, false = Do not send; default: true)
redact: false # (true = Redact full error message, false = Do not redact; default: true)
```

It is also possible to configure this **per-subgraph** using a `subgraphs` map at the same level as `all` in the configuration, much like other sections of the configuration which have subgraph-specific capabilities:

```yaml title="router.yaml"
telemetry:
apollo:
errors:
subgraph:
all:
send: true
redact: false # Disables redaction as a default. The `accounts` service enables it below.
subgraphs:
accounts: # Applies to the `accounts` subgraph, overriding the `all` global setting.
redact: true # Redacts messages from the `accounts` service.
```

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

### Introduce `response.is_primary` Rhai helper for working with deferred responses ([Issue #2935](https://github.com/apollographql/router/issues/2935)) ([Issue #2936](https://github.com/apollographql/router/issues/2936))

A new Rhai `response.is_primary()` helper has been introduced that returns `false` when the current chunk being processed is a _deferred response_ chunk. Put another way, it will be `false` if the chunk is a _follow-up_ response to the initial _primary_ response, during the fulfillment of a `@defer`'d fragment in a larger operation. The initial response will be `is_primary() == true`. This aims to provide the right primitives so users can write more defensible error checking. It is especially useful for response header manipulations, which is only possible on the primary response. The introduction of this relates to a bug fix noted in the _Fixes_ section below.

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

### Time-based forced hot-reload for "chaos" testing

For testing purposes, the Router can now artificially be forced to hot-reload (as if the configuration or schema had changed) at a configured time interval. This can help reproduce issues like reload-related memory leaks. We don't recommend using this in any production environment. (If you are compelled to use it in production, please let us know about your use case!)

The new configuration section for this "chaos" testing is (and will likely remain) marked as "experimental":

```yaml
experimental_chaos:
force_hot_reload: 1m
```

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

### Provide helpful console output when using "preview" features, just like "experimental" features

This expands on the existing mechanism that was originally introduced in https://github.com/apollographql/router/pull/2242, which supports the notion of an "experimental" feature, and makes it compatible with the notion of "preview" features.

When preview or experimental features are used, an `INFO`-level log is emitted during startup to notify which features are used and shows URLs to their GitHub discussions, for feedback. Additionally, `router config experimental` and `router config preview` CLI sub-commands list all such features in the current Router version, regardless of which are used in a given configuration file.

For more information about launch stages, please see the documentation here: https://www.apollographql.com/docs/resources/product-launch-stages/

By [@o0ignition0o](https://github.com/o0ignition0o), [@abernix](https://github.com/abernix), and [@SimonSapin](https://github.com/SimonSapin) in https://github.com/apollographql/router/pull/2960

### Report `operationCountByType` counts to Apollo Studio ([PR #2979](https://github.com/apollographql/router/pull/2979))

This adds the ability for Studio to track operation **counts** broken down by type of operations (e.g., `query` vs `mutation`). Previously, we only reported total operation count.

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

## 🐛 Fixes

### Update to Federation v2.4.2

This update to Federation v2.4.2 fixes a [potential bug](https://github.com/apollographql/federation/pull/2524) when an `@interfaceObject` type has a `@requires`. This might be encountered when an `@interfaceObject` type has a field with a `@requires` and the query requests that field only for some specific implementations of the corresponding interface. In this case, the generated query plan was sometimes invalid and could result in an invalid query to a subgraph. In the case that the subgraph was an Apollo Server implementation, this lead to the subgraph producing an `"The _entities resolver tried to load an entity for type X, but no object or interface type of that name was found in the schema"` error.

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

### Fix handling of deferred response errors from Rhai scripts ([Issue #2935](https://github.com/apollographql/router/issues/2935)) ([Issue #2936](https://github.com/apollographql/router/issues/2936))

If a Rhai script was to error while processing a deferred response (i.e., an operation which uses `@defer`) the Router was ignoring the error and returning `None` in the stream of results. This had two unfortunate aspects:

- the error was not propagated to the client
- the stream was terminated (silently)

With this fix we now capture the error and still propagate the response to the client. This fix _also_ adds support for the `is_primary()` method which may be invoked on both `supergraph_service()` and `execution_service()` responses. It may be used to avoid implementing exception handling for header interactions and to determine if a response `is_primary()` (i.e., first) or not.

e.g.:

<!-- not perl, but the syntax highlighting is close -->
```perl
if response.is_primary() {
print(`all response headers: `);
} else {
print(`don't try to access headers`);
}
```

vs

<!-- not perl, but the syntax highlighting is close -->
```perl
try {
print(`all response headers: `);
}
catch(err) {
if err == "cannot access headers on a deferred response" {
print(`don't try to access headers`);
}
}
```

> **Note**
> This is a _minimal_ example for purposes of illustration which doesn't exhaustively check all error conditions. An exception handler should always handle all error conditions.

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

### Fix incorrectly placed "message" in Rhai JSON-formatted logging ([Issue #2777](https://github.com/apollographql/router/issues/2777))

This fixes a bug where Rhai logging was incorrectly putting the message of the log into the `out` attribute, when serialized as JSON. Previously, the `message` field was showing `rhai_{{level}}` (i.e., `rhai_info`), despite there being a separate `level` field in the JSON structure.

The impact of this fix can be seen in this example where we call `log_info()` in a Rhai script:

<!-- not perl, but the syntax highlighting is close -->
```perl
log_info("this is info");
```

**Previously**, this would result in a log as follows, with the text of the message set within `out`, rather than `message`.

```json
{"timestamp":"2023-04-19T07:46:15.483358Z","level":"INFO","message":"rhai_info","out":"this is info"}
```

**After the change**, the message is correctly within `message`. The level continues to be available at `level`. We've also additionally added a `target` property which shows the file which produced the error:

```json
{"timestamp":"2023-04-19T07:46:15.483358Z","level":"INFO","message":"this is info","target":"src/rhai_logging.rhai"}
```

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


### Deferred responses now utilize compression, when requested ([Issue #1572](https://github.com/apollographql/router/issues/1572))

We previously had to disable compression on deferred responses due to an upstream library bug. To fix this, we've replaced `tower-http`'s `CompressionLayer` with a custom stream transformation. This is necessary because `tower-http` uses `async-compression` under the hood, which buffers data until the end of the stream, analyzes it, then writes it, ensuring a better compression. However, this is wholly-incompatible with a core concept of the multipart protocol for `@defer`, which requires chunks to be sent _as soon as possible_. To support that, we need to compress chunks independently.

This extracts parts of the `codec` module of `async-compression`, which so far is not public, and makes a streaming wrapper _above it_ that flushes the compressed data on every response within the stream.

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

### Update the `h2` dependency to fix a _potential_ Denial-of-Service (DoS) vulnerability

Proactively addresses the advisory in https://rustsec.org/advisories/RUSTSEC-2023-0034, though we have no evidence that suggests it has been exploited on any Router deployment.

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

### Rate limit errors emitted from OpenTelemetry ([Issue #2953](https://github.com/apollographql/router/issues/2953))

When a batch span exporter is unable to send accept a span because the buffer is full it will emit an error. These errors can be very frequent and could potentially impact performance. To mitigate this, OpenTelemetry errors are now rate limited to one every ten seconds, per error type.

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

### Improved messaging when a request is received without an operation ([Issue #2941](https://github.com/apollographql/router/issues/2941))

The message that is displayed when a request has been sent to the Router without an operation has been improved. This materializes as a developer experience improvement since users (especially those using GraphQL for the first time) might send a request to the Router using a tool that isn't GraphQL-aware, or might just have their API tool of choice misconfigured.

Previously, the message stated "missing query string", but now more helpfully suggests sending either a POST or GET request and specifying the desired operation as the `query` parameter (i.e., either in the POST data or in the query string parameters for GET queries).

By [@kushal-93](https://github.com/kushal-93) in https://github.com/apollographql/router/pull/2955

### Traffic shaping configuration fix for global `experimental_enable_http2`

We've resolved a case where the `experimental_enable_http2` feature wouldn't properly apply when configured with a global configuration.

Huge thanks to [@westhechiang](https://github.com/westhechiang), [@leggomuhgreggo](https://github.com/leggomuhgreggo), [@vecchp](https://github.com/vecchp) and [@davidvasandani](https://github.com/davidvasandani) for discovering the issue and finding a reproducible testcase!

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

### Limit the memory usage of the `apollo` OpenTelemetry exporter ([PR #3006](https://github.com/apollographql/router/pull/3006))

We've added a new LRU cache in place of a `Vec` for sub-span data to avoid keeping all events for a span in memory, since we don't need it for our computations.

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

# [1.15.1] - 2023-04-18

## 🐛 Fixes
Expand Down
60 changes: 51 additions & 9 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,9 @@ dependencies = [

[[package]]
name = "apollo-router"
version = "1.15.1"
version = "1.16.0"
dependencies = [
"access-json",
"ansi_term",
"anyhow",
"apollo-compiler",
"apollo-parser 0.5.1",
Expand All @@ -287,6 +286,7 @@ dependencies = [
"axum",
"backtrace",
"base64 0.20.0",
"brotli",
"buildstructor 0.5.2",
"bytes",
"ci_info",
Expand Down Expand Up @@ -334,6 +334,7 @@ dependencies = [
"multer",
"multimap",
"notify",
"nu-ansi-term 0.47.0",
"once_cell",
"opentelemetry",
"opentelemetry-datadog",
Expand Down Expand Up @@ -401,11 +402,13 @@ dependencies = [
"wiremock",
"wsl",
"yaml-rust",
"zstd",
"zstd-safe",
]

[[package]]
name = "apollo-router-benchmarks"
version = "1.15.1"
version = "1.16.0"
dependencies = [
"apollo-parser 0.4.1",
"apollo-router",
Expand All @@ -421,7 +424,7 @@ dependencies = [

[[package]]
name = "apollo-router-scaffold"
version = "1.15.1"
version = "1.16.0"
dependencies = [
"anyhow",
"cargo-scaffold",
Expand Down Expand Up @@ -2528,9 +2531,9 @@ dependencies = [

[[package]]
name = "h2"
version = "0.3.16"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d"
checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21"
dependencies = [
"bytes",
"fnv",
Expand Down Expand Up @@ -3536,6 +3539,15 @@ dependencies = [
"winapi 0.3.9",
]

[[package]]
name = "nu-ansi-term"
version = "0.47.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1df031e117bca634c262e9bd3173776844b6c17a90b3741c9163663b4385af76"
dependencies = [
"windows-sys 0.45.0",
]

[[package]]
name = "num"
version = "0.4.0"
Expand Down Expand Up @@ -4828,9 +4840,9 @@ dependencies = [

[[package]]
name = "router-bridge"
version = "0.2.1+v2.4.1"
version = "0.2.2+v2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4acbfd187f72fd4ac00ae1e050b011b87641135f7ef222fe462ee78964c037d4"
checksum = "a3b7f46d4ce5a83664e398eebe73d5501f38523f2b96fa0ef2e0cecb8474856e"
dependencies = [
"anyhow",
"async-channel",
Expand Down Expand Up @@ -6276,7 +6288,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70"
dependencies = [
"matchers",
"nu-ansi-term",
"nu-ansi-term 0.46.0",
"once_cell",
"regex",
"serde",
Expand Down Expand Up @@ -7064,3 +7076,33 @@ dependencies = [
"quote",
"syn 2.0.13",
]

[[package]]
name = "zstd"
version = "0.12.3+zstd.1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76eea132fb024e0e13fd9c2f5d5d595d8a967aa72382ac2f9d39fcc95afd0806"
dependencies = [
"zstd-safe",
]

[[package]]
name = "zstd-safe"
version = "6.0.5+zstd.1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d56d9e60b4b1758206c238a10165fbcae3ca37b01744e394c463463f6529d23b"
dependencies = [
"libc",
"zstd-sys",
]

[[package]]
name = "zstd-sys"
version = "2.0.8+zstd.1.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c"
dependencies = [
"cc",
"libc",
"pkg-config",
]
2 changes: 1 addition & 1 deletion apollo-router-benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "apollo-router-benchmarks"
version = "1.15.1"
version = "1.16.0"
authors = ["Apollo Graph, Inc. <packages@apollographql.com>"]
edition = "2021"
license = "Elastic-2.0"
Expand Down
2 changes: 1 addition & 1 deletion apollo-router-scaffold/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "apollo-router-scaffold"
version = "1.15.1"
version = "1.16.0"
authors = ["Apollo Graph, Inc. <packages@apollographql.com>"]
edition = "2021"
license = "Elastic-2.0"
Expand Down
2 changes: 1 addition & 1 deletion apollo-router-scaffold/templates/base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "1.15.1"
apollo-router = "1.16.0"
{{/if}}
{{/if}}
async-trait = "0.1.52"
Expand Down
2 changes: 1 addition & 1 deletion apollo-router-scaffold/templates/base/xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "v1.15.1" }
apollo-router-scaffold = { git = "https://github.com/apollographql/router.git", tag = "v1.16.0" }
{{/if}}
{{/if}}
anyhow = "1.0.58"
Expand Down
Loading