Spaces:
Paused
Paused
File size: 1,424 Bytes
83a59ca | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | package telemetry
import (
"context"
"github.com/gofiber/fiber/v3"
"go.opentelemetry.io/otel/trace"
)
const (
// TracerContextKey stores the fiber trace context
TracerContextKey = "tracer.context.key"
)
// Tracer is used for tracing
type Tracer interface {
// StartFromFiberCtx creates a spanContext and a context.Context containing the newly-created spanContext.
StartFromFiberCtx(c fiber.Ctx, name ...string) (context.Context, trace.Span)
// StartFromFiberCtxWithLogger creates a spanContext and a context.Context containing the newly-created spanContext with a logger
StartFromFiberCtxWithLogger(c fiber.Ctx, logger Logger, name ...string) (context.Context, trace.Span, Logger)
// Start creates a spanContext and a context.Context containing the newly-created spanContext.
Start(c context.Context, name ...string) (context.Context, trace.Span)
// StartWithLogger creates a spanContext and a context.Context containing the newly-created spanContext with a logger
StartWithLogger(c context.Context, logger Logger, name ...string) (context.Context, trace.Span, Logger)
// CtxLogger creates a telemetry.Logger with spanContext attributes in the structured logger
CtxLogger(logger Logger, span trace.Span) Logger
// WrapErrorSpan sets a spanContext as error
WrapErrorSpan(span trace.Span, err error) error
// Span returns the trace.Span from context.Context
Span(ctx context.Context) trace.Span
}
|