This project 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, and the instrumentation is done at compile
time. Simply replace go build
with otelbuild
to get started.
Run the following command to build otelbuild
:
$ make build
To run all tests:
$ make test
Replace go build
with the following command to build your project:
# go build
$ ./otelbuild
The arguments for go build
should be placed after the --
delimiter:
# go build -gcflags="-m" cmd/app
$ ./otelbuild -- -gcflags="-m" cmd/app
The arguments for the tool itself should be placed before the --
delimiter:
$ ./otelbuild -help # print help doc
$ ./otelbuild -debuglog # print log to file
$ ./otelbuild -verbose -- -gcflags="-m" cmd/app # print verbose log
You can also explore these examples to get hands-on experience.
Also there are several documents that you may find useful
Note
If you find any compilation failures during the process, it's likely a bug. Please feel free to file a bug at GitHub Issues to help us enhance this project.
Plugin Name | Repository Url | Min Supported Version | Max Supported Version |
---|---|---|---|
database/sql | https://pkg.go.dev/database/sql | - | - |
echo | https://github.com/labstack/echo | v4.0.0 | v4.12.0 |
gin | https://github.com/gin-gonic/gin | v1.7.0 | v1.10.0 |
go-redis | https://github.com/redis/go-redis | v9.0.5 | v9.5.1 |
gorm | https://github.com/go-gorm/gorm | v1.22.0 | v1.25.9 |
logrus | https://github.com/sirupsen/logrus | v1.5.0 | v1.9.3 |
mongodb | https://github.com/mongodb/mongo-go-driver | v1.11.1 | v1.15.2 |
mux | https://github.com/gorilla/mux | v1.3.0 | v1.8.1 |
net/http | https://pkg.go.dev/net/http | - | - |
zap | https://github.com/uber-go/zap | v1.20.0 | v1.27.0 |
We are progressively open-sourcing the libraries we have supported, and your contributions are very welcome 💖 .
Please refer to this document for guidance on how to write instrumentation code for new frameworks.
We are looking forward to your feedback and suggestions. You can join our DingTalk group to engage with us.