github apollographql/router v1.6.0

latest releases: v2.0.0-preview.1, v1.57.1, v1.57.1-rc.0...
23 months ago

[1.6.0] - 2022-12-13

❗ BREAKING ❗

Protoc now required to build (Issue #1970)

Protoc is now required to build Apollo Router. Upgrading to Open Telemetry 0.18 has enabled us to upgrade tonic which in turn no longer bundles protoc.
Users must install it themselves https://grpc.io/docs/protoc-installation/.

By @bryncooke in #1970

Jaeger scheduled_delay moved to batch_processor->scheduled_delay (Issue #2232)

Jager config previously allowed configuration of scheduled_delay for batch span processor. To bring it in line with all other exporters this is now set using a batch_processor section.

Before:

telemetry:
  tracing:
    jaeger:
      scheduled_delay: 100ms

After:

telemetry:
  tracing:
    jaeger:
      batch_processor:
        scheduled_delay: 100ms

By @bryncooke in #1970

🚀 Features

Add support for experimental tooling (Issue #2136)

Display a message at startup listing used experimental_ configurations with related GitHub discussions.
It also adds a new cli command router config experimental to display all available experimental configurations.

By @bnjjj in #2242

Re-deploy router pods if the SuperGraph configmap changes (PR #2223)

When setting the supergraph with the supergraphFile variable a sha256 checksum is calculated and set as an annotation for the router pods. This will spin up new pods when the supergraph is mounted via config map and the schema has changed.

Note: It is preferable to not have --hot-reload enabled with this feature since re-configuring the router during a pod restart is duplicating the work and may cause confusion in log messaging.

By @toneill818 in #2223

Tracing batch span processor is now configurable (Issue #2232)

Exporting traces often requires performance tuning based on the throughput of the router, sampling settings and ingestion capability of tracing ingress.

All exporters now support configuring the batch span processor in the router yaml.

telemetry:
  apollo:
    batch_processor:
      scheduled_delay: 100ms
      max_concurrent_exports: 1000
      max_export_batch_size: 10000
      max_export_timeout: 100s
      max_queue_size: 10000
  tracing:
    jaeger|zipkin|otlp|datadog:
      batch_processor:
        scheduled_delay: 100ms
        max_concurrent_exports: 1000
        max_export_batch_size: 10000
        max_export_timeout: 100s
        max_queue_size: 10000

See the Open Telemetry docs for more information.

By @bryncooke in #1970

Add hot-reload support for Rhai scripts (Issue #1071)

The router will "watch" your "rhai.scripts" directory for changes and prompt an interpreter re-load if changes are detected. Changes are defined as:

  • creating a new file with a ".rhai" suffix
  • modifying or removing an existing file with a ".rhai" suffix

The watch is recursive, so files in sub-directories of the "rhai.scripts" directory are also watched.

The Router attempts to identify errors in scripts before applying the changes. If errors are detected, these will be logged and the changes will not be applied to the runtime. Not all classes of error can be reliably detected, so check the log output of your router to make sure that changes have been applied.

By @garypen in #2198

Add support for working with multi-value header keys to Rhai (Issue #2211, Issue #2255)

Adds support for setting a header map key with an array. This causes the HeaderMap key/values to be appended() to the map, rather than inserted().

Adds support for a new values() fn which retrieves multiple values for a HeaderMap key as an array.

Example use from Rhai as:

  response.headers["set-cookie"] = [
    "foo=bar; Domain=localhost; Path=/; Expires=Wed, 04 Jan 2023 17:25:27 GMT; HttpOnly; Secure; SameSite=None",
    "foo2=bar2; Domain=localhost; Path=/; Expires=Wed, 04 Jan 2023 17:25:27 GMT; HttpOnly; Secure; SameSite=None",
  ];
  response.headers.values("set-cookie"); // Returns the array of values

By @garypen in #2219, #2258

🐛 Fixes

Filter nullified deferred responses (Issue #2213)

@defer spec updates mandates that a deferred response should not be sent if its path points to an element of the response that was nullified in a previous payload.

By @Geal in #2184

Return root __typename when parts of a query with deferred fragment (Issue #1677)

With this query:

{
  __typename
  fast
  ...deferedFragment @defer
}

fragment deferedFragment on Query {
  slow
}

You will receive the first response chunk:

{"data":{"__typename": "Query", "fast":0},"hasNext":true}

By @bnjjj in #2188

Wait for opentelemetry tracer provider to shutdown (PR #2191)

When we drop Telemetry we spawn a thread to perform the global opentelemetry trace provider shutdown. The documentation of this function indicates that "This will invoke the shutdown method on all span processors. span processors should export remaining spans before return". We should give that process some time to complete (5 seconds currently) before returning from the drop. This will provide more opportunity for spans to be exported.

By @garypen in #2191

Dispatch errors from the primary response to deferred responses (Issue #1818, Issue #2185)

When errors are generated during the primary execution, some may also be assigned to deferred responses.

By @Geal in #2192

Reconstruct deferred queries with knowledge about fragments (Issue #2105)

When we are using @defer, response formatting must apply on a subset of the query (primary or deferred), that is reconstructed from information provided by the query planner: a path into the response and a subselection. Previously, that path did not include information on fragment application, which resulted in query reconstruction issues if @defer was used under a fragment application on an interface.

By @Geal in #2109

🛠 Maintenance

Improve plugin registration predictability (PR #2181)

This replaces ctor with linkme. ctor enables rust code to execute before main. This can be a source of undefined behaviour and we don't need our code to execute before main. linkme provides a registration mechanism that is perfect for this use case, so switching to use it makes the router more predictable, simpler to reason about and with a sound basis for future plugin enhancements.

By @garypen in #2181

it_rate_limit_subgraph_requests fixed (Issue #2213)

This test was failing frequently due to it being a timing test being run in a single threaded tokio runtime.

By @bryncooke in #2218

Update reports.proto protobuf definition (PR #2247)

Update the reports.proto file, and change the prompt to update the file with the correct new location.

By @o0Ignition0o in #2247

Upgrade OpenTelemetry to 0.18 (Issue #1970)

Update to OpenTelemetry 0.18.

By @bryncooke and @bnjjj in #1970 and #2236

Remove spaceport (Issue #2233)

Removal significantly simplifies telemetry code and likely to increase performance and reliability.

By @bryncooke in #1970

Update to Rust 1.65 (Issue #2220)

Rust MSRV incremented to 1.65.

By @bryncooke in #2221 and #2240

Improve automated release (Pull #2220)

Improved the automated release to:

  • Update the scaffold files
  • Improve the names of prepare release steps in circle.

By @bryncooke in #2256

Use Elastic-2.0 license spdx (PR #2055)

Now that the Elastic-2.0 spdx is a valid identifier in the rust ecosystem, we can update the router references.

By @o0Ignition0o in #2054

📚 Documentation

Create yaml config design guidance (Issue #2158)

Added some yaml design guidance to help us create consistent yaml config for new and existing features.

By @bryncooke in #2159

Don't miss a new router release

NewReleases is sending notifications on new releases.