Conversation
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.
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.
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
#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 <bryn@apollographql.com>
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 <5719034+bnjjj@users.noreply.github.com>
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
remove duplicated code
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 <5719034+bnjjj@users.noreply.github.com> Co-authored-by: Geoffroy Couprie <geoffroy@apollographql.com>
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 <bryn@apollographql.com>
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.
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 <bryn@apollographql.com>
Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
garypen
reviewed
Dec 5, 2022
Contributor
garypen
left a comment
There was a problem hiding this comment.
Chart.yaml needs to be manually revved to rc.9
garypen
approved these changes
Dec 5, 2022
bnjjj
approved these changes
Dec 6, 2022
o0Ignition0o
reviewed
Dec 6, 2022
Contributor
o0Ignition0o
left a comment
There was a problem hiding this comment.
I would have put the experimental section way down the list. the rest of the changelog lgtm.
I ll review the other files now.
o0Ignition0o
approved these changes
Dec 6, 2022
Geal
approved these changes
Dec 6, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[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
routershould besupergraphbecomes
By @bryncooke in #2116
CLI structure changes (Issue #2123)
There is now a separate subcommand for config related operations:
configschema- Output the configuration schemaupgrade- Upgrade the configuration with optional diff support.router --schemahas been deprecated and users should move torouter config schema.By @bryncooke in #2116
🚀 Features
Add configuration for trace ID (Issue #2080)
Trace ids can be propagated directly from a request header:
In addition, trace id can be exposed via a response header:
Using this configuration you will have a response header called
my-trace-idcontaining 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:
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
helminstall command.With that values.yaml content, and with your supergraph schema in a file name supergraph-schema.graphql, you can execute:
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:
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.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:
min_per_sec, default is 10 retries per second), tobootstrap the system or for low traffic deployments
ttl(default: 10 seconds)retry_percent(default is 0.2)Request retries are disabled by default on mutations.
This is activated in the
traffic_shapingplugin, either globally or per subgraph:By @Geal in #2006 and #2160
Experimental 🥼 Caching configuration (Issue #2075)
Split Redis cache configuration for APQ and query planning:
By @Geal in #2155
@deferApollo 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.
By @bryncooke in #2190
fix build_docker_image.sh script when using default repo (PR #2163)
Adding the
-rflag 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 UnauthorizedBy @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)
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 minorTo 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
HTTPSsubdomains ofapi.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