tracing

package
v0.0.0-...-fbfa8e9 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BridgeOpenTracingToOtel

func BridgeOpenTracingToOtel(ctx context.Context) context.Context

BridgeOpenTracingToOtel wraps ctx so that Otel-using code can link to an OpenTracing span.

Types

type OpenTelemetryProviderBridge

type OpenTelemetryProviderBridge struct {
	// See https://pkg.go.dev/go.opentelemetry.io/otel/trace#hdr-API_Implementations.
	embedded.TracerProvider
	// contains filtered or unexported fields
}

func NewOpenTelemetryProviderBridge

func NewOpenTelemetryProviderBridge(tracer opentracing.Tracer) *OpenTelemetryProviderBridge

func (*OpenTelemetryProviderBridge) Tracer

Tracer creates an implementation of the Tracer interface. The instrumentationName must be the name of the library providing instrumentation. This name may be the same as the instrumented code only if that code provides built-in instrumentation. If the instrumentationName is empty, then a implementation defined default name will be used instead.

This method must be concurrency safe.

type OpenTelemetrySpanBridge

type OpenTelemetrySpanBridge struct {
	// See https://pkg.go.dev/go.opentelemetry.io/otel/trace#hdr-API_Implementations.
	embedded.Span
	// contains filtered or unexported fields
}

func NewOpenTelemetrySpanBridge

func NewOpenTelemetrySpanBridge(span opentracing.Span, provider trace.TracerProvider) *OpenTelemetrySpanBridge

func (*OpenTelemetrySpanBridge) AddEvent

func (s *OpenTelemetrySpanBridge) AddEvent(name string, options ...trace.EventOption)

AddEvent adds an event with the provided name and options.

func (s *OpenTelemetrySpanBridge) AddLink(_ trace.Link)

AddLink implements trace.Span.

func (*OpenTelemetrySpanBridge) End

func (s *OpenTelemetrySpanBridge) End(options ...trace.SpanEndOption)

End completes the Span. The Span is considered complete and ready to be delivered through the rest of the telemetry pipeline after this method is called. Therefore, updates to the Span are not allowed after this method has been called.

func (*OpenTelemetrySpanBridge) IsRecording

func (s *OpenTelemetrySpanBridge) IsRecording() bool

IsRecording returns the recording state of the Span. It will return true if the Span is active and events can be recorded.

func (*OpenTelemetrySpanBridge) RecordError

func (s *OpenTelemetrySpanBridge) RecordError(err error, options ...trace.EventOption)

RecordError will record err as an exception span event for this span. An additional call to SetStatus is required if the Status of the Span should be set to Error, as this method does not change the Span status. If this span is not being recorded or err is nil then this method does nothing.

func (*OpenTelemetrySpanBridge) SetAttributes

func (s *OpenTelemetrySpanBridge) SetAttributes(kv ...attribute.KeyValue)

SetAttributes sets kv as attributes of the Span. If a key from kv already exists for an attribute of the Span it will be overwritten with the value contained in kv.

func (*OpenTelemetrySpanBridge) SetName

func (s *OpenTelemetrySpanBridge) SetName(name string)

SetName sets the Span name.

func (*OpenTelemetrySpanBridge) SetStatus

func (s *OpenTelemetrySpanBridge) SetStatus(code codes.Code, description string)

SetStatus sets the status of the Span in the form of a code and a description, overriding previous values set. The description is only included in a status when the code is for an error.

func (*OpenTelemetrySpanBridge) SpanContext

func (s *OpenTelemetrySpanBridge) SpanContext() trace.SpanContext

SpanContext returns the SpanContext of the Span. The returned SpanContext is usable even after the End method has been called for the Span.

func (*OpenTelemetrySpanBridge) TracerProvider

func (s *OpenTelemetrySpanBridge) TracerProvider() trace.TracerProvider

TracerProvider returns a TracerProvider that can be used to generate additional Spans on the same telemetry pipeline as the current Span.

type OpenTelemetryTracerBridge

type OpenTelemetryTracerBridge struct {
	// See https://pkg.go.dev/go.opentelemetry.io/otel/trace#hdr-API_Implementations.
	embedded.Tracer
	// contains filtered or unexported fields
}

func NewOpenTelemetryTracerBridge

func NewOpenTelemetryTracerBridge(tracer opentracing.Tracer, provider trace.TracerProvider) *OpenTelemetryTracerBridge

func (*OpenTelemetryTracerBridge) Start

Start creates a span and a context.Context containing the newly-created span.

If the context.Context provided in `ctx` contains a Span then the newly-created Span will be a child of that span, otherwise it will be a root span. This behavior can be overridden by providing `WithNewRoot()` as a SpanOption, causing the newly-created Span to be a root span even if `ctx` contains a Span.

When creating a Span it is recommended to provide all known span attributes using the `WithAttributes()` SpanOption as samplers will only have access to the attributes provided when a Span is created.

Any Span that is created MUST also be ended. This is the responsibility of the user. Implementations of this API may leak memory or other resources if Spans are not ended.

Jump to

Keyboard shortcuts

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