21 lines
472 B
Go
21 lines
472 B
Go
package utils
|
|
|
|
import (
|
|
"context"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
"go.opentelemetry.io/otel/trace"
|
|
)
|
|
|
|
func SetupTracing(ctx context.Context, tracer trace.Tracer, tracerName string) (context.Context, trace.Span, *log.Entry) {
|
|
ctx, span := tracer.Start(ctx, tracerName)
|
|
localLogger := log.WithContext(ctx)
|
|
|
|
return ctx, span, localLogger
|
|
}
|
|
|
|
func HandleEvent(span trace.Span, logger *log.Entry, eventName string) {
|
|
logger.Debug(eventName)
|
|
span.AddEvent(eventName)
|
|
}
|