otel

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: BSD-3-Clause Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Instrument

func Instrument(
	ctx context.Context,
	serviceName,
	serviceVersion string,
	runtimeMetrics bool,
) (func(context.Context) error, error)

Instrument bootstraps the OpenTelemetry pipeline. If it does not return an error, make sure to call shutdown for proper cleanup.

func MetricsMiddleware added in v1.4.0

func MetricsMiddleware(metrics *StdHTTPMetrics, next http.Handler) http.Handler

func TracingMiddleware added in v1.4.0

func TracingMiddleware(scopeName, version string, next http.Handler) http.Handler

TracingMiddleware returns an HTTP middleware that adds an OpenTelemetry trace to the request context.

Types

type StdHTTPMetrics added in v1.4.0

type StdHTTPMetrics struct {
	// contains filtered or unexported fields
}

func StandardHTTPMetrics added in v1.4.0

func StandardHTTPMetrics(prefix, version string) (*StdHTTPMetrics, error)

func (*StdHTTPMetrics) Bump added in v1.4.0

func (s *StdHTTPMetrics) Bump(
	ctx context.Context,
	responseWrapper http.ResponseWriter,
	bodyWrapper *response.BodyWrapper,
	req *http.Request,
	duration time.Duration,
	attributes ...attribute.KeyValue,
)

Jump to

Keyboard shortcuts

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