Feature request - add generic request context object
See original GitHub issueHello,
Thank you for the wonderful library. It’s helped a bunch in terms of zeroing in on relevant log messages for a single request.
I have a feature request and was wondering what your thoughts might be around opening up cls-rtracer
to have a generic request context object. Rather than simply providing an id that exists throughout the lifetime of the request, there’s also a request context object that one can access and put in whatever they want.
Example use case:
Applications that have authorized actions can store the authorized account’s id in the request context once authorized. This allows apps to always log an account_id
in a single place when relevant, making tracing all of an account’s actions very convenient.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
The Request Context — Flask Documentation (2.2.x)
When the Flask application handles a request, it creates a Request object based on the environment it received from the WSGI server. Because...
Read more >Understanding the Application and Request Contexts in Flask
This post provides clarity on how the Application and Request contexts work in Flask.
Read more >Is there a generic RequestContext in Java servlet API?
You can attach an object to the current request with setAttribute . This API is primarily used for internal routing, but it's safe...
Read more >How to extend the Express Request object in TypeScript
Let's learn how to extend the Request type in TypeScript to make its instances store custom data you can use at the controller...
Read more >Built-in class-based generic views - Django documentation
get_queryset to add logic to the queryset selection is as convenient as it is powerful. For instance, if we wanted, we could use...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @puzpuzpuz understood. In that case I may have to look into using AsyncLocalStorage myself. Thanks for the response!
@eugene-kim please let me know if you run into any issues or unclear documentation for
AsyncLocalStorage
, as the API is relatively new. Core team would appreciate such feedback from developers.