oida, an in-process tracing library for Go
oida records traces and spans inside a Go service and shows them at /debug/oida. Nothing leaves the process.
Features
- Traces for HTTP requests and background jobs
- Nested spans for database, cache and external calls
- Errors and attributes on any span
- Retention in memory or on disk
- Sampling by rate or by custom rule
- HTML, JSON and plain-text views
Runs without a collector or agent and doesn't export OpenTelemetry. Set Authorize before exposing /debug/oida.
How do you add oida?
Three calls: configure the tracer, add the middleware, mount the UI. Then name the work you care about.
-
Install
One module. It pulls in chi and templ, and nothing else.
go get github.com/titpetric/oida@latest -
Wire it up
Works with chi and with net/http. The dashboard is served by your own binary.
opts := oida.NewOptions() opts.ServiceName = "billing-api" tracer, err := oida.Configure(opts) if err != nil { return err } opts.Tracer = tracer r.Use(oida.TracingMiddleware(opts)) frontend.Mount(r, opts) -
Name your work
Start a span with a kind, end it, and attach whatever you want to see later.
ctx, span := oida.Start(ctx, "SELECT users", oida.KindDatabase) defer span.End() span.SetAttribute("limit", limit)
What oida shows
oida FAQ
Do I need a collector, an agent or an OTLP endpoint?
No. oida records into the process that produced the work and serves the dashboard from the same binary at /debug/oida. There is nothing else to deploy, and no traffic leaves the service.
Is oida OpenTelemetry?
No. It has its own small API and does not export OTLP or talk to Jaeger. You give up a shared standard, and the dashboard is three calls to add with two dependencies, chi and templ.
Does it work with net/http, or only chi?
Both. The middleware is ordinary net/http middleware and the guide covers wiring for each. With chi you can set RouteFunc so statistics group by route pattern rather than by raw path.
What does it cost at runtime?
Retention defaults to 200 completed traces, a trace records at most 1000 spans, and SampleRate is a percentage of requests. Health and metrics paths are ignored by default, and unsampled requests take the nil-safe path.
Do traces survive a restart?
Only if you ask them to. The default is a bounded in-memory ring, so a restart clears it. Point Storage at the disk backend and completed traces are written to disk and reloaded after a restart.
Is it safe to expose /debug/oida?
Not without a check. The dashboard shows request paths, user agents, errors and span attributes, so keep it on an internal listener or set Authorize before mounting it publicly. A rejected request gets a 404 rather than a login prompt.
How do I instrument my own code?
Start a span with a kind, defer its end, and set attributes on it. The instrumentation guide has worked patterns for database/sql, outbound HTTP, cache lookups and concurrent work, plus what not to instrument.
What does oida cost?
Nothing. It is open source under the MIT licence, on GitHub, with no paid tier. We can build a dashboard of your own on it.
Need a dashboard of your own?
We build dashboards, web apps and integrations for services you already run. Tell us in a sentence what it should do.