backwork (Elixir)
One-call OpenTelemetry tracing for backwork.dev. Wraps the
opentelemetry_* exporter config and instrumentation setup so you don't hand-wire
raw OTel.
Logs and host/container metrics come from the backwork agent (
curl … install.sh). This package is only for distributed traces / APM from inside your app.
Install
In mix.exs, add :backwork plus the instrumentation libs your app uses:
def deps do
[
{:backwork, "~> 0.1"},
{:opentelemetry_phoenix, "~> 2.0"}, # if Phoenix
{:opentelemetry_bandit, "~> 0.2"}, # or :opentelemetry_cowboy
{:opentelemetry_ecto, "~> 1.2"} # if Ecto
]
end
Use
- Create a Project in backwork and copy its ingest token; set
BACKWORK_TOKEN. - Configure the exporter in
config/runtime.exs:
config :opentelemetry, traces_exporter: :otlp
config :opentelemetry_exporter, Backwork.exporter_config()
- Attach instrumentation in
application.ex, before your supervisor children:
def start(_type, _args) do
Backwork.setup(phoenix_adapter: :bandit, ecto: [[:my_app, :repo]])
children = [...]
Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor)
end
Name the service with OTEL_RESOURCE_ATTRIBUTES=service.name=my-app.
Config
| Env | Default | Notes |
|---|---|---|
BACKWORK_TOKEN | — | required — project ingest token |
BACKWORK_ENDPOINT | https://backwork.dev/otlp | self-hosted? point at your own host |
Within ~30s of the first request your service appears under Traces, Requests and Metrics → Application performance.