forked from NdoleStudio/httpsms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtracer.go
More file actions
37 lines (27 loc) · 1.39 KB
/
Copy pathtracer.go
File metadata and controls
37 lines (27 loc) · 1.39 KB
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
package telemetry
import (
"context"
"github.com/gofiber/fiber/v2"
"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
}