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 the correlation context information to send operation ID in response #1154
Comments
@Apokalypt telemetry processors should have the request object and also correlation context available for you to consume, more info here. |
I'm not sure to understand how to proceed. We've already used these methods to filter some data, but I can't see how this would allow us to access the correlation ID in our error handler (using express) and return it in the API response. |
Well depends on when do you need the information, we should also be adding headers with correlation context information, have you tried reading the response headers? |
To be more explicit, here is a small code that show what we would like to do :
We try to take a look at response header but, as expected, there is nothing in it. I hope this code could help you to understand what we want to do. |
Context
My team and I are trying to improve the way we work with logs so that we can be more efficient when we encounter bugs in our APIs. To do this, we'd like to expose the operation ID and the ID of the parent operation in the body of the response we send.
Feature request
In order to do this, we need to be able to retrieve this information. We thought of a simple solution: expose the correlation context in the request object ( request.__context ) so that we can retrieve the operation ID / parent ID and expose it in the API response in the event of an error.
If it's already possible to do this, we'd love to hear about it. If not, do you think it would be feasible and interesting?
The text was updated successfully, but these errors were encountered: