Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/knullism/otelinit
A Go implementation for easily bootstrapping the OpenTelemetry (OTEL) SDK.
https://github.com/knullism/otelinit
opentelemetry opentelemetry-go
Last synced: about 2 months ago
JSON representation
A Go implementation for easily bootstrapping the OpenTelemetry (OTEL) SDK.
- Host: GitHub
- URL: https://github.com/knullism/otelinit
- Owner: knullism
- Created: 2024-09-25T09:39:24.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-25T11:42:41.000Z (4 months ago)
- Last Synced: 2024-11-17T06:25:02.163Z (about 2 months ago)
- Topics: opentelemetry, opentelemetry-go
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bootstrap OTEL Go client
This package aim to simplify and reduce line of code to integrate with OTEL lib.
## Usage
```go
...import (
"context"
"github.com/5ylar/otelinit"
)func main() {
ctx := context.Background()
shutdown := otelinit.Init(ctx)
defer shutdown(ctx)...
ctx, span := otelinit.Tracer.Start(ctx, "test span name")
defer span.End()...
}
```We can configure behavior of OTEL client via environment variables. For example:
```
OTEL_RESOURCE_ATTRIBUTES=service.name=example,example.name=basic
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
OTEL_TRACES_SAMPLER=parentbased_traceidratio
OTEL_TRACES_SAMPLER_ARG=1.0
OTEL_BSP_SCHEDULE_DELAY=2000
```