otelx

package
v0.0.0-...-7bfe5c1 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientUnary

func ClientUnary() grpc.UnaryClientInterceptor

ClientUnary adds spans + propagation for outbound gRPC.

func Middleware

func Middleware(service string, l *logger.Loggerx) func(http.Handler) http.Handler

Middleware wraps handlers with otelhttp and injects trace_id into ctx for logger.

func ServerUnary

func ServerUnary(l *logger.Loggerx) grpc.UnaryServerInterceptor

ServerUnary returns an interceptor that both creates spans and injects trace_id for logger.

func Start

func Start(ctx context.Context, opt Options) (func(context.Context) error, error)

func Transport

func Transport(base http.RoundTripper) http.RoundTripper

Transport wraps any RoundTripper so outbound HTTP gets spans + propagation.

Types

type Options

type Options struct {
	ServiceName  string  // required
	Environment  string  // e.g., "development" | "production"
	OTLPEndpoint string  // e.g., http://otel-collector:4318
	SampleRatio  float64 // 0..1 (default 1 in dev, 0.1 in prod if zero)
}

Jump to

Keyboard shortcuts

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