MCPcopy Index your code
hub / github.com/alibaba/loongsuite-go

github.com/alibaba/loongsuite-go @v1.12.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.12.0 ↗ · + Follow
5,289 symbols 16,942 edges 788 files 1,105 documented · 21% updated 1d agov1.12.0 · 2026-06-25★ 87819 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
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 :rocket:

Installation

Prebuilt Binaries

  • Download
  • Download
  • Download
  • Download
  • Download

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 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 github.com/uber-go/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

Library Repository Url Min Version Max Version
adk-go https://pkg.go.dev/google.golang.org/adk v0.2.0 -
amqp091 https://github.com/rabbitmq/amqp091-go v1.10.0 -
ants https://github.com/panjf2000/ants v1.1.0 -
anthropic-sdk-go https://github.com/anthropics/anthropic-sdk-go v1.25.0 -
asynq https://github.com/hibiken/asynq v0.23.0 v0.26.0
clickhouse/v2 https://github.com/ClickHouse/clickhouse-go/v2 v2.13.0 -
cron https://github.com/robfig/cron/v3 v3.0.0 -
database/sql https://pkg.go.dev/database/sql - -
dubbo-go https://github.com/apache/dubbo-go v3.3.0 -
echo https://github.com/labstack/echo v4.0.0 -
elasticsearch https://github.com/elastic/go-elasticsearch v8.4.0 v8.15.1
eino https://github.com/cloudwego/eino v0.3.51 -
fasthttp https://github.com/valyala/fasthttp v1.45.0 v1.65.1
fiber https://github.com/gofiber/fiber v2.43.0 v2.52.13
franz-go https://github.com/twmb/franz-go v1.18.0 -
gin https://github.com/gin-gonic/gin v1.7.0 v1.10.2
go-kit/log https://github.com/go-kit/log v0.1.0 v0.2.2
go-micro https://github.com/micro/go-micro v5.0.0 v5.3.1
go-openai https://github.com/sashabaranov/go-openai v1.30.0 -
go-restful https://github.com/emicklei/go-restful v3.7.0 v3.12.2
gocql https://github.com/gocql/gocql v1.3.0 v1.7.1
gopg https://github.com/go-pg/pg v10.10.0 v10.14.1
gorestful/v3 https://github.com/emicklei/go-restful/v3 v3.7.0 v3.12.2
gorm https://github.com/go-gorm/gorm v1.22.0 v1.25.10
gorilla/mux https://github.com/gorilla/mux v1.3.0 v1.8.2
grpc https://google.golang.org/grpc v1.44.0 v1.63.0
hertz https://github.com/cloudwego/hertz v0.8.0 -
iris https://github.com/kataras/iris v12.2.0 v12.2.12
k8s client-go https://github.com/kubernetes/client-go v0.33.3 -
kitex https://github.com/cloudwego/kitex v0.5.1 -
kratos https://github.com/go-kratos/kratos v2.6.3 -
langchaingo https://github.com/tmc/langchaingo v0.1.13 -
log https://pkg.go.dev/log - -
logrus https://github.com/sirupsen/logrus v1.5.0 -
mcp https://github.com/mark3labs/mcp-go v0.20.0 v0.20.2
mongodb https://github.com/mongodb/mongo-go-driver v1.11.1 v1.15.2
mqtt https://github.com/mochi-mqtt/server v2.6.4 -
nacos https://github.com/nacos-group/nacos-sdk-go/v2 v2.0.0 v2.3.0
net/http https://pkg.go.dev/net/http - -
ollama https://github.com/ollama/ollama v0.3.14 -
openai-go https://github.com/openai/openai-go v1.5.0 -
redigo https://github.com/gomodule/redigo v1.9.0 -
redis (go-redis) https://github.com/redis/go-redis v9.0.5 -
redis v8 https://github.com/go-redis/redis/v8 v8.11.0 v8.11.6
rocketmq https://github.com/apache/rocketmq-client-go/v2 v2.0.0 -
rpcx https://github.com/smallnest/rpcx v1.6.2 -
rueidis https://github.com/redis/rueidis v1.0.30 -
segmentio/kafka-go https://github.com/segmentio/kafka-go v0.4.0 -
sentinel https://github.com/alibaba/sentinel-golang v1.0.4 -
slog https://pkg.go.dev/log/slog - -
sqlx https://github.com/jmoiron/sqlx v1.3.0 v1.4.1
streadway-amqp https://github.com/streadway/amqp v1.0.0 -
trpc-go https://github.com/trpc-group/trpc-go v1.0.0 -
zap https://github.com/uber-go/zap v1.20.0 v1.27.1
zerolog https://github.com/rs/zerolog v1.10.0 v1.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

