objmodel

package
v0.116.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

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

Document is an intermediate representation for converting open telemetry records with arbitrary attributes into a JSON document that can be processed by Elasticsearch.

func DocumentFromAttributes

func DocumentFromAttributes(am pcommon.Map) Document

DocumentFromAttributes creates a document from a OpenTelemetry attribute map. All nested maps will be flattened, with keys being joined using a `.` symbol.

func DocumentFromAttributesWithPath

func DocumentFromAttributesWithPath(path string, am pcommon.Map) Document

DocumentFromAttributesWithPath creates a document from a OpenTelemetry attribute map. All nested maps will be flattened, with keys being joined using a `.` symbol.

All keys in the map will be prefixed with path.

func (*Document) Add

func (doc *Document) Add(key string, v Value)

Add adds a converted value to the document.

func (*Document) AddAttribute

func (doc *Document) AddAttribute(key string, attribute pcommon.Value)

AddAttribute converts and adds a AttributeValue to the document. If the attribute represents a map, the fields will be flattened.

func (*Document) AddAttributes

func (doc *Document) AddAttributes(key string, attributes pcommon.Map)

AddAttributes expands and flattens all key-value pairs from the input attribute map into the document.

func (*Document) AddDynamicTemplate added in v0.108.0

func (doc *Document) AddDynamicTemplate(path, template string)

func (*Document) AddEvents added in v0.78.0

func (doc *Document) AddEvents(key string, events ptrace.SpanEventSlice)

AddEvents converts and adds span events to the document.

func (*Document) AddInt

func (doc *Document) AddInt(key string, value int64)

AddInt adds an integer value to the document.

func (*Document) AddSpanID added in v0.65.0

func (doc *Document) AddSpanID(key string, id pcommon.SpanID)

AddSpanID adds the hex presentation of a SpanID to the document. If the SpanID is empty, no value will be added.

func (*Document) AddString

func (doc *Document) AddString(key string, v string)

AddString adds a string to the document.

func (*Document) AddTimestamp

func (doc *Document) AddTimestamp(key string, ts pcommon.Timestamp)

AddTimestamp adds a raw timestamp value to the Document.

func (*Document) AddTraceID added in v0.65.0

func (doc *Document) AddTraceID(key string, id pcommon.TraceID)

AddTraceID adds the hex presentation of a TraceID value to the document. If the TraceID is empty, no value will be added.

func (*Document) AddUInt added in v0.116.0

func (doc *Document) AddUInt(key string, value uint64)

AddUInt adds an unsigned integer value to the document.

func (*Document) Clone added in v0.104.0

func (doc *Document) Clone() *Document

func (*Document) Dedup

func (doc *Document) Dedup(appendValueOnConflict bool)

Dedup removes fields from the document, that have duplicate keys. The filtering only keeps the last value for a key.

Dedup ensure that keys are sorted.

func (*Document) DynamicTemplates added in v0.108.0

func (doc *Document) DynamicTemplates() map[string]string

func (*Document) Serialize

func (doc *Document) Serialize(w io.Writer, dedot bool, otel bool) error

Serialize writes the document to the given writer. The serializer will create nested objects if dedot is true.

NOTE: The documented MUST be sorted if dedot is true.

type Kind

type Kind uint8

Kind represent the internal kind of a value stored in a Document.

const (
	KindNil Kind = iota
	KindBool
	KindInt
	KindUInt
	KindDouble
	KindString
	KindArr
	KindObject
	KindTimestamp
	KindIgnore
	KindUnflattenableObject // Unflattenable object is an object that should not be flattened at serialization time
)

Enum values for Kind.

type Value

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

Value type that can be added to a Document.

func ArrValue

func ArrValue(values ...Value) Value

ArrValue combines multiple values into an array value.

func BoolValue

func BoolValue(b bool) Value

BoolValue creates a new value from a double value..

func DoubleValue

func DoubleValue(d float64) Value

DoubleValue creates a new value from a double value..

func IntValue

func IntValue(i int64) Value

IntValue creates a new value from an integer.

func StringValue

func StringValue(str string) Value

StringValue create a new value from a string.

func TimestampValue

func TimestampValue(ts time.Time) Value

TimestampValue create a new value from a time.Time.

func UIntValue added in v0.116.0

func UIntValue(i uint64) Value

UIntValue creates a new value from an unsigned integer.

func UnflattenableObjectValue added in v0.108.0

func UnflattenableObjectValue(m pcommon.Map) Value

UnflattenableObjectValue creates a unflattenable object from a map

func ValueFromAttribute

func ValueFromAttribute(attr pcommon.Value) Value

ValueFromAttribute converts a AttributeValue into a value.

func (*Value) Dedup

func (v *Value) Dedup(appendValueOnConflict bool)

Dedup recursively dedups keys in stored documents.

NOTE: The value MUST be sorted.

func (*Value) IsEmpty added in v0.32.0

func (v *Value) IsEmpty() bool

Jump to

Keyboard shortcuts

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