otelecho

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package otelecho provides OpenTelemetry instrumentation for the labstack/echo package.

This package wraps the upstream OpenTelemetry contrib package (go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho) and adds custom functionality:

  • Zerolog logging of trace IDs
  • Setting X-Ngc-Trace-Id header
  • Storing tracer in context for use by other packages

The upstream package is used directly as a dependency instead of copying the code to avoid Apache license issues and to benefit from upstream updates and fixes.

Note: The upstream package's go.mod contains a replace directive for the b3 propagator, but this is resolved automatically by Go's module system when using the package as a dependency. The replace directive is ignored for dependencies and only affects builds within the upstream repository itself.

Index

Constants

View Source
const (
	// TracerKey is a key for current tracer
	TracerKey = "otel-go-contrib-tracer-labstack-echo"

	// TracerName is name of the tracer
	TracerName = "go.opentelemetry.io/contrib/instrumentation/github.com/labstack/echo/otelecho"

	// TraceHdr is header name for ngc trace id
	TraceHdr = "X-Ngc-Trace-Id"
)

Variables

View Source
var (
	WithPropagators    = upstreamotelecho.WithPropagators
	WithTracerProvider = upstreamotelecho.WithTracerProvider
	WithSkipper        = upstreamotelecho.WithSkipper
)

Functions

func Middleware

func Middleware(service string, opts ...upstreamotelecho.Option) echo.MiddlewareFunc

Middleware wraps the upstream otelecho middleware and adds custom functionality: - Zerolog logging of trace IDs (from extracted context before span creation) - Setting X-Ngc-Trace-Id header - Storing tracer in context for use by other packages

Types

type Option

type Option = upstreamotelecho.Option

Re-export types and functions from upstream

Jump to

Keyboard shortcuts

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