Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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
```