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 1.5.0 #2208

Merged
merged 47 commits into from
Dec 6, 2022
Merged

Release 1.5.0 #2208

merged 47 commits into from
Dec 6, 2022

Conversation

BrynCooke
Copy link
Contributor

@BrynCooke BrynCooke commented Dec 5, 2022

[1.5.0] - 2022-12-05

❗ BREAKING ❗

Router debug Docker images now run under the control of heaptrack (Issue #2135)

From 1.5.0, our debug Docker image will invoke the router under the control of heaptrack. We are making this change to make it simple for users to investigate potential memory issues with the Router.

Do not run debug images in performance sensitive contexts. The tracking of memory allocations will significantly impact performance. In general, the debug image should only be used in consultation with Apollo engineering and support.

Look at our documentation for examples of how to use the image in either Docker or Kubernetes.

By @garypen in #2142

Fix naming inconsistency of telemetry.metrics.common.attributes.router (Issue #2076)

Mirroring the rest of the config router should be supergraph

telemetry:
  metrics:
    common:
      attributes:
        router: # old

becomes

telemetry:
  metrics:
    common:
      attributes:
        supergraph: # new

By @bryncooke in #2116

CLI structure changes (Issue #2123)

There is now a separate subcommand for config related operations:

  • config
    • schema - Output the configuration schema
    • upgrade - Upgrade the configuration with optional diff support.

router --schema has been deprecated and users should move to router config schema.

By @bryncooke in #2116

🚀 Features

Add configuration for trace ID (Issue #2080)

Trace ids can be propagated directly from a request header:

telemetry:
  tracing:
    propagation:
      # If you have your own way to generate a trace id and you want to pass it via a custom request header
      request:
        header_name: my-trace-id

In addition, trace id can be exposed via a response header:

telemetry:
  tracing:
    experimental_response_trace_id:
      enabled: true # default: false
      header_name: "my-trace-id" # default: "apollo-trace-id"

Using this configuration you will have a response header called my-trace-id containing the trace ID. It could help you to debug a specific query if you want to grep your log with this trace id to have more context.

By @bnjjj in #2131

Add configuration for logging and add more logs (Issue #1998)

By default, logs containing do not contain request body, response body, headers.
It is now possible to conditionally add this information for debugging and audit purposes.
Here is an example how you can configure it:

telemetry:
  experimental_logging:
    format: json # By default it's "pretty" if you are in an interactive shell session
    display_filename: true # Display filename where the log is coming from. Default: true
    display_line_number: false # Display line number in the file where the log is coming from. Default: true
    # If one of these headers matches we will log supergraph and subgraphs requests/responses
    when_header:
      - name: apollo-router-log-request
        value: my_client
        headers: true # default: false
        body: true # default: false
      # log request for all requests/responses headers coming from Iphones
      - name: user-agent
        match: ^Mozilla/5.0 (iPhone*
        headers: true

By @bnjjj in #2040

Provide multi-arch (amd64/arm64) Docker images for the Router (Issue #1932)

From 1.5.0 our Docker images will be multi-arch.

By @garypen in #2138

Add a supergraph configmap option to the helm chart (PR #2119)

Adds the capability to create a configmap containing your supergraph schema. Here's an example of how you could make use of this from your values.yaml and with the helm install command.

extraEnvVars:
  - name: APOLLO_ROUTER_SUPERGRAPH_PATH
    value: /data/supergraph-schema.graphql

extraVolumeMounts:
  - name: supergraph-schema
    mountPath: /data
    readOnly: true

extraVolumes:
  - name: supergraph-schema
    configMap:
      name: "{{ .Release.Name }}-supergraph"
      items:
        - key: supergraph-schema.graphql
          path: supergraph-schema.graphql

With that values.yaml content, and with your supergraph schema in a file name supergraph-schema.graphql, you can execute:

helm upgrade --install --create-namespace --namespace router-test --set-file supergraphFile=supergraph-schema.graphql router-test oci://ghcr.io/apollographql/helm-charts/router --version 1.0.0-rc.9 --values values.yaml

By @garypen in #2119

Configuration upgrades (Issue #2123)

Occasionally we will make changes to the Router yaml configuration format.
When starting the Router if the configuration can be upgraded it will do so automatically and display a warning:

2022-11-22T14:01:46.884897Z  WARN router configuration contains deprecated options: 

  1. telemetry.tracing.trace_config.attributes.router has been renamed to 'supergraph' for consistency

These will become errors in the future. Run `router config upgrade <path_to_router.yaml>` to see a suggested upgraded configuration.

Note: If a configuration has errors after upgrading then the configuration will not be upgraded automatically.

From the CLI users can run:

  • router config upgrade <path_to_router.yaml> to output configuration that has been upgraded to match the latest config format.
  • router config upgrade --diff <path_to_router.yaml> to output a diff e.g.
 telemetry:
   apollo:
     client_name_header: apollographql-client-name
   metrics:
     common:
       attributes:
-        router:
+        supergraph:
           request:
             header:
             - named: "1" # foo

There are situations where comments and whitespace are not preserved.

By @bryncooke in #2116, #2162

Experimental 🥼 subgraph request retry (Issue #338, Issue #1956)

Implements subgraph request retries, using Finagle's retry buckets algorithm:

  • it defines a minimal number of retries per second (min_per_sec, default is 10 retries per second), to
    bootstrap the system or for low traffic deployments
  • for each successful request, we add a "token" to the bucket, those tokens expire after ttl (default: 10 seconds)
  • the number of available additional retries is a part of the number of tokens, defined by retry_percent (default is 0.2)

Request retries are disabled by default on mutations.

This is activated in the traffic_shaping plugin, either globally or per subgraph:

traffic_shaping:
  all:
    experimental_retry:
      min_per_sec: 10
      ttl: 10s
      retry_percent: 0.2
      retry_mutations: false
  subgraphs:
    accounts:
      experimental_retry:
        min_per_sec: 20

By @Geal in #2006 and #2160

Experimental 🥼 Caching configuration (Issue #2075)

Split Redis cache configuration for APQ and query planning:

supergraph:
  apq:
    experimental_cache:
      in_memory:
        limit: 512
      redis:
        urls: ["redis://..."]
  query_planning:
    experimental_cache:
      in_memory:
        limit: 512
      redis:
        urls: ["redis://..."]

By @Geal in #2155

@defer Apollo tracing support (Issue #1600)

Added Apollo tracing support for queries that use @defer. You can now view traces in Apollo Studio as normal.

By @bryncooke in #2190

🐛 Fixes

Fix panic when dev mode enabled with empty config file (Issue #2182)

If you're running the Router with dev mode with an empty config file, it will no longer panic

By @bnjjj in #2195

Fix missing apollo tracing variables (Issue #2186)

Send variable values had no effect. This is now fixed.

telemetry:
  apollo:
    send_variable_values: all

By @bryncooke in #2190

fix build_docker_image.sh script when using default repo (PR #2163)

Adding the -r flag recently broke the existing functionality to build from the default repo using -b. This fixes that.

By @garypen in #2163

Improve errors when subgraph returns non-GraphQL response with a non-2xx status code (Issue #2117)

The error response will now contain the status code and status name. Example: HTTP fetch failed from 'my-service': 401 Unauthorized

By @col in #2118

handle mutations containing @defer (Issue #2099)

The Router generates partial query shapes corresponding to the primary and deferred responses,
to validate the data sent back to the client. Those query shapes were invalid for mutations.

By @Geal in #2102

Experimental 🥼 APQ and query planner Redis caching fixes (PR #2176)

  • use a null byte as separator in Redis keys
  • handle Redis connection errors
  • mark APQ and query plan caching as license key functionality

By @Geal in #2176

🛠 Maintenance

Verify that deferred fragment acts as a boundary for nullability rules (Issue #2169)

Add a test to ensure that deferred fragments act as a boundary for nullability rules.

By @garypen in #2183

Refactor APQ (PR #2129)

Remove duplicated code.

By @Geal in #2129

Update apollo-rs (PR #2177)

Updates to new apollo-rs APIs, and fixes some potential panics on unexpected user input.

By @goto-bus-stop in #2177

Semi-automate the release (PR #2202)

Developers can now run:
cargo xtask release prepare minor

To raise a release PR.

By @bryncooke in #2202

Fix webpki license check (PR #2202)

Fixed webpki license check.
Add missing Google Chromimum license.
By @o0Ignition0o @bryncooke in #2202

📚 Documentation

Docs: Update cors match regex example (Issue #2151)

The docs CORS regex example now displays a working and safe way to allow HTTPS subdomains of api.example.com.

By @o0Ignition0o in #2152

update documentation to reflect new examples structure (Issue #2095)

Updated the examples directory structure. This fixes the documentation links to the examples. It also makes clear that rhai subgraph fields are read-only, since they are shared resources.

By @garypen in #2133

Docs: Add a disclaimer for users who set up health-checks and prometheus endpoints in a containers environment (Issue #2079)

The health check and the prometheus endpoint listen to 127.0.0.1 by default.
While this is a safe default, it prevents other pods from performing healthchecks and scraping prometheus data.
This behavior and customization is now documented in the health-checks and the prometheus sections.

By @o0Ignition0o in #2194

abernix and others added 30 commits November 15, 2022 15:02
This updates our dependency on our `apollo-parser` package which brings
a few improvements, including more defensive parsing of some operations.
See its CHANGELOG in [the `apollo-rs`
repository](https://github.com/apollographql/apollo-rs/blob/main/crates/apollo-parser/CHANGELOG.md#032---2022-11-15)
for more details on what's included in the v0.3.2 release.
Merges `main` back to `dev`, albeit a day late.
Here's an example of values.yaml that you could use to mount this to
your container:

```
extraEnvVars:
  - name: APOLLO_ROUTER_SUPERGRAPH_PATH
    value: /data/supergraph-schema.graphql

extraVolumeMounts:
  - name: supergraph-schema
    mountPath: /data
    readOnly: true

extraVolumes:
  - name: supergraph-schema
    configMap:
      name: "{{ .Release.Name }}-supergraph"
      items:
        - key: supergraph-schema.graphql
          path: supergraph-schema.graphql

```

Note: This takes advantage of the fact that we `tpl` template the
extraVolumes in the deployment template, so {{ .Release.Name }} will be
templated into the release name at install. You don't have to do this,
you could just hard-code it, but this is neater.

Here's an example command line:

```
helm upgrade --install --create-namespace --namespace router-test --set-file supergraphFile=supergraph-schema.graphql router-test oci://ghcr.io/apollographql/helm-charts/router --version 1.0.0-rc.9 --values values.yaml
```

NB: rc.9 doesn't exist, so the command is purely illustrative to show
how this works.
…2118)

This PR tries to address Issue #2117

Here's an example of how the Router would now respond when a subgraph
service returns a non-2xx status code and content-type not set to
`application/json`.
```
{
  "data": null,
  "errors": [
    {
      "message": "HTTP fetch failed from 'my-service': 401 Unauthorized",
      "path": [],
      "extensions": {
        "type": "SubrequestHttpError",
        "service": "my-service",
        "reason": "HTTP fetch failed from 'my-service': 401 Unauthorized"
      }
    }
  ]
}
```
fixes: #2095

Most of the example references are still valid, so I've only updated the
ones that raised 404s. I've also fixed a factual error about field
accessibility.
fixes: #1932
fixes: #2098 

The next time we release docker images, they will be multi-arch.

Co-authored-by: Jesse Rosenberger <[email protected]>
#2116)

### Fix naming inconsistency of
telemetry.metrics.common.attributes.router ([Issue
#2076](#2076))

Mirroring the rest of the config `router` should be `supergraph`

```yaml
telemetry:
  metrics:
    common:
      attributes:
        router: # old
```
becomes
```yaml
telemetry:
  metrics:
    common:
      attributes:
        supergraph: # new
```

### Configuration upgrades ([Issue
#2123](#2123))

Occasionally we will make changes to the Router yaml configuration
format.
When starting the Router if the configuration can be upgraded it will do
so automatically and display a warning:

```
2022-11-22T14:01:46.884897Z  WARN router configuration contains deprecated options: 

  1. telemetry.tracing.trace_config.attributes.router has been renamed to 'supergraph' for consistency

These will become errors in the future. Run `router config upgrade <path_to_router.yaml>` to see a suggested upgraded configuration.
```

Note: If a configuration has errors after upgrading then the
configuration will not be upgraded automatically.

From the CLI users can run:
* `router config upgrade <path_to_router.yaml>` to output configuration
that has been upgraded to match the latest config format.
* `router config upgrade --diff <path_to_router.yaml>` to output a diff
e.g.
```
 telemetry:
   apollo:
     client_name_header: apollographql-client-name
   metrics:
     common:
       attributes:
-        router:
+        supergraph:
           request:
             header:
             - named: "1" # foo
```

There are situations where comments and whitespace are not preserved.
This may be improved in future.

By [@BrynCooke](https://github.com/bryncooke) in
#2116


### CLI structure changes ([Issue
#2123](#2123))

As the Router gains functionality the limitations of the current CLI
structure are becoming apparent.

There is now a separate subcommand for config related operations:
* `config`
  * `schema` - Output the configuration schema
  * `upgrade` - Upgrade the configuration with optional diff support.

`router --schema` has been deprecated and users should move to `router
config schema`.


<!--
First, 🌠 thank you 🌠 for considering a contribution to Apollo!

Some of this information is also included in the /CONTRIBUTING.md file
at the
root of this repository.  We suggest you read it!

  https://github.com/apollographql/router/blob/HEAD/CONTRIBUTING.md

Here are some important details to keep in mind:

* ⏰ Your time is important
To save your precious time, if the contribution you are making will
take more than an hour, please make sure it has been discussed in an
        issue first. This is especially true for feature requests!

* 💡 Features
Feature requests can be created and discussed within a GitHub Issue.
Be sure to search for existing feature requests (and related issues!)
prior to opening a new request. If an existing issue covers the need,
please upvote that issue by using the 👍 emote, rather than opening a
        new issue.

* 🕷 Bug fixes
These can be created and discussed in this repository. When fixing a
bug,
please _try_ to add a test which verifies the fix. If you cannot, you
should
still submit the PR but we may still ask you (and help you!) to create a
test.

* 📖 Contribution guidelines
Follow https://github.com/apollographql/router/blob/HEAD/CONTRIBUTING.md
when submitting a pull request. Make sure existing tests still pass, and
add
        tests for all new behavior.

* ✏️ Explain your pull request
Describe the big picture of your changes here to communicate to what
        your pull request is meant to accomplish. Provide 🔗 links 🔗 to
associated issues! Documentation in the docs/ directory should be
updated
        as necessary.  Finally, a /CHANGELOG.md entry should be added.

We hope you will find this to be a positive experience! Contribution can
be
intimidating and we hope to alleviate that pain as much as possible.
Without
following these guidelines, you may be missing context that can help you
succeed
with your contribution, which is why we encourage discussion first.
Ultimately,
there is no guarantee that we will be able to merge your pull-request,
but by
following these guidelines we can try to avoid disappointment.

-->

Co-authored-by: bryn <[email protected]>
fixes #2151

The docs match regex example was wrong, it was missing ^ at the
beginning and $ at the end. `$` marks the end of a string, which could
be a safety issue.
fixes: #2135
fixes: #2145 

This PR repurposes the -debug image to make it the basis for a memory
tracking image which we can use for investigating router memory issues
via heaptrack. (https://github.com/KDE/heaptrack)

The PR is a *breaking* change because it now automatically starts the
router under the control of heaptrack. Technically, it's not really a
breaking change and it's certainly not an API change, but I really want
to draw people's attention to the fact that the debug image will now
execute a lot slower than the non-debug image and use a lot more memory
(to track memory with...).

I've updated the docker documentation to show how to mount a local
directory to store the heaptrack data. I haven't updated the kubernetes
docs, because we don't go into that level of detail and we assume that a
kubernetes devops person would know how to allocate and mount a PVC.
implements retries for subgraph requests. This uses Finagle's retry buckets algorithm
close #1998 

## Basic configuration

By default some logs containing sensible data (like request body,
response body, headers) are not displayed even if we set the right log
level.
For example if you need to display raw responses from one of your
subgraph it won't be displayed by default. To enable them you have to
configure it thanks to the `when_header` setting in the new section
`experimental_logging`. It let's you set different headers to enable
more logs (request/response headers/body for supergraph and subgraphs)
when the request contains these headers with corresponding values/regex.
Here is an example how you can configure it:

```yaml title="router.yaml"
telemetry:
  experimental_logging:
    format: json # By default it's "pretty" if you are in an interactive shell session
    display_filename: true # Display filename where the log is coming from. Default: true
    display_line_number: false # Display line number in the file where the log is coming from. Default: true
    # If one of these headers matches we will log supergraph and subgraphs requests/responses
    when_header:
      - name: apollo-router-log-request
        value: my_client
        headers: true # default: false
        body: true # default: false
      # log request for all requests coming from Iphones
      - name: user-agent
        match: ^Mozilla/5.0 (iPhone*
        headers: true
```

/!\ This PR also upgrade `tracing` (not to the latest version) because I
needed a fix.


Signed-off-by: Benjamin Coenen <[email protected]>
Fix #2099

to validate the primary part of a request with `@defer`, we reconstruct
a partial query by walking through the query plan. The code responsible
for that was not detecting mutations.

while the PR in the current state fixes the issue, I'd like to refactor
a bit so that we do not special case query and mutation (which will be
annoying if we add subscription at some point), and moving the query
reconstruction elsewhere, to work directly on the query instead of the
query plan
close #2080 

Configuration example:

```yaml
telemetry:
  tracing:
    experimental_response_trace_id:
      enabled: true # default: false
      header_name: "my-trace-id" # default: "apollo-trace-id"
    propagation:
      request: 
        header_name: "x-request-id"
      jaeger: true
```

Signed-off-by: Benjamin Coenen <[email protected]>
Co-authored-by: Geoffroy Couprie <[email protected]>
Issue was introduced with #2116 but no release had this in.

Move operations would insert data in the config due to the delete magic
value always getting added. Now we check before adding such values.

We may need to move to fluvio-jolt longer term.

<!--
First, 🌠 thank you 🌠 for considering a contribution to Apollo!

Some of this information is also included in the /CONTRIBUTING.md file
at the
root of this repository.  We suggest you read it!

  https://github.com/apollographql/router/blob/HEAD/CONTRIBUTING.md

Here are some important details to keep in mind:

* ⏰ Your time is important
To save your precious time, if the contribution you are making will
take more than an hour, please make sure it has been discussed in an
        issue first. This is especially true for feature requests!

* 💡 Features
Feature requests can be created and discussed within a GitHub Issue.
Be sure to search for existing feature requests (and related issues!)
prior to opening a new request. If an existing issue covers the need,
please upvote that issue by using the 👍 emote, rather than opening a
        new issue.

* 🕷 Bug fixes
These can be created and discussed in this repository. When fixing a
bug,
please _try_ to add a test which verifies the fix. If you cannot, you
should
still submit the PR but we may still ask you (and help you!) to create a
test.

* 📖 Contribution guidelines
Follow https://github.com/apollographql/router/blob/HEAD/CONTRIBUTING.md
when submitting a pull request. Make sure existing tests still pass, and
add
        tests for all new behavior.

* ✏️ Explain your pull request
Describe the big picture of your changes here to communicate to what
        your pull request is meant to accomplish. Provide 🔗 links 🔗 to
associated issues! Documentation in the docs/ directory should be
updated
        as necessary.  Finally, a /CHANGELOG.md entry should be added.

We hope you will find this to be a positive experience! Contribution can
be
intimidating and we hope to alleviate that pain as much as possible.
Without
following these guidelines, you may be missing context that can help you
succeed
with your contribution, which is why we encourage discussion first.
Ultimately,
there is no guarantee that we will be able to merge your pull-request,
but by
following these guidelines we can try to avoid disappointment.

-->

Co-authored-by: bryn <[email protected]>
The addition of the `-r` flag broke the existing logic for processing
the `-b` flag with non `-r` repos.

This fixes the logic and prints additional information about which repo
is being used to build the image.
renovate bot and others added 2 commits December 5, 2022 11:43
Automate the release:

```bash
cargo xtask release prepare --help                  
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `xtask/target/debug/xtask release prepare --help`
xtask-release-prepare 1.4.0
Prepare a new release

USAGE:
    xtask release prepare [FLAGS] [version]

FLAGS:
        --current-branch        Release from the current branch rather than creating a new one
        --dry-run               Dry run, don't commit the changes and create the PR
    -h, --help                  Prints help information
        --skip-license-ckeck    Skip the license check
    -V, --version               Prints version information

ARGS:
    <version>    The new version that is being created OR to bump (major|minor|patch|current)
 bryn@amsterdam  ~/git/router   bryn/automate-release  

```

You can create a new minor release by running.
```
cargo xtask release prepare minor
```

To review please check:

42dc28a
Has everything it needs.

As part of this xtask was removed from the root workspace.

Co-authored-by: bryn <[email protected]>
Co-authored-by: Coenen Benjamin <[email protected]>
Copy link
Contributor

@garypen garypen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chart.yaml needs to be manually revved to rc.9

@BrynCooke BrynCooke changed the base branch from main to dev December 5, 2022 17:58
@BrynCooke BrynCooke changed the base branch from dev to main December 5, 2022 19:04
@BrynCooke BrynCooke changed the base branch from main to dev December 5, 2022 19:06
@BrynCooke BrynCooke changed the base branch from dev to main December 5, 2022 21:04
@BrynCooke BrynCooke changed the base branch from main to dev December 5, 2022 21:04
Copy link
Contributor

@o0Ignition0o o0Ignition0o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have put the experimental section way down the list. the rest of the changelog lgtm.

I ll review the other files now.

CHANGELOG.md Outdated Show resolved Hide resolved
NEXT_CHANGELOG.md Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@BrynCooke BrynCooke changed the base branch from dev to main December 6, 2022 09:52
@BrynCooke BrynCooke changed the base branch from main to dev December 6, 2022 09:53
@BrynCooke BrynCooke changed the base branch from dev to main December 6, 2022 09:53
@BrynCooke BrynCooke merged commit ff9bfba into main Dec 6, 2022
@BrynCooke BrynCooke deleted the 1.5.0 branch December 6, 2022 09:53
@BrynCooke BrynCooke restored the 1.5.0 branch December 6, 2022 10:22
@abernix abernix deleted the 1.5.0 branch March 29, 2023 12:29
@abernix abernix added the release label Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants