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

Access to the pre-calculated GraphOS query signature hash #2728

Closed
smyrick opened this issue Mar 8, 2023 · 4 comments · Fixed by #3586
Closed

Access to the pre-calculated GraphOS query signature hash #2728

smyrick opened this issue Mar 8, 2023 · 4 comments · Fixed by #3586

Comments

@smyrick
Copy link
Member

smyrick commented Mar 8, 2023

Is your feature request related to a problem? Please describe.
The query hash is used by Router for operation reporting and was previously available in the Gateway context. In the Router, the context no longer has this value and in Rhai scripts it is not on the request to add into the context manually. This requires manually hashing the req.body.query param which might actually be a different hash from the one used in operation reporting due to the deduping of operation signatures

Describe the solution you'd like
The GraphQL context in all locations has the query hash for the current operation which can then be consumed from either Rhai or coprocessors

Describe alternatives you've considered
We could just add it into the request processing in Rhai and have others add it to the context if they need it, but it is not available there either

Additional context
This info is available in the Gateway so this is a backwards compatibility issue

@abernix
Copy link
Member

abernix commented Mar 22, 2023

Are you referring to the straight SHA-256 of the exact operation, or the operation signature that we internally calculate via a normalization and hashing algorithm that's used for bucketing the operation into similar groups in Studio reporting?

Whichever it is, I'm curious what is trying to be accomplished with it?

@smyrick
Copy link
Member Author

smyrick commented Mar 22, 2023

The customer is asking for access to the same hash that they can see in Studio logging, so yes, the internal operation signature via normalization. They want to log this in the Router so they can trace errors in their system to the operations and logs they can view in studio

@smyrick
Copy link
Member Author

smyrick commented Mar 24, 2023

@grxy
Copy link

grxy commented Mar 28, 2023

We (Gusto) also would like access to the hash used in the URL for the operations details page. We are hoping to be able to link directly from our internal metrics and log indexing tools to the Studio page so that engineers can easily see usage data, client data and versions, and more. If y'all decide to release this either directly in the router or simply share an overview of how the algorithm works like the above, either would be appreciated!

@abernix abernix changed the title Access to the pre-calculated query hash Access to the pre-calculated GraphOS query signature hash May 10, 2023
o0Ignition0o added a commit that referenced this issue Aug 21, 2023
Fix #2728

This changeset exposes a new key in the context, `studio_operation_id`,
which identifies operation you can find in studio:

```
https://studio.apollographql.com/graph/<your_graph_variant>/variant/<your_graph_variant>/operations?query=<studio_operation_id>
```

This new context key is exposed at various stages of the operation
pipeline:

- Execution service request
- Subgraph service request

- Subgraph service response
- Execution service response
- Supergraph service response
- Router service response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants