Loongsuite Go Agent provides an automatic solution for Golang applications that want to
leverage OpenTelemetry to enable effective observability. No code changes are
required in the target application, the instrumentation is done at compile
time. Simply adding otel prefix to go build to get started :rocket:
Installation
[!IMPORTANT] Requires Go 1.25 or newer.
loongsuite-gopins OpenTelemetry v1.45.0, and the OTel modules declarego 1.25.0from v1.42.0 onward. Since the tool injects those modules into the application it instruments, both the tool and the instrumented application need Go 1.25+. See compatibility.
Prebuilt Binaries
This is the recommended way to install the tool.
Install via Bash
For Linux and MacOS users, the following script will install otel in /usr/local/bin/otel by default:
$ sudo curl -fsSL https://cdn.jsdelivr.net/gh/alibaba/loongsuite-go@main/install.sh | sudo bash
Build from Source
$ make # build only
$ make install # build and install
Getting Started
Make sure the tool is installed:
$ # You may use "otel-linux-amd64" instead of "otel"
$ otel version
Just adding otel prefix to go build to build your project:
$ otel go build
$ otel go build -o app cmd/app
$ otel go build -gcflags="-m" cmd/app
That's the whole process! The tool will automatically instrument your code with OpenTelemetry, and you can start to observe your application. :telescope:
The detailed usage of otel tool can be found in Usage.
[!NOTE] If you find any compilation failures while
go buildworks, it's likely a bug. Please feel free to file a bug at GitHub Issues to help us enhance this project.
Examples
- demo - End-to-end example with OpenTelemetry tracing and metrics
- zap logging - Auto-instrumentation for
github.com/uber-go/zaplogging - benchmark - Performance testing and overhead measurement
- sql injection - Custom code injection for SQL injection detection
- nethttp - HTTP monitoring with request/response instrumentation
- kratos-demo - Integration with the Kratos framework
- kafka-demo - Kafka Consumer Message monitoring