ottlspan

package
v0.99.0 Latest Latest
Warning

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

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

README

Span Context

The Span Context is a Context implementation for pdata Spans, the collector's internal representation for OTLP span data. This Context should be used when interacted with OTLP spans.

Paths

In general, the Span Context supports accessing pdata using the field names from the traces proto. All integers are returned and set via int64. All doubles are returned and set via float64.

All TraceIDs and SpanIDs are returned as pdata SpanID and TraceID types. Use the SpanID function and TraceID function when interacting with pdata representations of SpanID and TraceID. When checking for nil, instead check against an empty byte slice (SpanID(0x0000000000000000) and TraceID(0x00000000000000000000000000000000)).

The following paths are supported.

path field accessed type
cache the value of the current transform context's temporary cache. cache can be used as a temporary placeholder for data during complex transformations pcommon.Map
cache[""] the value of an item in cache. Supports multiple indexes to access nested fields. string, bool, int64, float64, pcommon.Map, pcommon.Slice, []byte or nil
resource resource of the span being processed pcommon.Resource
resource.attributes resource attributes of the span being processed pcommon.Map
resource.attributes[""] the value of the resource attribute of the span being processed. Supports multiple indexes to access nested fields. string, bool, int64, float64, pcommon.Map, pcommon.Slice, []byte or nil
resource.dropped_attributes_count number of dropped attributes of the resource of the span being processed int64
instrumentation_scope instrumentation scope of the span being processed pcommon.InstrumentationScope
instrumentation_scope.name name of the instrumentation scope of the span being processed string
instrumentation_scope.version version of the instrumentation scope of the span being processed string
instrumentation_scope.dropped_attributes_count number of dropped attributes of the instrumentation scope of the span being processed int64
instrumentation_scope.attributes instrumentation scope attributes of the span being processed pcommon.Map
instrumentation_scope.attributes[""] the value of the instrumentation scope attribute of the span being processed. Supports multiple indexes to access nested fields. string, bool, int64, float64, pcommon.Map, pcommon.Slice, []byte or nil
attributes attributes of the span being processed pcommon.Map
attributes[""] the value of the attribute of the span being processed. Supports multiple indexes to access nested fields. string, bool, int64, float64, pcommon.Map, pcommon.Slice, []byte or nil
trace_id a byte slice representation of the trace id pcommon.TraceID
trace_id.string a string representation of the trace id string
span_id a byte slice representation of the span id pcommon.SpanID
span_id.string a string representation of the span id string
parent_span_id a byte slice representation of the parent span id pcommon.SpanID
parent_span_id.string a string representation of the parent span id string
trace_state the trace state of the current span string
trace_state[""] an individual entry in the trace state string
status the status of the span being processed ptrace.Status
status.code the status code of the span being processed int64
status.message the status message of the span being processed string
name the name of the span string
kind the kind of the span int64
kind.string the kind of the span in string format. Valid values are Unspecified, Internal, Server, Client, Producer, and Consumer. When setting, if an invalid value is used Unspecified will be set. string
kind.deprecated_string the kind of the span in deprecated string format. Valid values are SPAN_KIND_UNSPECIFIED, SPAN_KIND_INTERNAL, SPAN_KIND_SERVER, SPAN_KIND_CLIENT, SPAN_KIND_PRODUCER, and SPAN_KIND_CONSUMER. When setting, if an invalid value is used SPAN_KIND_UNSPECIFIED will be set. This accessor will eventually be removed, use kind or kind.string instead. string
start_time_unix_nano the start time in unix nano of the span int64
end_time_unix_nano the end time in unix nano of the span int64
start_time the start time in time.Time of the span time.Time
end_time the end time in time.Time of the span time.Time
dropped_attributes_count the dropped attributes count of the span int64
events the events of the span ptrace.SpanEventSlice
dropped_events_count the dropped events count of the span int64
links the links of the span ptrace.SpanLinkSlice
dropped_links_count the dropped links count of the span int64

Enums

The Span Context supports the enum names from the traces proto.

Enum Symbol Value
SPAN_KIND_UNSPECIFIED 0
SPAN_KIND_INTERNAL 1
SPAN_KIND_SERVER 2
SPAN_KIND_CLIENT 3
SPAN_KIND_PRODUCER 4
SPAN_KIND_CONSUMER 5
STATUS_CODE_UNSET 0
STATUS_CODE_OK 1
STATUS_CODE_ERROR 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConditionSequence added in v0.91.0

func NewConditionSequence(conditions []*ottl.Condition[TransformContext], telemetrySettings component.TelemetrySettings, options ...ConditionSequenceOption) ottl.ConditionSequence[TransformContext]

func NewParser

func NewParser(functions map[string]ottl.Factory[TransformContext], telemetrySettings component.TelemetrySettings, options ...Option) (ottl.Parser[TransformContext], error)

func NewStatementSequence added in v0.91.0

func NewStatementSequence(statements []*ottl.Statement[TransformContext], telemetrySettings component.TelemetrySettings, options ...StatementSequenceOption) ottl.StatementSequence[TransformContext]

Types

type ConditionSequenceOption added in v0.91.0

type ConditionSequenceOption func(*ottl.ConditionSequence[TransformContext])

func WithConditionSequenceErrorMode added in v0.91.0

func WithConditionSequenceErrorMode(errorMode ottl.ErrorMode) ConditionSequenceOption

type Option added in v0.70.0

type Option func(*ottl.Parser[TransformContext])

type StatementSequenceOption added in v0.91.0

type StatementSequenceOption func(*ottl.StatementSequence[TransformContext])

func WithStatementSequenceErrorMode added in v0.91.0

func WithStatementSequenceErrorMode(errorMode ottl.ErrorMode) StatementSequenceOption

type TransformContext

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

func NewTransformContext

func NewTransformContext(span ptrace.Span, instrumentationScope pcommon.InstrumentationScope, resource pcommon.Resource) TransformContext

func (TransformContext) GetInstrumentationScope

func (tCtx TransformContext) GetInstrumentationScope() pcommon.InstrumentationScope

func (TransformContext) GetResource

func (tCtx TransformContext) GetResource() pcommon.Resource

func (TransformContext) GetSpan

func (tCtx TransformContext) GetSpan() ptrace.Span

Jump to

Keyboard shortcuts

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