Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pijng/go_otel_auto_instrument
Automatically instrument your Go code with Opentelemetry tracing. No eBPF.
https://github.com/pijng/go_otel_auto_instrument
opentelemetry opentelemetry-go opentelemetry-instrumentation otel
Last synced: about 1 month ago
JSON representation
Automatically instrument your Go code with Opentelemetry tracing. No eBPF.
- Host: GitHub
- URL: https://github.com/pijng/go_otel_auto_instrument
- Owner: pijng
- License: apache-2.0
- Created: 2024-11-24T16:50:48.000Z (about 2 months ago)
- Default Branch: master
- Last Pushed: 2024-11-25T15:54:49.000Z (about 2 months ago)
- Last Synced: 2024-11-25T16:41:33.948Z (about 2 months ago)
- Topics: opentelemetry, opentelemetry-go, opentelemetry-instrumentation, otel
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go_otel_auto_instrument
`go_otel_auto_instrument` let's you automatically instrument your Go code with Opentelemtry.
## Installation
### 1. Install the `go-otel-auto-instrument` executable
To use `go-otel-auto-instrument` in your build process, install it as a binary executable:
```bash
go install github.com/pijng/go_otel_auto_instrument/cmd/go-otel-auto-instrument@latest
```### 2. Add `go_otel_auto_instrument` as a dependency
To use the `go_otel_auto_instrument` library in your Go project, add it via Go modules:
```bash
go get github.com/pijng/go_otel_auto_instrument
go mod tidy
```## Usage
### Add blank import to main package
```go
package mainimport (
_ "github.com/pijng/go_otel_auto_instrument"
)
```### Building with `go-otel-auto-instrument`
To automatically instrument your Go code run the command:
```bash
go build -a -toolexec="go-otel-auto-instrument " main.go
```**Important:**
* `-a` flag is required to recompile all your project, otherwise go compiler might do nothing and use cached build
* `` is an absolute path to the root of your project. If you run `go build` from the root of the project – simply specify `$PWD` as an argument.### Run the final binary and specify OTEL_* env variables:
```bash
OTEL_SERVICE_NAME="My Service" OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 ./main
```