SAP / SAP/cf-nodejs-logging-support
Consider adding 'correlation_id' and 'request_id' to request independent logs
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 46
- Forks
- 25
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 15
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files, tests, or entry points. Review the repository's structured logging and request-metrics implementation, then trace how asynchronous message processing is represented; a complete result would need an agreed design for independent request and correlation IDs, per-message logger state, and a defined validation path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100