reitit 2024-08-21

Request tracing We would like to implement a tracing option between the clients and the servers. There is an option to simply generate a UUID to the X-Request-ID HTTP header or there is this Trace Context thing from W3C https://www.w3.org/TR/trace-context/ Is any of you doing something like this?

For our API, we added a middleware to inject an https://github.com/theikkila/clj-ulid value upon receiving a request map, and returns the same value as a X-Request-ID response header. In our specific case, it is very helpful to provide that request ID in the Timbre context with taoensso.timbre/with-context+. For it to work, we provided a custom log formatter fn to Timbre. YMMV.

👍 1

I am leaning to implement the W3C Trace Context since that seems to be the future and also one of the components supports that already.

👍 1

If you’re interested, I created this microlibrary for generation and parsing of W3C trace contexts: https://github.com/ilmoraunio/clj-w3c-trace-context

👍 1

Absolutely!