otelfiber

package module
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 14 Imported by: 0

README

Otelfiber

Release Discord Test Security Linter

OpenTelemetry support for Fiber.

Can be found on OpenTelemetry Registry.

Install

This middleware supports Fiber v2.

go get -u github.com/gofiber/contrib/otelfiber
Signature
otelfiber.Middleware(opts ...Option) fiber.Handler
Usage

Please refer to example

Documentation

Overview

Package otelfiber instruments the github.com/gofiber/fiber package. (https://github.com/gofiber/fiber).

Currently, only the routing of a received message can be instrumented. To do so, use the Middleware function.

Index

Constants

View Source
const (

	// Unit constants for deprecated metric units
	UnitDimensionless = "1"
	UnitBytes         = "By"
	UnitMilliseconds  = "ms"
)

Variables

This section is empty.

Functions

func Middleware

func Middleware(opts ...Option) fiber.Handler

Middleware returns fiber handler which will trace incoming requests.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option specifies instrumentation configuration options.

func WithMeterProvider

func WithMeterProvider(provider otelmetric.MeterProvider) Option

WithMeterProvider specifies a meter provider to use for reporting. If none is specified, the global provider is used.

func WithPort

func WithPort(port int) Option

WithPort specifies the value to use when setting the `net.host.port` attribute on metrics/spans. Attribute is "Conditionally Required: If not default (`80` for `http`, `443` for `https`).

func WithPropagators

func WithPropagators(propagators propagation.TextMapPropagator) Option

WithPropagators specifies propagators to use for extracting information from the HTTP requests. If none are specified, global ones will be used.

func WithServerName

func WithServerName(serverName string) Option

WithServerName specifies the value to use when setting the `http.server_name` attribute on metrics/spans.

func WithSkipURIs

func WithSkipURIs(uris []string) Option

WithSkipURIs specifies the uris to exclude

func WithSpanNameFormatter

func WithSpanNameFormatter(f func(ctx *fiber.Ctx) string) Option

WithSpanNameFormatter takes a function that will be called on every request and the returned string will become the Span Name

func WithTracerProvider

func WithTracerProvider(provider oteltrace.TracerProvider) Option

WithTracerProvider specifies a tracer provider to use for creating a tracer. If none is specified, the global provider is used.

Jump to

Keyboard shortcuts

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