-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Hi,
Use case: we have 2 applications - a producer and a consumer that communicate using messaging (like RabbitMQ).
When the consumer receives a message, this can trigger several async operations. Before fully processing the first message (during which the consumer application logs), a new message is received (which also logs). It would be handy to have the request_id in the logs so one can distinguish between logs logged during the processing of the first message and entries logged during the processing of the second message. Or in other words, messages can be treated as a kind of requests, but not an HTTP one.
Processing a message can be a part of a single transaction across multiple applications. It would be handy to have correlation_id in the request independent logs to distinguish between logs belonging to different transactions. The user will need a way to set it.
It is handy to have both request_id and correlation_id instead of just correlation_id for example, since (for some reason) the consumer may receive 2 messages that belong to the same logical transaction.
Regarding implementation - since the consumer application can receive 2 messages almost simultaneously and to process them (for example, every message triggers several async operations) almost simultaneously, then there need to be 2 different log objects and not a single one that is shared, because the different ids are state of the logger object.
I am not requesting such a feature, this is just something to consider.
Best regards
Petar