[ann] apistar-request-id


Hi all,

I made a little package for API Star 0.4 today called apistar-request-id. As the name implies, it deals with generating and propagating unique request ids per request via the x-request-id header. It’s available on pypi right now and you can find the docs here: https://github.com/Bogdanp/apistar_request_id#usage

Hope some of you find it useful!


I have seen some stack overflow posts that have mentioned X-request-ID is generated by the client randomly, and then used to match up server logs. Same use case?


Yup, that’s the use case. Generally if you have some sort of api gateway in front of your api, then that’ll generate the request ids and pass them through to your api; otherwise the library generates its own. API code can then grab the same request ids and propagate them elsewhere, for example: you can propagate request ids to your workers or downstream api calls. That way, assuming you have consolidated logging for all of those things, you can look up all the logs pertaining to a particular request by the request id.


Ah, very nice. Ok, my friends and I are going to have to figure out how to incorporate this pattern.

Hey you updated apistar_dramatiq to 0.4! Interesting, you brought back a Settings component in your example. I have been thinking about this problem too. My package has far too many parameters to not do a similar config.


Yeah, that was the simplest DI example I could come up with when I wrote the example. I also ended up publishing apistar_settings because I missed the old settings, specifically the Environment object.