Instrumenting Beego with OpenTelemetry


  • Go 1.13+



In this tutorial we will instrument a basicopen in new window Beego app using OpenTelemetry instrumentation.

Instrumenting Beego app

git clone
cd example/beego
  • Step 2. Install uptrace-go and Beego instrumentation:
go get
go get
  • Step 3. Edit main.go to configure OpenTelemetry to export data to Uptrace:
import ""

	// copy your project DSN here or use UPTRACE_DSN env var
	// uptrace.WithDSN("https://<key><project_id>"),

  • Step 4. Edit main.go to instrument the Beego app:
import ""

// To enable tracing on template rendering, disable autorender and
// call otelbeego.Render manually.
beego.BConfig.WebConfig.AutoRender = false

mware := otelbeego.NewOTelBeegoMiddleWare("service-name")
beego.RunWithMiddleWares(":7777", mware)
UPTRACE_DSN="https://<token><project_id>" go run main.go

What is next?

By now, you should have a Django app with instrumented views. Next, instrumentopen in new window more operations (for example, database queries) or learn about OpenTelemetry API to create your own instrumentations.