Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add job_id to Logger metadata for tracing #493

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bluzky
Copy link

@bluzky bluzky commented Aug 22, 2024

Hi,

I think it would be helpful to add job id to Logger metadata. So it would provide better log tracebility.

For example:

config :logger, :console,
  format: "$time $metadata[$level] $message\n",
  metadata: [:job_id]

produce log
13:13:00.120 job_id=8a762129-beff-4a2e-b9f6-35d1a1067581 [info] Time calculate pending orders - 0

and we can find all log that belongs to the same job

How do you think.

@ananthakumaran
Copy link
Collaborator

Couple of things to do

  1. rename it to jid, which is what we use everywhere
  2. do the same on Exq.Middleware.Logger as well in the before_work, so all the logs from exq logger will also have the correct jid and would be useful to filter out the logs of a single job with structured logging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants