alibaba/loongsuite-go

OpenTelemetry Compile-Time Instrumentation for Golang

Go

904

474 commits

updated Oct 19, 2026

See the code

README

   

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 🚀

Installation

[!IMPORTANT] Requires Go 1.25+ for both the tool and the instrumented application. See compatibility.

Prebuilt Binaries

  • Download
  • Download
  • Download
  • Download
  • Download

Install via Bash

For Linux and macOS, the following script installs otel to /usr/local/bin/otel by default:

$ 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. 🔭

The detailed usage of otel tool can be found in Usage.

[!NOTE] If you find any compilation failures while go build works, 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 go.uber.org/zap logging
  • 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

Supported Libraries

List of Supported Libraries
LibraryRepository UrlMin VersionMax Version
adk-gohttps://pkg.go.dev/google.golang.org/adkv0.2.0-
amqp091https://github.com/rabbitmq/amqp091-gov1.10.0-
antshttps://github.com/panjf2000/antsv1.1.0-
anthropic-sdk-gohttps://github.com/anthropics/anthropic-sdk-gov1.25.0-
asynqhttps://github.com/hibiken/asynqv0.23.0-
aws-sdk-gohttps://github.com/aws/aws-sdk-gov1.55.5-
clickhouse/v2https://github.com/ClickHouse/clickhouse-go/v2v2.13.0-
cronhttps://github.com/robfig/cron/v3v3.0.0-
database/sqlhttps://pkg.go.dev/database/sql--
deepseekhttps://github.com/cohesion-org/deepseek-gov1.3.0-
dubbo-gohttps://github.com/apache/dubbo-gov3.3.0-
echohttps://github.com/labstack/echov4.0.0-
elasticsearchhttps://github.com/elastic/go-elasticsearchv8.4.0v8.15.1
einohttps://github.com/cloudwego/einov0.7.13-
fasthttphttps://github.com/valyala/fasthttpv1.45.0-
fiberhttps://github.com/gofiber/fiberv2.43.0v2.53.0
fiber/v3https://github.com/gofiber/fiber/v3v3.0.0-
franz-gohttps://github.com/twmb/franz-gov1.18.0-
ginhttps://github.com/gin-gonic/ginv1.7.0v1.10.2
go-kit/loghttps://github.com/go-kit/logv0.1.0v0.2.2
go-microhttps://github.com/micro/go-microv5.0.0v5.3.1
go-openaihttps://github.com/sashabaranov/go-openaiv1.30.0-
gocqlhttps://github.com/gocql/gocqlv1.3.0v1.7.1
google-genaihttps://pkg.go.dev/google.golang.org/genaiv1.30.0-
gopghttps://github.com/go-pg/pgv10.10.0v10.14.1
gorestful/v3https://github.com/emicklei/go-restful/v3v3.7.0v3.12.2
gormhttps://github.com/go-gorm/gormv1.22.0v1.25.10
gorilla/muxhttps://github.com/gorilla/muxv1.3.0v1.8.2
grpchttps://google.golang.org/grpcv1.44.0-
hertzhttps://github.com/cloudwego/hertzv0.9.0-
ibm-saramahttps://github.com/IBM/saramav1.40.0-
irishttps://github.com/kataras/irisv12.2.0v12.2.12
k8s client-gohttps://github.com/kubernetes/client-gov0.33.3-
kitexhttps://github.com/cloudwego/kitexv0.5.1-
kratoshttps://github.com/go-kratos/kratosv2.6.3-
kratos/v3https://github.com/go-kratos/kratos/v3v3.0.0-
langchaingohttps://github.com/tmc/langchaingov0.1.13-
loghttps://pkg.go.dev/log--
logrushttps://github.com/sirupsen/logrusv1.5.0-
mcphttps://github.com/mark3labs/mcp-gov0.20.0-
mcp go-sdkhttps://github.com/modelcontextprotocol/go-sdkv0.7.0-
meguminnnnnnnnn/go-openaihttps://github.com/meguminnnnnnnnn/go-openai--
mongodbhttps://github.com/mongodb/mongo-go-driverv1.11.1v1.15.2
mqtthttps://github.com/mochi-mqtt/serverv2.6.4-
neo4jhttps://github.com/neo4j/neo4j-go-driverv6.0.0-
nacoshttps://github.com/nacos-group/nacos-sdk-go/v2v2.0.0v2.3.0
net/httphttps://pkg.go.dev/net/http--
new-apihttps://github.com/QuantumNous/new-api--
ollamahttps://github.com/ollama/ollamav0.3.14-
openai-gohttps://github.com/openai/openai-gov1.5.0-
redigohttps://github.com/gomodule/redigov1.9.0-
redis (go-redis)https://github.com/redis/go-redisv9.0.5-
redis v8https://github.com/go-redis/redis/v8v8.11.0v8.11.6
rocketmqhttps://github.com/apache/rocketmq-client-go/v2v2.0.0-
rpcxhttps://github.com/smallnest/rpcxv1.6.2-
rueidishttps://github.com/redis/rueidisv1.0.30-
segmentio/kafka-gohttps://github.com/segmentio/kafka-gov0.4.0-
sentinelhttps://github.com/alibaba/sentinel-golangv1.0.4-
shopify-saramahttps://github.com/Shopify/saramav1.22.0-
sloghttps://pkg.go.dev/log/slog--
sqlxhttps://github.com/jmoiron/sqlxv1.3.0v1.4.1
streadway-amqphttps://github.com/streadway/amqpv1.0.0-
trpc-agent-gohttps://github.com/trpc-group/trpc-agent-gov0.1.0-
trpc-gohttps://github.com/trpc-group/trpc-gov1.0.0-
zaphttps://go.uber.org/zapv1.20.0v1.27.1
zerologhttps://github.com/rs/zerologv1.10.0v1.34.1

We are progressively open-sourcing the libraries we have supported, and your contributions are Very Welcome

[!IMPORTANT] The framework you expected is not in the list? Don't worry, you can easily inject your code into any frameworks/libraries that are not officially supported.

Please refer to this document to get started.

Community

This project has been contributed upstream to the OpenTelemetry community and successfully incubated the official opentelemetry-go-compile-instrumentation project.

Join our DingTalk group or scan the QR codes below.

LoongCollector SIGLoongSuite Python SIGLoongSuite Go SIGLoongSuite Java SIG

Star History

apm
go
instrumentation
metrics
observability
opentelemetry
tracing

alibaba/loongsuite-go

OpenTelemetry Compile-Time Instrumentation for Golang

Go

904

474 commits

updated Oct 19, 2026

See the code

README

   

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 🚀

Installation

[!IMPORTANT] Requires Go 1.25+ for both the tool and the instrumented application. See compatibility.

Prebuilt Binaries

  • Download
  • Download
  • Download
  • Download
  • Download

Install via Bash

For Linux and macOS, the following script installs otel to /usr/local/bin/otel by default:

$ 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. 🔭

The detailed usage of otel tool can be found in Usage.

[!NOTE] If you find any compilation failures while go build works, 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 go.uber.org/zap logging
  • 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

Supported Libraries

List of Supported Libraries
LibraryRepository UrlMin VersionMax Version
adk-gohttps://pkg.go.dev/google.golang.org/adkv0.2.0-
amqp091https://github.com/rabbitmq/amqp091-gov1.10.0-
antshttps://github.com/panjf2000/antsv1.1.0-
anthropic-sdk-gohttps://github.com/anthropics/anthropic-sdk-gov1.25.0-
asynqhttps://github.com/hibiken/asynqv0.23.0-
aws-sdk-gohttps://github.com/aws/aws-sdk-gov1.55.5-
clickhouse/v2https://github.com/ClickHouse/clickhouse-go/v2v2.13.0-
cronhttps://github.com/robfig/cron/v3v3.0.0-
database/sqlhttps://pkg.go.dev/database/sql--
deepseekhttps://github.com/cohesion-org/deepseek-gov1.3.0-
dubbo-gohttps://github.com/apache/dubbo-gov3.3.0-
echohttps://github.com/labstack/echov4.0.0-
elasticsearchhttps://github.com/elastic/go-elasticsearchv8.4.0v8.15.1
einohttps://github.com/cloudwego/einov0.7.13-
fasthttphttps://github.com/valyala/fasthttpv1.45.0-
fiberhttps://github.com/gofiber/fiberv2.43.0v2.53.0
fiber/v3https://github.com/gofiber/fiber/v3v3.0.0-
franz-gohttps://github.com/twmb/franz-gov1.18.0-
ginhttps://github.com/gin-gonic/ginv1.7.0v1.10.2
go-kit/loghttps://github.com/go-kit/logv0.1.0v0.2.2
go-microhttps://github.com/micro/go-microv5.0.0v5.3.1
go-openaihttps://github.com/sashabaranov/go-openaiv1.30.0-
gocqlhttps://github.com/gocql/gocqlv1.3.0v1.7.1
google-genaihttps://pkg.go.dev/google.golang.org/genaiv1.30.0-
gopghttps://github.com/go-pg/pgv10.10.0v10.14.1
gorestful/v3https://github.com/emicklei/go-restful/v3v3.7.0v3.12.2
gormhttps://github.com/go-gorm/gormv1.22.0v1.25.10
gorilla/muxhttps://github.com/gorilla/muxv1.3.0v1.8.2
grpchttps://google.golang.org/grpcv1.44.0-
hertzhttps://github.com/cloudwego/hertzv0.9.0-
ibm-saramahttps://github.com/IBM/saramav1.40.0-
irishttps://github.com/kataras/irisv12.2.0v12.2.12
k8s client-gohttps://github.com/kubernetes/client-gov0.33.3-
kitexhttps://github.com/cloudwego/kitexv0.5.1-
kratoshttps://github.com/go-kratos/kratosv2.6.3-
kratos/v3https://github.com/go-kratos/kratos/v3v3.0.0-
langchaingohttps://github.com/tmc/langchaingov0.1.13-
loghttps://pkg.go.dev/log--
logrushttps://github.com/sirupsen/logrusv1.5.0-
mcphttps://github.com/mark3labs/mcp-gov0.20.0-
mcp go-sdkhttps://github.com/modelcontextprotocol/go-sdkv0.7.0-
meguminnnnnnnnn/go-openaihttps://github.com/meguminnnnnnnnn/go-openai--
mongodbhttps://github.com/mongodb/mongo-go-driverv1.11.1v1.15.2
mqtthttps://github.com/mochi-mqtt/serverv2.6.4-
neo4jhttps://github.com/neo4j/neo4j-go-driverv6.0.0-
nacoshttps://github.com/nacos-group/nacos-sdk-go/v2v2.0.0v2.3.0
net/httphttps://pkg.go.dev/net/http--
new-apihttps://github.com/QuantumNous/new-api--
ollamahttps://github.com/ollama/ollamav0.3.14-
openai-gohttps://github.com/openai/openai-gov1.5.0-
redigohttps://github.com/gomodule/redigov1.9.0-
redis (go-redis)https://github.com/redis/go-redisv9.0.5-
redis v8https://github.com/go-redis/redis/v8v8.11.0v8.11.6
rocketmqhttps://github.com/apache/rocketmq-client-go/v2v2.0.0-
rpcxhttps://github.com/smallnest/rpcxv1.6.2-
rueidishttps://github.com/redis/rueidisv1.0.30-
segmentio/kafka-gohttps://github.com/segmentio/kafka-gov0.4.0-
sentinelhttps://github.com/alibaba/sentinel-golangv1.0.4-
shopify-saramahttps://github.com/Shopify/saramav1.22.0-
sloghttps://pkg.go.dev/log/slog--
sqlxhttps://github.com/jmoiron/sqlxv1.3.0v1.4.1
streadway-amqphttps://github.com/streadway/amqpv1.0.0-
trpc-agent-gohttps://github.com/trpc-group/trpc-agent-gov0.1.0-
trpc-gohttps://github.com/trpc-group/trpc-gov1.0.0-
zaphttps://go.uber.org/zapv1.20.0v1.27.1
zerologhttps://github.com/rs/zerologv1.10.0v1.34.1

We are progressively open-sourcing the libraries we have supported, and your contributions are Very Welcome

[!IMPORTANT] The framework you expected is not in the list? Don't worry, you can easily inject your code into any frameworks/libraries that are not officially supported.

Please refer to this document to get started.

Community

This project has been contributed upstream to the OpenTelemetry community and successfully incubated the official opentelemetry-go-compile-instrumentation project.

Join our DingTalk group or scan the QR codes below.

LoongCollector SIGLoongSuite Python SIGLoongSuite Go SIGLoongSuite Java SIG

Star History

apm
go
instrumentation
metrics
observability
opentelemetry
tracing

Project health

Latest release

v1.15.0 · Sep 28, 2026

Releases this year

4

Significant stargazers

Adrian Cole

908 followers · starred Nov 2024

xu0o0

182 followers · starred Feb 2025

Masaaki Goshima

841 followers · starred Sep 2025

apocelipes

109 followers · starred Jan 2025