apollographql / router

A configurable, high-performance routing runtime for Apollo Federation 🚀
https://www.apollographql.com/docs/router/
Other
813 stars 271 forks source link

feat(telemetry): add support of router request_context selector and add schema id in context #6160

Closed bnjjj closed 1 month ago

bnjjj commented 1 month ago

Added a new selector request_context for the router service. Now the supergraph schema id is also available through the context so if you want to access or display this schema id at the router service level you can now configure it like this:

telemetry:
  instrumentation:
    events:
      router:
        my.request_event:
          message: "my request event message"
          level: info
          on: request
          attributes:
            schema.id:
              request_context: "apollo::supergraph_schema_id" # The key containing the supergraph schema id

It can be used in any services at any stages. This example is using selectors on event's attributes but it can also be done on spans and instruments.


Checklist

Complete the checklist (and note appropriate exceptions) before the PR is marked ready-for-review.

Exceptions

Note any exceptions here

Notes

[^1]: It may be appropriate to bring upcoming changes to the attention of other (impacted) groups. Please endeavour to do this before seeking PR approval. The mechanism for doing this will vary considerably, so use your judgement as to how and when to do this. [^2]: Configuration is an important part of many changes. Where applicable please try to document configuration examples. [^3]: Tick whichever testing boxes are applicable. If you are adding Manual Tests, please document the manual testing (extensively) in the Exceptions.

svc-apollo-docs commented 1 month ago

✅ Docs Preview Ready

No new or changed pages found.

github-actions[bot] commented 1 month ago

@bnjjj, please consider creating a changeset entry in /.changesets/. These instructions describe the process and tooling.

router-perf[bot] commented 1 month ago

CI performance tests