fiber_otel

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: MIT Imports: 8 Imported by: 3

Documentation

Index

Constants

View Source
const LocalsCtxKey = "otel-ctx"

Variables

View Source
var ConfigDefault = Config{
	SpanName:     "HTTP {{ .Method }}",
	LocalKeyName: LocalsCtxKey,
	TracerStartAttributes: []trace.SpanStartOption{
		trace.WithSpanKind(trace.SpanKindServer),
		trace.WithNewRoot(),
	},
}

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
}

Config defines the config for middleware.

Jump to

Keyboard shortcuts

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