Pass Custom Context to afterOperation
Hook
#13550
wp99cp
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I try to set up instrumentation through OpenTelemetry and want to wrap all calls to payload with a span. I imagine a setup as follows, where we construct a new span in the
beforeOperation
hook and end the span in theafterOperation
hook. If the request failed, we handle that within theafterError
hook.However, to achieve this, I would need to pass the span via context to the
afterOperation
hook, but this is not possible. Is there a reason why the custom context is not passed to theafterOperation
hook? Custom context is available in most of the other hooks and would be ideal for that use case.As an alternative, I could use the
req.context
; however, this leads to issues where a single request executes multiple payload operations, which is commonly the case for the admin panel.Example Usecase
Beta Was this translation helpful? Give feedback.
All reactions