Documentation ¶
Index ¶
- type CountGenerator
- type Event
- type Generator
- type Span
- func (s *Span) AddEvent(ctx context.Context, name string, attrs ...kv.KeyValue)
- func (s *Span) AddEventWithTimestamp(ctx context.Context, timestamp time.Time, name string, attrs ...kv.KeyValue)
- func (s *Span) Attributes() map[kv.Key]value.Value
- func (s *Span) End(opts ...trace.EndOption)
- func (s *Span) EndTime() (time.Time, bool)
- func (s *Span) Ended() bool
- func (s *Span) Events() []Event
- func (s *Span) IsRecording() bool
- func (s *Span) Links() map[trace.SpanContext][]kv.KeyValue
- func (s *Span) Name() string
- func (s *Span) ParentSpanID() trace.SpanID
- func (s *Span) RecordError(ctx context.Context, err error, opts ...trace.ErrorOption)
- func (s *Span) SetAttribute(k string, v interface{})
- func (s *Span) SetAttributes(attrs ...kv.KeyValue)
- func (s *Span) SetName(name string)
- func (s *Span) SetStatus(code codes.Code, msg string)
- func (s *Span) SpanContext() trace.SpanContext
- func (s *Span) StartTime() time.Time
- func (s *Span) StatusCode() codes.Code
- func (s *Span) StatusMessage() string
- func (s *Span) Tracer() trace.Tracer
- type Tracer
- type TracerOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CountGenerator ¶
type CountGenerator struct {
// contains filtered or unexported fields
}
CountGenerator is a simple Generator that can be used to create unique, albeit deterministic, trace and span IDs.
func NewCountGenerator ¶
func NewCountGenerator() *CountGenerator
func (*CountGenerator) SpanID ¶
func (g *CountGenerator) SpanID() trace.SpanID
func (*CountGenerator) TraceID ¶
func (g *CountGenerator) TraceID() trace.ID
type Span ¶
type Span struct {
// contains filtered or unexported fields
}
func (*Span) AddEventWithTimestamp ¶
func (*Span) Attributes ¶
Attributes returns the attributes set on the Span, either at or after creation time. If the same attribute key was set multiple times, the last call will be used. Attributes cannot be changed after End has been called on the Span.
func (*Span) EndTime ¶
EndTime returns the time at which the Span was ended if at has been ended, or false otherwise. If the span has been ended, the returned time will be the wall-clock time unless a specific end time was provided.
func (*Span) Ended ¶
Ended returns whether the Span has been ended, i.e., whether End has been called at least once on the Span.
func (*Span) Events ¶
Events returns the events set on the Span. Events cannot be changed after End has been called on the Span.
func (*Span) IsRecording ¶
func (*Span) Links ¶
func (s *Span) Links() map[trace.SpanContext][]kv.KeyValue
Links returns the links set on the Span at creation time. If multiple links for the same SpanContext were set, the last link will be used.
func (*Span) Name ¶
Name returns the name most recently set on the Span, either at or after creation time. It cannot be change after End has been called on the Span.
func (*Span) ParentSpanID ¶
ParentSpanID returns the SpanID of the parent Span. If the Span is a root Span and therefore does not have a parent, the returned SpanID will be invalid (i.e., it will contain all zeroes).
func (*Span) RecordError ¶ added in v0.2.3
func (*Span) SetAttribute ¶ added in v0.5.0
func (*Span) SetAttributes ¶
func (*Span) SpanContext ¶
func (s *Span) SpanContext() trace.SpanContext
func (*Span) StartTime ¶
StartTime returns the time at which the Span was started. This will be the wall-clock time unless a specific start time was provided.
func (*Span) StatusCode ¶ added in v0.3.0
Status returns the status most recently set on the Span, or codes.OK if no status has been explicitly set. It cannot be changed after End has been called on the Span.
func (*Span) StatusMessage ¶ added in v0.3.0
StatusMessage returns the status message most recently set on the Span or the empty string if no status mesaage was set.
type Tracer ¶
type Tracer struct {
// contains filtered or unexported fields
}
Tracer is a type of OpenTelemetry Tracer that tracks both active and ended spans, and which creates Spans that may be inspected to see what data has been set on them.
func NewTracer ¶
func NewTracer(opts ...TracerOption) *Tracer
type TracerOption ¶
type TracerOption func(*tracerConfig)
TracerOption enables configuration of a new Tracer.
func TracerWithGenerator ¶
func TracerWithGenerator(generator Generator) TracerOption
TracerWithGenerator enables customization of the Generator that the Tracer will use to create new trace and span IDs. By default, new Tracers will use the CountGenerator.