Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ defmodule OpentelemetryOban.JobHandler do
scheduled_at: scheduled_at,
attempt: attempt,
max_attempts: max_attempts,
meta: job_meta
meta: job_meta,
attempted_at: attempted_at
}
} = metadata

Expand All @@ -59,18 +60,23 @@ defmodule OpentelemetryOban.JobHandler do
links = if parent == :undefined, do: [], else: [OpenTelemetry.link(parent)]
OpenTelemetry.Tracer.set_current_span(:undefined)

workflow_id = get_in(job_meta, ["workflow_id"])

attributes = %{
Trace.messaging_system() => :oban,
Trace.messaging_destination() => queue,
Trace.messaging_destination_kind() => :queue,
Trace.messaging_operation() => :process,
:"oban.job.job_id" => id,
:"oban.job.worker" => worker,
:"oban.job.queue" => queue,
:"oban.job.priority" => priority,
:"oban.job.attempt" => attempt,
:"oban.job.max_attempts" => max_attempts,
:"oban.job.inserted_at" => DateTime.to_iso8601(inserted_at),
:"oban.job.scheduled_at" => DateTime.to_iso8601(scheduled_at)
:"oban.job.scheduled_at" => DateTime.to_iso8601(scheduled_at),
:"oban.job.attempted_at" => DateTime.to_iso8601(attempted_at),
:"oban.job.workflow_id" => workflow_id
}

span_name = "#{worker} process"
Expand Down
2 changes: 1 addition & 1 deletion instrumentation/opentelemetry_oban/mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"},
"makeup_elixir": {:hex, :makeup_elixir, "1.0.1", "e928a4f984e795e41e3abd27bfc09f51db16ab8ba1aebdba2b3a575437efafc2", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "7284900d412a3e5cfd97fdaed4f5ed389b8f2b4cb49efc0eb3bd10e2febf9507"},
"makeup_erlang": {:hex, :makeup_erlang, "1.0.2", "03e1804074b3aa64d5fad7aa64601ed0fb395337b982d9bcf04029d68d51b6a7", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "af33ff7ef368d5893e4a267933e7744e46ce3cf1f61e2dccf53a111ed3aa3727"},
"nimble_parsec": {:hex, :nimble_parsec, "1.4.2", "8efba0122db06df95bfaa78f791344a89352ba04baedd3849593bfce4d0dc1c6", [], [], "hexpm", "4b21398942dda052b403bbe1da991ccd03a053668d147d53fb8c4e0efe09c973"},
"nimble_parsec": {:hex, :nimble_parsec, "1.4.2", "8efba0122db06df95bfaa78f791344a89352ba04baedd3849593bfce4d0dc1c6", [:mix], [], "hexpm", "4b21398942dda052b403bbe1da991ccd03a053668d147d53fb8c4e0efe09c973"},
"oban": {:hex, :oban, "2.17.4", "3ebe79dc0cad16f23e5feea418f9bc5b07d453b8fb7caf376d812be96157a5c5", [:mix], [{:ecto_sql, "~> 3.6", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:ecto_sqlite3, "~> 0.9", [hex: :ecto_sqlite3, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16", [hex: :postgrex, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "71a804abea3bb7e104782a5b5337cbab76c1a56b9689a6d5159a3873c93898b6"},
"opentelemetry": {:hex, :opentelemetry, "1.5.0", "7dda6551edfc3050ea4b0b40c0d2570423d6372b97e9c60793263ef62c53c3c2", [:rebar3], [{:opentelemetry_api, "~> 1.4", [hex: :opentelemetry_api, repo: "hexpm", optional: false]}], "hexpm", "cdf4f51d17b592fc592b9a75f86a6f808c23044ba7cf7b9534debbcc5c23b0ee"},
"opentelemetry_api": {:hex, :opentelemetry_api, "1.4.0", "63ca1742f92f00059298f478048dfb826f4b20d49534493d6919a0db39b6db04", [:mix, :rebar3], [], "hexpm", "3dfbbfaa2c2ed3121c5c483162836c4f9027def469c41578af5ef32589fcfc58"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ defmodule OpentelemetryObanTest do
"oban.job.max_attempts": 1,
"oban.job.priority": 0,
"oban.job.scheduled_at": _scheduled_at,
"oban.job.queue": "events",
"oban.job.attempted_at": _attempted_at,
"oban.job.worker": "TestJob",
"oban.job.workflow_id": _workflow_id,
"messaging.operation": :process,
"messaging.system": :oban
} = :otel_attributes.map(attributes)
Expand Down