trace

package
v0.0.0-...-58b8290 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: MIT Imports: 13 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(serverName string, opts ...HTTPMiddlewareOption) func(next http.Handler) http.Handler

Middleware sets up a handler to start tracing the incoming requests. The serverName parameter should describe the name of the (virtual) server handling the request.

func SpanContext

func SpanContext(ctx context.Context, methodName string) (context.Context, trace.Span)

SpanContext helps create custom spans given the context and the method name it returns a context and the given span object

Types

type HTTPMiddlewareOption

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

HTTPMiddlewareOption specifies instrumentation configuration options.

func WithPropagators

func WithPropagators(propagators propagation.TextMapPropagator) HTTPMiddlewareOption

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

func WithTracerProvider

func WithTracerProvider(provider oteltrace.TracerProvider) HTTPMiddlewareOption

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

type Provider

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

Provider is a wrapper around the open telemetry tracer.Provider It helps initialize an OTLP exporter, and configures the corresponding trace provider

func NewProvider

func NewProvider(exporterEndPoint, serviceName string) *Provider

NewProvider creates a new instance of TraceProvider

func (*Provider) Start

func (p *Provider) Start(ctx context.Context) error

Start initializes an OTLP exporter, and configures the corresponding trace provider

func (*Provider) Stop

func (p *Provider) Stop(ctx context.Context) error

Stop will flush any remaining spans and shut down the exporter.

Jump to

Keyboard shortcuts

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