otel

package
v0.0.0-...-a9d0937 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 21 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContextWithW3CTraceContext

func NewContextWithW3CTraceContext(ctx context.Context, data map[string]string) context.Context

NewContextWithW3CTraceContext takes a W3C Trace Context that has, for example, been embedded into a Protobuf message and returns a new Context that uses the W3C Trace Context.

func NewGRPCOTLPTraceClient

func NewGRPCOTLPTraceClient(conn grpc.ClientConnInterface) otlptrace.Client

NewGRPCOTLPTraceClient creates OTLP trace client that is backed by a gRPC connnection. This function is similar to otlptracegrpc's NewClient(), except that the gRPC client can be injected. This allows the existing gRPC client configuration messages to be reused for OpenTelemetry.

func NewKeyValueListFromProto

func NewKeyValueListFromProto(inList []*v1.KeyValue, keyPrefix string) ([]attribute.KeyValue, error)

NewKeyValueListFromProto creates a list of attribute key-value pairs from the Protobuf message that's used by OpenTelemetry's gRPC wire format. The OpenTelemetry SDK for Go does not provide any publicly usable utility functions for this.

func NewMaximumRateSampler

func NewMaximumRateSampler(clock clock.Clock, samplesPerEpoch int, epochDuration time.Duration) sdk_trace.Sampler

NewMaximumRateSampler creates an OpenTelemetry Sampler that only permits sampling traces according to a maximum rate. This ensures that the amount of traffic sent to the tracing infrastructure remains bounded.

func W3CTraceContextFromContext

func W3CTraceContextFromContext(ctx context.Context) map[string]string

W3CTraceContextFromContext extracts the W3C Trace Context headers out of the current Context and returns them as a plain map of strings. This can, for example, be used to embed the W3C Trace Context into a Protobuf message.

This method is useful in case tracing needs to continue across processes, even if RPCs flow in mixed directions. For example, to make tracing work from clients all the way to workers, the scheduler needs to propagate the trace context. Because workers send RPCs to the scheduler (not the other way around), the W3C Trace Context cannot be forwarded by the OpenTelemetry gRPC middleware. It needs to be embedded into the scheduler response explicitly.

Types

type ActiveSpansReportingHTTPHandler

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

ActiveSpansReportingHTTPHandler is a HTTP handler that can generate a single page that lists all of the OpenTelemetry spans that have not been ended, or contain one or more transitive children that have not been ended.

func NewActiveSpansReportingHTTPHandler

func NewActiveSpansReportingHTTPHandler(clock clock.Clock) *ActiveSpansReportingHTTPHandler

NewActiveSpansReportingHTTPHandler creates a HTTP handler that can generate a single page that lists all active OpenTelemetry spans.

func (*ActiveSpansReportingHTTPHandler) NewTracerProvider

NewTracerProvider decorates an OpenTelemetry TracerProvider in such a way that all spans created through it are shown on the web page emitted by ServeHTTP().

func (*ActiveSpansReportingHTTPHandler) ServeHTTP

Jump to

Keyboard shortcuts

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