Zharp.Oban (Zharp v0.1.0)

Copy Markdown View Source

Oban jobs as spans, in the trace of the request that queued them.

Each job runs in a span of its own (MyApp.Workers.Receipt process), with its queue, attempt and id; a job that raises is an error. Oban has no hook for changing a job as it is inserted, so to run a job in the request's trace, insert it through Zharp (the same meta keys opentelemetry_oban uses):

MyApp.Workers.Receipt.new(%{order_id: order.id}) |> Zharp.Oban.insert()

or add the trace to a changeset you insert yourself with Zharp.Oban.with_trace/1. Without it the job is a trace of its own.

Summary

Functions

Oban.insert/2, with the current trace in the job's meta.

Oban.insert!/2, with the current trace in the job's meta.

The job changeset with the current trace in its meta.

Functions

insert(name \\ Oban, changeset)

Oban.insert/2, with the current trace in the job's meta.

insert!(name \\ Oban, changeset)

Oban.insert!/2, with the current trace in the job's meta.

with_trace(changeset)

The job changeset with the current trace in its meta.