internal

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MessageSendEvent is the name of the message send event.
	MessageSendEvent = "message send"
	// MessageReceiveEvent is the name of the message receive event.
	MessageReceiveEvent = "message receive"
)

Variables

View Source
var (
	// UncompressedKey is used for the uncompressed byte size attribute.
	UncompressedKey = attribute.Key("uncompressed byte size")
	// CompressedKey is used for the compressed byte size attribute.
	CompressedKey = attribute.Key("compressed byte size")
)
View Source
var Handle = otel.Handle

Handle is the package level function to handle errors. It can be overwritten for testing.

Functions

func NewSpan

func NewSpan(s trace.Span) *octrace.Span

NewSpan returns an OpenCensus Span wrapping an OpenTelemetry Span.

func NewTracer

func NewTracer(tracer trace.Tracer) octrace.Tracer

NewTracer returns an OpenCensus Tracer that wraps the OpenTelemetry tracer.

Types

type Span

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

Span is an OpenCensus SpanInterface wrapper for an OpenTelemetry Span.

func (*Span) AddAttributes

func (s *Span) AddAttributes(attributes ...octrace.Attribute)

AddAttributes sets attributes in this span.

func (s *Span) AddLink(l octrace.Link)

AddLink adds a link to this span. This drops the OpenCensus LinkType because there is no such concept in OpenTelemetry.

func (*Span) AddMessageReceiveEvent

func (s *Span) AddMessageReceiveEvent(messageID, uncompressedByteSize, compressedByteSize int64)

AddMessageReceiveEvent adds a message receive event to this span.

func (*Span) AddMessageSendEvent

func (s *Span) AddMessageSendEvent(messageID, uncompressedByteSize, compressedByteSize int64)

AddMessageSendEvent adds a message send event to this span.

func (*Span) Annotate

func (s *Span) Annotate(attributes []octrace.Attribute, str string)

Annotate adds an annotation with attributes to this span.

func (*Span) Annotatef

func (s *Span) Annotatef(attributes []octrace.Attribute, format string, a ...interface{})

Annotatef adds a formatted annotation with attributes to this span.

func (*Span) End

func (s *Span) End()

End ends this span.

func (*Span) IsRecordingEvents

func (s *Span) IsRecordingEvents() bool

IsRecordingEvents returns true if events are being recorded for this span.

func (*Span) SetName

func (s *Span) SetName(name string)

SetName sets the name of this span, if it is recording events.

func (*Span) SetStatus

func (s *Span) SetStatus(status octrace.Status)

SetStatus sets the status of this span, if it is recording events.

func (*Span) SpanContext

func (s *Span) SpanContext() octrace.SpanContext

SpanContext returns the SpanContext of this span.

func (*Span) String

func (s *Span) String() string

String prints a string representation of this span.

type Tracer

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

Tracer is an OpenCensus Tracer that wraps an OpenTelemetry Tracer.

func (*Tracer) FromContext

func (o *Tracer) FromContext(ctx context.Context) *octrace.Span

FromContext returns the Span stored in a context.

func (*Tracer) NewContext

func (o *Tracer) NewContext(parent context.Context, s *octrace.Span) context.Context

NewContext returns a new context with the given Span attached.

func (*Tracer) StartSpan

func (o *Tracer) StartSpan(ctx context.Context, name string, s ...octrace.StartOption) (context.Context, *octrace.Span)

StartSpan starts a new child span of the current span in the context. If there is no span in the context, it creates a new trace and span.

func (*Tracer) StartSpanWithRemoteParent

func (o *Tracer) StartSpanWithRemoteParent(ctx context.Context, name string, parent octrace.SpanContext, s ...octrace.StartOption) (context.Context, *octrace.Span)

StartSpanWithRemoteParent starts a new child span of the span from the given parent.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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