[#12] tracing: Add tracing package

Add tracing config, implementation and setup

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-03-21 11:47:38 +03:00
parent 3a7280968b
commit 816628d37d
6 changed files with 807 additions and 0 deletions

12
pkg/tracing/span.go Normal file
View file

@ -0,0 +1,12 @@
package tracing
import (
"context"
"go.opentelemetry.io/otel/trace"
)
// StartSpanFromContext creates a span and a context.Context containing the newly-created span.
func StartSpanFromContext(ctx context.Context, operationName string, opts ...trace.SpanStartOption) (context.Context, trace.Span) {
return tracer.Load().(*tracerHolder).Tracer.Start(ctx, operationName, opts...)
}