Monitor Beego with OpenTelemetry Instrumentation

beego is an open-source, high-performance web framework for the Go programming language. It can be used to develop RESTful APIs, web apps and backend services.

This article will teach you how to monitor Beego performance using OpenTelemetry observability framework.

What is OpenTelemetry?

OpenTelemetryopen in new window is an open-source observability framework for distributed tracingopen in new window (including logs and errors) and OpenTelemetry metricsopen in new window.

Otel allows developers to collect and export telemetry data in a vendor agnostic way. With OpenTelemetry, you can instrument your application once and then add or change vendors without changing the instrumentation, for example, here is a list popular DataDog alternativesopen in new window that support OpenTelemetry.

OpenTelemetry is available for most programming languages and provides interoperability across different languages and environments.

Beego instrumentation

To install Beego OpenTelemetry instrumentation:

go get


You can instrument Beego by installing with OpenTelemetry middleware:

import (

mware := otelbeego.NewOTelBeegoMiddleWare("service-name")
beego.RunWithMiddleWares(":7777", mware)

Instrumenting templates rendering

To instrument templates rendering, disable autorender and use helpers from otelbeego package:

import ""

beego.BConfig.WebConfig.AutoRender = false

err := otelbeego.Render(&c.Controller)

See the exampleopen in new window and the reference:

What is Uptrace?

Uptrace is a source-available APMopen in new window powered by OpenTelemetry and ClickHouse. It allows you to identify and fix bugs in production faster knowing what conditions lead to which errors.

You can get startedopen in new window with Uptrace by downloading a DEB/RPM package or a pre-compiled Go binary.

What's next?

Next, instrumentopen in new window more operations, for example, database queries, errors, and logs. You can also learn about OpenTelemetry Go Tracing APIopen in new window to create your own instrumentations.

Popular instrumentations:

Last Updated: