# README
Tracing
Tracing is a go.opentelemetry.io Tracer wrapper for instrumenting golang applications to collect traces in jaeger.
Install
go get github.com/loghole/tracing
Usage
package main
import (
"context"
"time"
"github.com/loghole/tracing"
)
func main() {
tracer, err := tracing.NewTracer(tracing.DefaultConfiguration("example", "udp://127.0.0.1:6831"))
if err != nil {
panic(err)
}
defer tracer.Close()
ctx, span := tracer.NewSpan().WithName("root").StartWithContext(context.Background())
defer span.End()
next(ctx)
}
func next(ctx context.Context) {
defer tracing.ChildSpan(&ctx).End()
// Some work...
time.Sleep(time.Second)
}