Documentation ¶
Overview ¶
Package trace gives access to the global OpenTelemetry tracer configured internally.
Index ¶
- type Span
- func (s *Span) AddEvent(name string)
- func (s *Span) Context() trace.SpanContext
- func (s *Span) End()
- func (s *Span) RecordError(msg string, err error)
- func (s *Span) SetBoolAttribute(key string, value bool)
- func (s *Span) SetFloatAttribute(key string, value float64)
- func (s *Span) SetIntAttribute(key string, value int64)
- func (s *Span) SetSliceStringAttribute(key string, values []string)
- func (s *Span) SetStringAttribute(key string, value string)
- type SpanKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Span ¶
type Span struct {
// contains filtered or unexported fields
}
Span is the individual component of a Trace. It represents a single named and timed operation of a workflow that is traced. A tracer is used to create a Span and it is then up to the operation the Span represents to properly end the Span when the operation itself ends.
func Start ¶
Start creates a Span and a context containing the newly-created Span.
If the context provided contains a Span then the newly-created Span will be a child of that Span, otherwise it will be a root Span.
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.
func (*Span) Context ¶
func (s *Span) Context() trace.SpanContext
Context returns the original OpenTelemetry span's context.
func (*Span) End ¶
func (s *Span) End()
End sets the appropriate status and 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 (*Span) RecordError ¶
RecordError will record the error as an exception span event for this Span.
func (*Span) SetBoolAttribute ¶
SetBoolAttribute sets a boolean attribute to the span.
func (*Span) SetFloatAttribute ¶
SetFloatAttribute sets a float attribute to the span.
func (*Span) SetIntAttribute ¶
SetIntAttribute sets a integer attribute to the span.
func (*Span) SetSliceStringAttribute ¶
SetSliceStringAttribute sets a slice of string attributes to the span.
func (*Span) SetStringAttribute ¶
SetStringAttribute sets a string attribute to the span.
type SpanKind ¶
type SpanKind int
SpanKind is the role a Span plays in a Trace.
const SpanKindClient SpanKind = 3
SpanKindClient is a SpanKind for a Span that represents the operation of client making a request to a server.
const SpanKindConsumer SpanKind = 5
SpanKindConsumer is a SpanKind for a Span that represents the operation of a consumer receiving a message from a message broker. Like SpanKindProducer Spans, there is often no direct relationship between this Span and the Span that produced the message.
const SpanKindInternal SpanKind = 1
SpanKindInternal is a SpanKind for a Span that represents an internal operation within an application.
const SpanKindProducer SpanKind = 4
SpanKindProducer is a SpanKind for a Span that represents the operation of a producer sending a message to a message broker. Unlike SpanKindClient and SpanKindServer, there is often no direct relationship between this kind of Span and a SpanKindConsumer kind. A SpanKindProducer Span will end once the message is accepted by the message broker which might not overlap with the processing of that message.
const SpanKindServer SpanKind = 2
SpanKindServer is a SpanKind for a Span that represents the operation of handling a request from a client.