Hi folks!
I have another topic I would love to get coordinated between different vendors if you are interested: logCorrelationId
What is it? It is a unique Id which is generated on the 'boundaries' of a system (eg. a user clicks on some button triggering an AJAX call) and then gets handed over from one server to another. Whenever a log output is performed this unique logCorrelationId will get printed out. I usually do this via log4j2 MDC. Slf4j supports it in the API as well.
Whenever the first microservice invokes another box via REST (or even SOAP) it hands over this id as HTTP header with the name X_LOG_CORRELATION_ID.
The other box then takes this logCorrelationId and reuses it. That way you can trace a request through your whole system.
I've written a blog post on this topic early this year
I'm doing this since quite a few years but I'm sure I'm not the only one. Does swarm or spring boot have a similar mechanism already? Is there something we can standardise on?
It actually doesn't matter how one implements this and which logging framework each microservice uses.
The most important thing in my opinion (or maybe even the only one) is to agree on the HTTP header parameter name!
If there is a request with this very http header parameter -> re-use it as logCorrelationId for this thread. If none -> create a fresh uuid as logCorrelationId.
Of course for eventing systems we need to find another way to pass the token.
Wdyt?
LieGrue,
strub