We are looking forward to your feedback and suggestions. You can join our DingTalk group to engage with us.

DingTalk Star History

Extension points exported contracts — how you extend this code

InstrumentEnabler (Interface)
TODO: add route updater here, now we do not support such controller layer to update route. [52 implementers]
pkg/inst-api/instrumenter/instrumenter_builder.go
GreeterService (Interface)
START ======================================= Server Service Definition ======================================= START Gr [7 …
test/trpc/v1.0.0/hello.trpc.go
MessagePart (Interface)
MessagePart represents a part of a message (text, tool call, etc.) [8 implementers]
util-genai/types.go
GenAISpanKindGetter (Interface)
GenAISpanKindGetter is an interface for extracting GenAI span kind from a request. [5 implementers]
pkg/inst-api-semconv/instrumenter/ai/genai_span_kind.go
Option (Interface)
Option applies an option value for a grpcOtelConfig. [5 implementers]
pkg/rules/grpc/grpc_config.go
Client (Interface)
Client is designed to provide IDL-compatible methods with call-option parameter for kitex framework. [4 implementers]
test/kitex/v0.5.1/kitex_gen/api/hello/client.go
GreetService (Interface)
GreetService is a client for the greet.GreetService service. [2 implementers]
test/dubbo/v3.3.0/greet.triple.go
CallContext (Interface)
----------------------------------------------------------------------------- Call Context The CallContext struct is us [1 …
pkg/api/api.go

Core symbols most depended-on inside this repo

String
called by 556
tool/rules/base.go
Errorf
called by 333
test/verifier/util.go
Assert
called by 294
test/verifier/util.go
GetAttribute
called by 288
test/verifier/util.go
End
called by 276
pkg/inst-api/instrumenter/instrumenter.go
Enable
called by 263
pkg/inst-api/instrumenter/instrumenter_builder.go
RunGoBuild
called by 208
test/infra.go
UseApp
called by 205
test/infra.go

Shape

Function 2,651
Method 1,918
Struct 628
Interface 63
TypeAlias 26
FuncType 3

Languages

Go100%
TypeScript1%

Modules by API surface

pkg/rules/google-genai/v1_59_0/models.go146 symbols
pkg/rules/google-genai/v1_36_0/models.go140 symbols
pkg/rules/google-genai/v1_45_0/models.go139 symbols
pkg/rules/rueidisgo/rueidis_cluster_setup.go66 symbols
test/kratos/v2.6.3/pkg/conf/conf.pb.go64 symbols
test/kitex/v0.5.1/kitex_gen/api/hello.go62 symbols
pkg/rules/rocketmq/rocketmq_otel_instrumenter.go59 symbols
pkg/rules/ollama/ollama_cost.go59 symbols
pkg/rules/mqtt/mqtt_otel_instrumenter.go57 symbols
pkg/inst-api-semconv/instrumenter/http/http_attrs_extractor_test.go55 symbols
pkg/rules/segmentio-kafka-go/kafka_otel_instrumenter.go52 symbols
pkg/rules/databasesql/setup.go46 symbols

Datastores touched

restaurantsCollection · 1 repos
usersCollection · 1 repos
(mysql)Database · 1 repos
sample_restaurantsDatabase · 1 repos
(mongodb)Database · 1 repos

For agents

$ claude mcp add loongsuite-go \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page