-
Notifications
You must be signed in to change notification settings - Fork 13
feat: Introduce logging context to Tangle #66
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
base: master
Are you sure you want to change the base?
Conversation
45fca00 to
c08c8f2
Compare
| # Process the request | ||
| response = await call_next(request) | ||
| # Add trace_id to response headers for client reference | ||
| response.headers["x-tangle-trace-id"] = trace_id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self. This line should probably go above await call_next(request) in case an exception is raised
| # Restore trace_id from execution | ||
| trace_id = None | ||
| if queued_execution.extra_data: | ||
| trace_id = queued_execution.extra_data.get("trace_id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think the request trace IDs are relevant when processing execution nodes. Execution nodes already have their own IDs and they might work better as trace IDs.
|
Thank you for this PR. I'm reviewing the changes and I think we might want to design this slightly differently. On the other hand, API requests might benefit from trace IDs so that all logging messages that are generated when processing a single API call can be filtered and grouped together. |
This sounds good to me. I will make some adjustments. Thanks! |
c08c8f2 to
e824f64
Compare
e824f64 to
65b8ed9
Compare
**Changes:**
* Adds logging context helpers
* Add request middleware to generate unique request id and set it in the logging context around API requests
* Sets the x-tangle-request-id on the response for client consumption
65b8ed9 to
987c061
Compare
Issue
#67
Changes:
extrasparameterextrasparameter, or creating a new one if None)Test pipeline notes:
ytest,starlette,httpx(e.g.pip3 install ...)