objmodel

package
v0.93.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

nolint:errcheck

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 OpenSearch.

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

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

AddInt adds an integer value to the document.

func (*Document) AddSpanID

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

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

func (doc *Document) Dedup()

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

func (doc *Document) Serialize(w io.Writer, dedot 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.

func (*Document) Sort

func (doc *Document) Sort()

Sort sorts all fields in the document by key name.

type Kind

type Kind uint8

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

const (
	KindNil Kind = iota
	KindBool
	KindInt
	KindDouble
	KindString
	KindArr
	KindObject
	KindTimestamp
	KindIgnore
)

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 ValueFromAttribute

func ValueFromAttribute(attr pcommon.Value) Value

ValueFromAttribute converts a AttributeValue into a value.

func (*Value) Dedup

func (v *Value) Dedup()

Dedup recursively dedups keys in stored documents.

NOTE: The value MUST be sorted.

func (*Value) IsEmpty

func (v *Value) IsEmpty() bool

func (*Value) Sort

func (v *Value) Sort()

Sort recursively sorts all keys in documents held by the value.

Jump to

Keyboard shortcuts

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