Skip to content

NameHaibinZhang/opentelemetry-go-auto-instrumentation

 
 

Repository files navigation

OpenTelemetry Go Auto Instrumentation

Introduction

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. The only thing you need to do is to replace go build with otelbuild.

How to Build

Run the following command to build otelbuild:

$ make build

To build all supported platforms for release purpose:

$ make all

To run all tests:

$ make test

How to Use

Replace go build with the following command to build you 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

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.

Lastly, we've provided some examples in example direcory, you can try the project through those examples.

Supported libraries

Plugin Name Repository Url Min Supported Version Max Supported Version
net/http https://pkg.go.dev/net/http - -
database/sql https://pkg.go.dev/database/sql - -
go-redis https://github.com/redis/go-redis v9.0.5 v9.5.1
mongodb https://github.com/mongodb/mongo-go-driver v1.11.1 v1.15.2

We are gradually open-sourcing the libraries we have supported, and your contributions are very welcome.

Community

We are looking forward to your feedback and suggestions. Please feel free to join our DingTalk group to communicate with us.

Also there are several documents that you may find useful:

About

OpenTelemetry Compile-Time Instrumentation for Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.5%
  • Makefile 0.5%