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

Telemetry enhancements #850

Merged
merged 22 commits into from
Apr 22, 2022
Merged

Conversation

BrynCooke
Copy link
Contributor

@BrynCooke BrynCooke commented Apr 13, 2022

🚀 Features

Configurable client identification headers PR #850

The router uses the HTTP headers apollographql-client-name and apollographql-client-version to identify clients in Studio telemetry. Thos headers can now be overriden in the configuration:

telemetry:
  apollo:
    # Header identifying the client name. defaults to apollographql-client-name
    client_name_header: <custom_client_header_name>
    # Header identifying the client version. defaults to apollographql-client-version
    client_version_header: <custom_version_header_name>

🐛 Fixes

Configuration errors on hot-reload are output PR #850

If a configuration file had errors on reload these were silently swallowed. These are now added to the logs.

🛠 Maintenance

End to end integration tests for Jaeger PR #850

Jaeger tracing end to end test including client->router->subgraphs

Router tracing span cleanup PR #850

Spans generated by the Router are now aligned with plugin services.

Review Notes

  • A new layer has been introduced for instrumentation. It takes a function that returns a span from a request. It is modeled on the tower http instrument layer.
  • The Jaeger end to end integration test requires Jaeger to be downloaded to a particular location. Not ideal.
  • Some spans have been migrated directly to the telemetry plugin. This gives us a more consistent view of how long each service takes.

@netlify
Copy link

netlify bot commented Apr 13, 2022

Deploy Preview for apollo-router-docs canceled.

Name Link
🔨 Latest commit 4b15150
🔍 Latest deploy log https://app.netlify.com/sites/apollo-router-docs/deploys/6262df799cad5b000849d9fd

NEXT_CHANGELOG.md Outdated Show resolved Hide resolved
@BrynCooke BrynCooke linked an issue Apr 14, 2022 that may be closed by this pull request
@BrynCooke BrynCooke self-assigned this Apr 14, 2022
@BrynCooke BrynCooke force-pushed the bryn/configurable-client-identification2 branch 8 times, most recently from c2567dc to 36015f6 Compare April 18, 2022 20:41
@BrynCooke BrynCooke force-pushed the bryn/configurable-client-identification2 branch 2 times, most recently from 0680b9b to 602506c Compare April 19, 2022 07:28
@BrynCooke BrynCooke marked this pull request as ready for review April 19, 2022 07:31
@BrynCooke BrynCooke requested review from Geal, o0Ignition0o, garypen and bnjjj and removed request for Geal April 19, 2022 08:36
@BrynCooke BrynCooke force-pushed the bryn/configurable-client-identification2 branch 6 times, most recently from 152db5b to fc0f735 Compare April 19, 2022 20:50
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.

Wow what a tremendous and super thorough PR 🎉
I ve added a bunch of comments and questions here and there but this looks good to me!

NEXT_CHANGELOG.md Outdated Show resolved Hide resolved
apollo-router/src/lib.rs Show resolved Hide resolved
apollo-router/src/plugins/telemetry/mod.rs Outdated Show resolved Hide resolved
apollo-router/src/plugins/telemetry/mod.rs Outdated Show resolved Hide resolved
xtask/src/commands/test.rs Outdated Show resolved Hide resolved
@BrynCooke BrynCooke force-pushed the bryn/configurable-client-identification2 branch from 2a472b5 to d802a11 Compare April 21, 2022 12:28
@BrynCooke BrynCooke changed the title Bryn/configurable client identification2 Telemetry enhancements Apr 21, 2022
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.

Mainly looks good and a nice set of cleanup. It seems like the code around the shutting down global tracing has changed since last time I looked at it and I'm not 100% sure it is correct. It will be worth going through that before merging this.

NEXT_CHANGELOG.md Outdated Show resolved Hide resolved
@@ -0,0 +1,73 @@
use futures::future::BoxFuture;
Copy link
Contributor

Choose a reason for hiding this comment

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

After the plugin utils etc stuff merges, you'll see the minimal style of documentation that is required. You can lift some of the documentation from that PR and use it to document the new components (such as this instrument layer/service) that you are adding.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added some minimal docs, I'm happy to revisit in a larger docs effort.

apollo-router-core/src/plugins/mod.rs Show resolved Hide resolved
apollo-router-core/src/query_cache.rs Outdated Show resolved Hide resolved
apollo-router/src/plugins/telemetry/mod.rs Outdated Show resolved Hide resolved
apollo-router/tests/common.rs Show resolved Hide resolved
bryn and others added 20 commits April 22, 2022 18:19
…module and metrics can go in the metrics module.
Move router_request span to telemetry plugin. There's no way to disable this plugin so it's OK.
Add logic for dynamic client name and client version header.
OSX had an issue with max UDP packet size
Windows has all sorts of file related issues. On the plus side the special handling for windows in circle has been removed as the root cause of the hang on windows is now known to be: rust-lang/rust#45572
…y going to get more complicated aw we add more integration tests. Docker compose is the way to go.
Co-authored-by: Gary Pennington <gary@apollographql.com>
Moved instrumentation info span to actual query parsing. It makes no sense to have a span on a cache as the cache hit will mean no time elapsed.  Users can now see a span when query parsing happens or no span if parsing did not take place.
@BrynCooke BrynCooke force-pushed the bryn/configurable-client-identification2 branch from 1bc9989 to bf40b73 Compare April 22, 2022 16:39
@BrynCooke BrynCooke requested a review from garypen April 22, 2022 16:40
@BrynCooke BrynCooke merged commit 9a62ca1 into main Apr 22, 2022
@BrynCooke BrynCooke deleted the bryn/configurable-client-identification2 branch April 22, 2022 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

client identity: allow configuring default header names
4 participants