Skip to content

Commit

Permalink
Add job_id to Logger metadata for tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
bluzky committed Aug 22, 2024
1 parent 7e35598 commit 318d084
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/exq/worker/server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ defmodule Exq.Worker.Server do
alias Exq.Middleware.Server, as: Middleware
alias Exq.Middleware.Pipeline
alias Exq.Worker.Metadata
require Logger

defmodule State do
defstruct job_serialized: nil,
Expand Down Expand Up @@ -172,6 +173,7 @@ defmodule Exq.Worker.Server do
{:ok, pid} =
Task.start_link(fn ->
:ok = Metadata.associate(metadata, self(), job)
Logger.metadata(job_id: job.jid)
result = apply(worker_module, :perform, job.args)
GenServer.cast(worker, {:done, result})
end)
Expand Down

0 comments on commit 318d084

Please sign in to comment.