Skip to content

Commit

Permalink
release: v1.43.0
Browse files Browse the repository at this point in the history
  • Loading branch information
abernix authored Mar 22, 2024
2 parents 0f10eb4 + ded84be commit 4b84858
Show file tree
Hide file tree
Showing 83 changed files with 1,699 additions and 464 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ executors:
- image: cimg/base:stable
- image: cimg/redis:7.2.4
- image: jaegertracing/all-in-one:1.54.0
- image: openzipkin/zipkin:2.23.2
resource_class: xlarge
environment:
CARGO_BUILD_JOBS: 4
Expand Down
94 changes: 89 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,91 @@ 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.43.0] - 2024-03-21

## 🚀 Features

### Support configurable heartbeat for subscriptions using the WebSocket protocol ([Issue #4621](https://github.com/apollographql/router/issues/4621))

To support GraphQL Subscription WebSocket implementations such as [DGS](https://netflix.github.io/dgs/) that drop idle connections by design, the router adds the ability to configure a heartbeat to keep active connections alive.

An example router configuration:

```yaml
subscription:
mode:
passthrough:
all:
path: /graphql
heartbeat_interval: enable # Optional
```

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

### Unix socket support for subgraphs ([Issue #3504](https://github.com/apollographql/router/issues/3504))

> ⚠️ This is an [Enterprise feature](https://www.apollographql.com/blog/platform/evaluating-apollo-router-understanding-free-and-open-vs-commercial-features/) of the Apollo Router. It requires an organization with a [GraphOS Enterprise plan](https://www.apollographql.com/pricing/).
>
> If your organization doesn't currently have an Enterprise plan, you can test out this functionality by signing up for a free Enterprise trial.

The router now supports Unix sockets for subgraph connections by specifying URLs in the `unix:///path/to/router.sock` format in the schema, in addition to coming a valid URL option within [the existing `override_subgraph_url` configuration](https://www.apollographql.com/docs/router/configuration/overview/#subgraph-routing-urls). The router uses Unix stream-oriented sockets (not datagram-oriented). It supports compression but not TLS.

Due to the lack of standardization of Unix socket URLs (and lack of support in the common URL types in Rust) a transformation is applied to to the socket path to parse it: the host is encoded in hexadecimal and stored in the `authority` part. This will have no consequence on the way the router functions, but [subgraph services](https://www.apollographql.com/docs/router/customizations/overview/#the-request-lifecycle) will receive URLs with the hex-encoded host.

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

### Add an option to refresh expiration on Redis GET ([Issue #4473](https://github.com/apollographql/router/issues/4473))

This adds the option to refresh the time-to-live (TTL) on Redis entries when they are accessed. We want the query plan cache to act like an LRU cache (least-recently used), so if a TTL is set in its Redis configuration, it should reset every time it is accessed.

While the option is also available for APQ, it's disabled for entity caching because that cache manages TTL directly.

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

### Helm: Support configuring `ContainerResource` on Horizontal Pod Autoscaler (HPA) targets ([PR #4776](https://github.com/apollographql/router/pull/4776))

The router supports configuration of the [`ContainerResource` type metric](https://kubernetes.io/blog/2023/05/02/hpa-container-resource-metric/) on Horizontal Pod Autoscaler (HPA) targets in the Helm chart with Kubernetes v1.27 or later.

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

## 🐛 Fixes

### Fix chunk formatting in multipart protocol ([Issue #4634](https://github.com/apollographql/router/issues/4634))

Previously, when sending a stream of chunks for HTTP multipart, the router finished each chunk by appending it with `\r\n`.
Now, the router doesn't append `\r\n` to the current chunk but instead prepends it to the next chunk. This enables the router to close a stream with the correct final boundary by appending `--\r\n` directly to the last chunk.

This PR changes the way we're sending chunks in the stream. Instead of finishing the chunk with `\r\n` we don't send this at the end of our current chunk but instead at the beginning of the next one. For the end users nothing changes but it let us to close the stream with the right final boundary by appending `--\r\n` directly to the last chunk.

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

### Zipkin service name not populated ([Issue #4807](https://github.com/apollographql/router/issues/4807))

The Zipkin trace exporter now respects service name configuration from YAML or environment variables.

For instance to set the service name to `my-app`, you can use the following configuration in your `router.yaml` file:

```yaml
telemetry:
exporters:
tracing:
common:
service_name: my-app
zipkin:
enabled: true
endpoint: default
```

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

## 🛠 Maintenance

### Preallocate response formatting output ([PR #4775](https://github.com/apollographql/router/pull/4775))

To improve runtime performance, an internal change to the router's `format_response` now preallocates the output object.

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

# [1.42.0] - 2024-03-12

## 🚀 Features
Expand Down Expand Up @@ -42,7 +127,6 @@ telemetry:
dd.trace_id: true
```


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

# [1.41.1] - 2024-03-08
Expand Down Expand Up @@ -173,7 +257,7 @@ By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/p

The `subgraph_response_body` [selector](https://www.apollographql.com/docs/router/configuration/telemetry/instrumentation/selectors/) has been deprecated and replaced with selectors for a response body's constituent elements: `subgraph_response_data` and `subgraph_response_errors`.

When configuring `subgraph_response_data` and `subgraph_response_errors`, both use a JSONPath expression to fetch data or errors from a subgraph response.
When configuring `subgraph_response_data` and `subgraph_response_errors`, both use a JSONPath expression to fetch data or errors from a subgraph response.

An example configuration:

Expand All @@ -192,7 +276,7 @@ By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router

### Add a `.remove` method for headers in Rhai

The router supports a new `.remove` method that enables users to remove headers in a Rhai script.
The router supports a new `.remove` method that enables users to remove headers in a Rhai script.

For example:

Expand Down Expand Up @@ -348,9 +432,9 @@ By [@nicholascioli](https://github.com/nicholascioli) in https://github.com/apol

### Add selector to get all baggage key values in span attributes ([Issue #4425](https://github.com/apollographql/router/issues/4425))

Previously, baggage items were configured as standard attributes in `router.yaml`, and adding a new baggage item required a configuration update and router rerelease.
Previously, baggage items were configured as standard attributes in `router.yaml`, and adding a new baggage item required a configuration update and router rerelease.

This release supports a new configuration that enables baggage items to be added automatically as span attributes.
This release supports a new configuration that enables baggage items to be added automatically as span attributes.

If you have several baggage items and would like to add all of them directly as span attributes (for example, `baggage: my_item=test, my_second_item=bar`), setting `baggage: true` will add automatically add two span attributes, `my_item=test` and `my_second_item=bar`.

Expand Down
34 changes: 27 additions & 7 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ dependencies = [

[[package]]
name = "apollo-federation"
version = "0.0.6"
version = "0.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8e029d74a3c5f5b5ceeb0450aa95df15b49bb71e962e7c22872afd6f5b5e631"
checksum = "c810d52e0d9ac684ac2b0583df9479a4efbe3035b466b4c374eeaa388f4a1e93"
dependencies = [
"apollo-compiler",
"derive_more",
Expand All @@ -232,7 +232,7 @@ dependencies = [
"petgraph",
"salsa",
"serde_json",
"strum",
"strum 0.26.1",
"strum_macros 0.26.1",
"thiserror",
"url",
Expand All @@ -251,7 +251,7 @@ dependencies = [

[[package]]
name = "apollo-router"
version = "1.42.0"
version = "1.43.0"
dependencies = [
"access-json",
"anyhow",
Expand Down Expand Up @@ -302,6 +302,7 @@ dependencies = [
"humantime-serde",
"hyper",
"hyper-rustls",
"hyperlocal",
"indexmap 2.2.3",
"insta",
"itertools 0.12.1",
Expand Down Expand Up @@ -409,7 +410,7 @@ dependencies = [

[[package]]
name = "apollo-router-benchmarks"
version = "1.42.0"
version = "1.43.0"
dependencies = [
"apollo-parser",
"apollo-router",
Expand All @@ -425,7 +426,7 @@ dependencies = [

[[package]]
name = "apollo-router-scaffold"
version = "1.42.0"
version = "1.43.0"
dependencies = [
"anyhow",
"cargo-scaffold",
Expand Down Expand Up @@ -2100,7 +2101,7 @@ dependencies = [
"proc-macro2 1.0.76",
"quote 1.0.35",
"regex",
"strum",
"strum 0.25.0",
"strum_macros 0.25.3",
"syn 1.0.109",
"syn 2.0.48",
Expand Down Expand Up @@ -3450,6 +3451,19 @@ dependencies = [
"tokio-io-timeout",
]

[[package]]
name = "hyperlocal"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fafdf7b2b2de7c9784f76e02c0935e65a8117ec3b768644379983ab333ac98c"
dependencies = [
"futures-util",
"hex",
"hyper",
"pin-project",
"tokio",
]

[[package]]
name = "idna"
version = "0.4.0"
Expand Down Expand Up @@ -6456,6 +6470,12 @@ dependencies = [
"strum_macros 0.25.3",
]

[[package]]
name = "strum"
version = "0.26.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "723b93e8addf9aa965ebe2d11da6d7540fa2283fcea14b3371ff055f7ba13f5f"

[[package]]
name = "strum_macros"
version = "0.25.3"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ Options:

[Apollo](https://apollographql.com/) is building software and a graph platform to unify GraphQL across your apps and services. We help you ship faster with:

* [Apollo Studio](https://www.apollographql.com/studio/develop/) – A free, end-to-end platform for managing your GraphQL lifecycle. Track your GraphQL schemas in a hosted registry to create a source of truth for everything in your graph. Studio provides an IDE (Apollo Explorer) so you can explore data, collaborate on queries, observe usage, and safely make schema changes.
* [Apollo Federation](https://www.apollographql.com/apollo-federation) – The industry-standard open architecture for building a distributed graph. Compose and manage your graphs using [Rover](https://www.apollographql.com/rover/) and then use Apollo Router to query plan and route requests across multiple subgraphs.
* [Apollo Client](https://www.apollographql.com/apollo-client/) – The most popular GraphQL client for the web. Apollo also builds and maintains [Apollo iOS](https://github.com/apollographql/apollo-ios) and [Apollo Android](https://github.com/apollographql/apollo-android).
* [Apollo Studio](https://www.apollographql.com/graphos) – A free, end-to-end platform for managing your GraphQL lifecycle. Track your GraphQL schemas in a hosted registry to create a source of truth for everything in your graph. Studio provides an IDE (Apollo Explorer) so you can explore data, collaborate on queries, observe usage, and safely make schema changes.
* [Apollo Federation](https://www.apollographql.com/docs/federation/) – The industry-standard open architecture for building a distributed graph. Compose and manage your graphs using [Rover](https://www.apollographql.com/docs/rover) and then use Apollo Router to query plan and route requests across multiple subgraphs.
* [Apollo Client](https://www.apollographql.com/docs/react/) – The most popular GraphQL client for the web. Apollo also builds and maintains [Apollo iOS](https://github.com/apollographql/apollo-ios) and [Apollo Android](https://github.com/apollographql/apollo-android).
* [Apollo Server](https://www.apollographql.com/docs/apollo-server/) – A production-ready JavaScript GraphQL server that connects to any microservice, API, or database. Compatible with all popular JavaScript frameworks and deployable in serverless environments.

## Learn how to build with Apollo
Expand Down
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.42.0"
version = "1.43.0"
authors = ["Apollo Graph, Inc. <[email protected]>"]
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.42.0"
version = "1.43.0"
authors = ["Apollo Graph, Inc. <[email protected]>"]
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.42.0"
apollo-router = "1.43.0"
{{/if}}
{{/if}}
async-trait = "0.1.52"
Expand Down
2 changes: 1 addition & 1 deletion apollo-router-scaffold/templates/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Use the rust build image from docker as our base
# renovate-automation: rustc version
FROM rust:1.74.0 as build
FROM rust:1.76.0 as build

# Set our working directory for the build
WORKDIR /usr/src/router
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.42.0" }
apollo-router-scaffold = { git = "https://github.com/apollographql/router.git", tag = "v1.43.0" }
{{/if}}
{{/if}}
anyhow = "1.0.58"
Expand Down
7 changes: 5 additions & 2 deletions apollo-router/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "apollo-router"
version = "1.42.0"
version = "1.43.0"
authors = ["Apollo Graph, Inc. <[email protected]>"]
repository = "https://github.com/apollographql/router/"
documentation = "https://docs.rs/apollo-router"
Expand Down Expand Up @@ -65,7 +65,7 @@ askama = "0.12.1"
access-json = "0.1.0"
anyhow = "1.0.80"
apollo-compiler = "=1.0.0-beta.13"
apollo-federation = "=0.0.6"
apollo-federation = "=0.0.8"
arc-swap = "1.6.0"
async-compression = { version = "0.4.6", features = [
"tokio",
Expand Down Expand Up @@ -272,6 +272,7 @@ uname = "0.1.1"

[target.'cfg(unix)'.dependencies]
uname = "0.1.1"
hyperlocal = { version = "0.8.0", default-features = false, features = ["client"] }

[target.'cfg(target_os = "linux")'.dependencies]
tikv-jemallocator = "0.5"
Expand Down Expand Up @@ -329,6 +330,8 @@ wiremock = "0.5.22"
[target.'cfg(target_os = "linux")'.dev-dependencies]
rstack = { version = "0.3.3", features = ["dw"], default-features = false }

[target.'cfg(unix)'.dev-dependencies]
hyperlocal = { version = "0.8.0", default-features = false, features = ["client", "server"] }

[build-dependencies]
tonic-build = "0.9.2"
Expand Down
6 changes: 3 additions & 3 deletions apollo-router/src/axum_factory/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1683,19 +1683,19 @@ async fn deferred_response_shape() -> Result<(), ApolloRouterError> {
let first = response.chunk().await.unwrap().unwrap();
assert_eq!(
std::str::from_utf8(&first).unwrap(),
"\r\n--graphql\r\ncontent-type: application/json\r\n\r\n{\"data\":{\"test\":\"hello\"},\"hasNext\":true}\r\n--graphql\r\n"
"\r\n--graphql\r\ncontent-type: application/json\r\n\r\n{\"data\":{\"test\":\"hello\"},\"hasNext\":true}\r\n--graphql"
);

let second = response.chunk().await.unwrap().unwrap();
assert_eq!(
std::str::from_utf8(&second).unwrap(),
"content-type: application/json\r\n\r\n{\"hasNext\":true,\"incremental\":[{\"data\":{\"other\":\"world\"},\"path\":[]}]}\r\n--graphql\r\n"
"\r\ncontent-type: application/json\r\n\r\n{\"hasNext\":true,\"incremental\":[{\"data\":{\"other\":\"world\"},\"path\":[]}]}\r\n--graphql"
);

let third = response.chunk().await.unwrap().unwrap();
assert_eq!(
std::str::from_utf8(&third).unwrap(),
"content-type: application/json\r\n\r\n{\"hasNext\":false}\r\n--graphql--\r\n"
"\r\ncontent-type: application/json\r\n\r\n{\"hasNext\":false}\r\n--graphql--\r\n"
);

server.shutdown().await
Expand Down
3 changes: 2 additions & 1 deletion apollo-router/src/axum_factory/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use tracing::Span;

use crate::plugins::telemetry::SpanMode;
use crate::plugins::telemetry::OTEL_STATUS_CODE;
use crate::plugins::telemetry::OTEL_STATUS_CODE_ERROR;
use crate::uplink::license_enforcement::LicenseState;
use crate::uplink::license_enforcement::LICENSE_EXPIRED_SHORT_MESSAGE;

Expand Down Expand Up @@ -55,7 +56,7 @@ impl<B> MakeSpan<B> for PropagatingMakeSpan {
self.license,
LicenseState::LicensedWarn | LicenseState::LicensedHalt
) {
span.record(OTEL_STATUS_CODE, "Error");
span.record(OTEL_STATUS_CODE, OTEL_STATUS_CODE_ERROR);
span.record("apollo_router.license", LICENSE_EXPIRED_SHORT_MESSAGE);
}

Expand Down
Loading

0 comments on commit 4b84858

Please sign in to comment.