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

response_body is not valid under telemetry spans for custom attribute #4830

Closed
Samjin opened this issue Mar 20, 2024 · 10 comments
Closed

response_body is not valid under telemetry spans for custom attribute #4830

Samjin opened this issue Mar 20, 2024 · 10 comments

Comments

@Samjin
Copy link

Samjin commented Mar 20, 2024

https://www.apollographql.com/docs/router/configuration/telemetry/instrumentation/selectors/#supergraph
It says supergraph has selector of response_body, but the router config schema does not contain it. Add a custom attribute under supergraph would fail.

Expected behavior
Expect response_body selector to be valid under either supergraph or router.

Output

telemetry:
  instrumentation:
    spans:
      supergraph:
        attributes:
┌        "x-custom2":
|           response_body: "arg2"
└-----> {"response_body":"arg2"} is not valid under any of the schemas listed in the 'anyOf' keyword
@Samjin Samjin changed the title response_header is not valid under telemetry spans for custom attribute response_body is not valid under telemetry spans for custom attribute Mar 21, 2024
@Geal
Copy link
Contributor

Geal commented Mar 25, 2024

it looks like this is happening because response_body should be a JSON path. The error message is not clear enough, this is something we should fix

@Samjin
Copy link
Author

Samjin commented Mar 25, 2024

it looks like this is happening because response_body should be a JSON path. The error message is not clear enough, this is something we should fix

Are you saying arg2 should be a JSON path? I think I tried that and didn't work. The schema config definition(aka (configuration_schema.json) doesn't have response_body as valid property either.

@smyrick
Copy link
Member

smyrick commented Apr 2, 2024

Yep, adding here that under supergraph attributes in the YAML config, we only allow these response attributes (as seen from the generated configuration_schema.json from Router 1.43.1

  • response_header
  • response_context

Yet our docs indicate that we have support for response_body as well.

If we add support for response_body that would align with the docs and yes it should be a JSON selector but we might want to consider doing what we did for subgraph responses too and split that into

  • supergraph_response_data
  • supergraph_response_errors

@BrynCooke
Copy link
Contributor

Hmm, yes response_body does seem to be missing.

@BrynCooke
Copy link
Contributor

The main issue with implementing this is that the response when we get to the supergraph stage is a stream. To support this we will need to extend the Selector trait to add somethign along the lines of on_response_part. This would allow the selector handling to be injected into the stream of responses.

smyrick added a commit to smyrick/router that referenced this issue Apr 3, 2024
This attribute is not yet implemented, we are tracking the work to do that in apollographql#4830

However until we actually implement it we should remove from the docs
@smyrick
Copy link
Member

smyrick commented Apr 3, 2024

Removing from the docs here to reduce confusion until it is actually implemented: #4905

Geal pushed a commit that referenced this issue Apr 4, 2024
This attribute is not yet implemented, we are tracking the work to do
that in #4830

However until we actually implement it we should remove from the docs
@BrynCooke
Copy link
Contributor

@bnjjj Is this fixed by your latest PR?

@bnjjj
Copy link
Contributor

bnjjj commented Apr 29, 2024

Yes it's part of this PR but it will be response_errors and response_data instead.

@abernix
Copy link
Member

abernix commented May 17, 2024

@bnjjj Should this have been marked as one of the "Fixes" in #5022? (In other words, can it be closed?)

@bnjjj
Copy link
Contributor

bnjjj commented May 17, 2024

Yes!

@bnjjj bnjjj closed this as completed May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants