Skip to content
TraceStax Docs

Elixir

The TraceStax Elixir SDK supports Oban (Pro and CE) and can be used with any GenServer-based worker via the lower-level client.

  • Elixir 1.14+
  • Oban 2.x (optional — works without Oban too)

Add to mix.exs:

def deps do
[
{:tracestax, "~> 1.0"}
]
end

Then fetch:

Terminal window
mix deps.get

Add the TraceStax plugin to your Oban configuration:

config/config.exs
config :my_app, Oban,
repo: MyApp.Repo,
plugins: [
{TraceStax.Oban.Plugin, api_key: System.get_env("TRACESTAX_API_KEY")}
],
queues: [default: 10, critical: 5]

The plugin hooks into Oban’s telemetry events — no changes to your worker modules required.

defmodule MyApp.Workers.SendEmail do
use Oban.Worker, queue: :default
@impl Oban.Worker
def perform(%Oban.Job{args: %{"user_id" => user_id}}) do
# TraceStax tracks this automatically
MyApp.Mailer.send_welcome(user_id)
end
end

config :tracestax,
api_key: System.get_env("TRACESTAX_API_KEY"), # Required
worker_id: "worker-01", # Default: hostname + PID
enabled: Mix.env() != :test,
ingest_url: "https://ingest.tracestax.com",
timeout: 3_000
KeyEnv varDefaultDescription
:api_keyTRACESTAX_API_KEYRequired
:worker_idTRACESTAX_WORKER_IDhostname + PIDWorker identifier
:enabledTRACESTAX_ENABLEDtrueSet to false in tests
:ingest_urlTRACESTAX_INGEST_URLhttps://ingest.tracestax.comCustom endpoint
:timeout3000HTTP timeout in ms

config/test.exs
config :tracestax, enabled: false