github apollographql/router v1.43.0

latest releases: v1.47.0, v1.47.0-rc.0, v1.46.0...
2 months ago

🚀 Features

Support configurable heartbeat for subscriptions using the WebSocket protocol (Issue #4621)

To support GraphQL Subscription WebSocket implementations such as 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:

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

By @IvanGoncharov in #4802

Unix socket support for subgraphs (Issue #3504)

⚠️ This is an Enterprise feature of the Apollo Router. It requires an organization with a GraphOS Enterprise plan.

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. 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 will receive URLs with the hex-encoded host.

By @Geal in #4757

Add an option to refresh expiration on Redis GET (Issue #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 in #4604

Helm: Support configuring ContainerResource on Horizontal Pod Autoscaler (HPA) targets (PR #4776)

The router supports configuration of the ContainerResource type metric on Horizontal Pod Autoscaler (HPA) targets in the Helm chart with Kubernetes v1.27 or later.

By @caugustus in #4776

🐛 Fixes

Fix chunk formatting in multipart protocol (Issue #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 in #4681

Zipkin service name not populated (Issue #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:

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

By @BrynCooke in #4816

🛠 Maintenance

Preallocate response formatting output (PR #4775)

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

By @xuorig in #4775

Don't miss a new router release

NewReleases is sending notifications on new releases.