ottlspanevent

package
v0.120.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: Apache-2.0 Imports: 11 Imported by: 6

README

Span Event Context

[!NOTE] This documentation applies only to version 0.120.0 and later. For information on earlier versions, please refer to the previous documentation.

The Span Event Context is a Context implementation for pdata SpanEvents, the Collector's internal representation for OTLP Span Event data. This Context should be used when interacting with individual OTLP Span Events.

Paths

In general, the Span Event 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.

The following paths are supported.

path field accessed type
spanevent.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
spanevent.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 event being processed pcommon.Resource
resource.attributes resource attributes of the span event being processed pcommon.Map
resource.attributes[""] the value of the resource attribute of the span event being processed. Supports multiple indexes to access nested fields. string, bool, int64, float64, pcommon.Map, pcommon.Slice, []byte or nil
instrumentation_scope instrumentation scope of the span event being processed pcommon.InstrumentationScope
instrumentation_scope.name name of the instrumentation scope of the span event being processed string
instrumentation_scope.version version of the instrumentation scope of the span event being processed string
instrumentation_scope.attributes instrumentation scope attributes of the span event being processed pcommon.Map
instrumentation_scope.attributes[""] the value of the instrumentation scope attribute of the span event being processed. Supports multiple indexes to access nested fields. string, bool, int64, float64, pcommon.Map, pcommon.Slice, []byte or nil
span span of the span event being processed ptrace.Span
span.* All fields exposed by the ottlspan context can accessed via span. varies
spanevent.attributes attributes of the span event being processed pcommon.Map
spanevent.attributes[""] the value of the attribute of the span event being processed. Supports multiple indexes to access nested fields. string, bool, int64, float64, pcommon.Map, pcommon.Slice, []byte or nil
spanevent.time_unix_nano time_unix_nano of the span event being processed int64
spanevent.time time of the span event being processed time.Time
spanevent.name name of the span event being processed string
spanevent.dropped_attributes_count dropped_attributes_count of the span event being processed int64

Enums

The Span Event 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

View Source
const (
	// Experimental: *NOTE* this constant is subject to change or removal in the future.
	ContextName = "spanevent"
)

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])

func EnablePathContextNames added in v0.117.0

func EnablePathContextNames() Option

EnablePathContextNames enables the support to path's context names on statements. When this option is configured, all statement's paths must have a valid context prefix, otherwise an error is reported.

Experimental: *NOTE* this option is subject to change or removal in the future.

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(spanEvent ptrace.SpanEvent, span ptrace.Span, instrumentationScope pcommon.InstrumentationScope, resource pcommon.Resource, scopeSpans ptrace.ScopeSpans, resourceSpans ptrace.ResourceSpans, options ...TransformContextOption) TransformContext

func (TransformContext) GetInstrumentationScope

func (tCtx TransformContext) GetInstrumentationScope() pcommon.InstrumentationScope

func (TransformContext) GetResource

func (tCtx TransformContext) GetResource() pcommon.Resource

func (TransformContext) GetResourceSchemaURLItem added in v0.104.0

func (tCtx TransformContext) GetResourceSchemaURLItem() internal.SchemaURLItem

func (TransformContext) GetScopeSchemaURLItem added in v0.104.0

func (tCtx TransformContext) GetScopeSchemaURLItem() internal.SchemaURLItem

func (TransformContext) GetSpan

func (tCtx TransformContext) GetSpan() ptrace.Span

func (TransformContext) GetSpanEvent

func (tCtx TransformContext) GetSpanEvent() ptrace.SpanEvent

func (TransformContext) MarshalLogObject added in v0.103.0

func (tCtx TransformContext) MarshalLogObject(encoder zapcore.ObjectEncoder) error

type TransformContextOption added in v0.118.0

type TransformContextOption func(*TransformContext)

func WithCache added in v0.118.0

func WithCache(cache *pcommon.Map) TransformContextOption

Experimental: *NOTE* this option is subject to change or removal in the future.

Jump to

Keyboard shortcuts

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