tracing

package
v0.0.0-...-98cd694 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Unlicense Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewNoopTracerProvider = func() TracerProvider {
	return &noopTracerProvider{}
}

NewNoopTracerProvider is a shadow for opentelemetry's NewNoopTracerProvider.

View Source
var (
	ProvidersTracing = wire.NewSet(
		BuildTracedHTTPClient,
	)
)

Functions

func AttachErrorToSpan

func AttachErrorToSpan(span trace.Span, description string, err error)

AttachErrorToSpan attaches a given error to a span.

func AttachFilterDataToSpan

func AttachFilterDataToSpan(span trace.Span, page *uint16, limit *uint8, sortBy *string)

AttachFilterDataToSpan provides a consistent way to attach a filter's info to a span.

func AttachQueryFilterToSpan

func AttachQueryFilterToSpan(span trace.Span, filter *types.QueryFilter)

AttachQueryFilterToSpan attaches a given query filter to a span.

func AttachRequestToSpan

func AttachRequestToSpan(span trace.Span, req *http.Request)

AttachRequestToSpan attaches a given HTTP request to a span.

func AttachResponseToSpan

func AttachResponseToSpan(span trace.Span, res *http.Response)

AttachResponseToSpan attaches a given *http.Response to a span.

func AttachSessionContextDataToSpan

func AttachSessionContextDataToSpan(span trace.Span, sessionCtxData *types.SessionContextData)

AttachSessionContextDataToSpan provides a consistent way to attach a SessionContextData object to a span.

func AttachToSpan

func AttachToSpan[T any](span trace.Span, attachmentKey string, x T)

func AttachUserAgentDataToSpan

func AttachUserAgentDataToSpan(span trace.Span, req *http.Request)

AttachUserAgentDataToSpan attaches a given search query to a span.

func AttachUserToSpan

func AttachUserToSpan(span trace.Span, user *types.User)

AttachUserToSpan provides a consistent way to attach a user to a span.

func BuildTracedHTTPClient

func BuildTracedHTTPClient() *http.Client

BuildTracedHTTPClient returns a tracing-enabled HTTP client.

func BuildTracedHTTPTransport

func BuildTracedHTTPTransport(timeout time.Duration) http.RoundTripper

BuildTracedHTTPTransport constructs a new http.Transport.

func FormatSpan

func FormatSpan(operation string, req *http.Request) string

FormatSpan formats a span.

func GetCallerName

func GetCallerName() string

GetCallerName is largely (and respectfully) inspired by/copied from https://stackoverflow.com/a/35213181

func NewInstrumentedSQLLogger

func NewInstrumentedSQLLogger(logger logging.Logger) instrumentedsql.Logger

NewInstrumentedSQLLogger wraps a logging.Logger for instrumentedsql.

func NewInstrumentedSQLTracer

func NewInstrumentedSQLTracer(tracerProvider TracerProvider, name string) instrumentedsql.Tracer

NewInstrumentedSQLTracer wraps a Tracer for instrumentedsql.

func StartCustomSpan

func StartCustomSpan(ctx context.Context, name string) (context.Context, trace.Span)

StartCustomSpan starts an anonymous custom span.

func StartSpan

func StartSpan(ctx context.Context) (context.Context, trace.Span)

StartSpan starts an anonymous span.

Types

type Span

type Span trace.Span

Span is a simple alias for the OpenTelemetry span interface.

type Tracer

type Tracer interface {
	StartSpan(ctx context.Context) (context.Context, Span)
	StartCustomSpan(ctx context.Context, name string, opts ...trace.SpanStartOption) (context.Context, Span)
}

Tracer describes a tracer.

func NewTracer

func NewTracer(t trace.Tracer) Tracer

NewTracer creates a Tracer.

func NewTracerForTest

func NewTracerForTest(name string) Tracer

NewTracerForTest creates a Tracer.

type TracerProvider

type TracerProvider interface {
	trace.TracerProvider
	ForceFlush(ctx context.Context) error
}

TracerProvider is a simple alias for trace.TracerProvider.

func EnsureTracerProvider

func EnsureTracerProvider(tracerProvider TracerProvider) TracerProvider

Directories

Path Synopsis
Package cloudtrace provides common functions for attaching values to trace spans
Package cloudtrace provides common functions for attaching values to trace spans
Package oteltracehttp provides common functions for attaching values to trace spans
Package oteltracehttp provides common functions for attaching values to trace spans

Jump to

Keyboard shortcuts

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