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
- func HasBasicAuth(auth string) (string, bool)
- func Middleware(opts ...Option) fiber.Handler
- type Option
- func WithCollectClientIP(collect bool) Option
- func WithCustomAttributes(f func(ctx *fiber.Ctx) []attribute.KeyValue) Option
- func WithMeterProvider(provider otelmetric.MeterProvider) Option
- func WithNext(f func(ctx *fiber.Ctx) bool) Option
- func WithPort(port int) Option
- func WithPropagators(propagators propagation.TextMapPropagator) Option
- func WithServerName(serverName string) Option
- func WithSpanNameFormatter(f func(ctx *fiber.Ctx) string) Option
- func WithTracerProvider(provider oteltrace.TracerProvider) Option
Constants ¶
const ( MetricNameHttpServerDuration = "http.server.duration" MetricNameHttpServerRequestSize = "http.server.request.size" MetricNameHttpServerResponseSize = "http.server.response.size" MetricNameHttpServerActiveRequests = "http.server.active_requests" // Unit constants for deprecated metric units UnitDimensionless = "1" UnitBytes = "By" UnitMilliseconds = "ms" )
Variables ¶
This section is empty.
Functions ¶
func HasBasicAuth ¶
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 WithCollectClientIP ¶ added in v2.1.0
WithCollectClientIP specifies whether to collect the client's IP address from the request. This is enabled by default.
func WithCustomAttributes ¶
WithCustomAttributes specifies a function that will be called on every request and the returned attributes will be added to the span.
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 WithNext ¶
WithNext takes a function that will be called on every request, the middleware will be skipped if returning true
func WithPort ¶
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 ¶
WithServerName specifies the value to use when setting the `http.server_name` attribute on metrics/spans.
func WithSpanNameFormatter ¶
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.