+
Skip to content

targc/otelinit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bootstrap OTEL Go client

This package aim to simplify and reduce line of code to integrate with OTEL lib.

Usage

...

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

About

A Go implementation for easily bootstrapping the OpenTelemetry (OTEL) SDK.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载