fotel

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2024 License: CC0-1.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const LocalsCtxKey = "otel-ctx"

Variables

View Source
var ConfigDefault = Config{
	SpanName:     "{{ .Method }} {{ .Path }}",
	LocalKeyName: LocalsCtxKey,
	TracerStartAttributes: []trace.SpanStartOption{
		trace.WithSpanKind(trace.SpanKindServer),
	},
	Propagator: propagation.NewCompositeTextMapPropagator(b3.New(b3.WithInjectEncoding(b3.B3MultipleHeader)), propagation.TraceContext{}, propagation.Baggage{}),
}

ConfigDefault is the default config

View Source
var Tracer = otel.Tracer("fiber-otel-router")

Functions

func FromCtx

func FromCtx(ctx *fiber.Ctx) context.Context

func New

func New(config ...Config) fiber.Handler

New creates a new middleware handler

func SpanFromCtx

func SpanFromCtx(ctx *fiber.Ctx) trace.Span

Types

type Config

type Config struct {
	Tracer                trace.Tracer
	TracerStartAttributes []trace.SpanStartOption
	// SpanName is a template for span naming.
	// The scope is fiber context.
	SpanName     string
	LocalKeyName string
	Filters      []Filter //Blacklist filter
	Propagator   propagation.TextMapPropagator
}

Config defines the config for middleware.

type Filter

type Filter func(c *fiber.Ctx) bool

func FilterPathExact

func FilterPathExact(paths ...string) Filter

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL