-
Notifications
You must be signed in to change notification settings - Fork 280
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
linking requests and responses #1536
Comments
Maybe we should just use |
We should. It's (of course) slightly more complicated than that. I spoke about this with @BrynCooke and we concluded that the best thing to do would be to add a new function:
which would mask all the complexity of crate/traits required to retrieve this value. |
Retrieve a unique trace id which can be used to link together processing steps in a plugin (or anywhere else in the router). If an execution trace context cannot be established, the return value will be INVALID_TRACE (all zeros). Watch out for this. Two invalid traces will be equal to each other. In other words, to correctly confirm that two things are linked you would have to check: let other_id = apollo_router::trace_id(); let my_id = apollo_router::trace_id(); if my_id != INVALID_TRACE && my_id == other_id { <blah...> } Without that first check, i.e.: if my_id == other_id { <blah...> } you could be linking together two unrelated things which both had invalid ids. fixes: #1536
This became:
I've tried to hide as much complexity as I can. |
(prompted by the work on #1501)
If we're writing a plugin with rhai, or a native one using the
map_request
andmap_response
methods, we have no way to know which request corresponds to which response, except by explicitely setting some information in theContext
object.Could we add an id to a request when it comes in and make it available throughout the entire lifecycle? (possibly in telemetry too?)
ULIDs or the still in draft UUID v6 would work well for that
The text was updated successfully, but these errors were encountered: