Documentation ¶
Index ¶
- type ByteSlice
- func (ms ByteSlice) Append(elms ...byte)
- func (ms ByteSlice) AsRaw() []byte
- func (ms ByteSlice) At(i int) byte
- func (ms ByteSlice) CopyTo(dest ByteSlice)
- func (ms ByteSlice) EnsureCapacity(newCap int)
- func (ms ByteSlice) FromRaw(val []byte)
- func (ms ByteSlice) Len() int
- func (ms ByteSlice) MoveTo(dest ByteSlice)
- func (ms ByteSlice) SetAt(i int, val byte)
- type Float64Slice
- func (ms Float64Slice) Append(elms ...float64)
- func (ms Float64Slice) AsRaw() []float64
- func (ms Float64Slice) At(i int) float64
- func (ms Float64Slice) CopyTo(dest Float64Slice)
- func (ms Float64Slice) EnsureCapacity(newCap int)
- func (ms Float64Slice) FromRaw(val []float64)
- func (ms Float64Slice) Len() int
- func (ms Float64Slice) MoveTo(dest Float64Slice)
- func (ms Float64Slice) SetAt(i int, val float64)
- type InstrumentationScope
- func (ms InstrumentationScope) Attributes() Map
- func (ms InstrumentationScope) CopyTo(dest InstrumentationScope)
- func (ms InstrumentationScope) DroppedAttributesCount() uint32
- func (ms InstrumentationScope) MoveTo(dest InstrumentationScope)
- func (ms InstrumentationScope) Name() string
- func (ms InstrumentationScope) SetDroppedAttributesCount(v uint32)
- func (ms InstrumentationScope) SetName(v string)
- func (ms InstrumentationScope) SetVersion(v string)
- func (ms InstrumentationScope) Version() string
- type Map
- func (m Map) AsRaw() map[string]any
- func (m Map) Clear()
- func (m Map) CopyTo(dest Map)
- func (m Map) EnsureCapacity(capacity int)
- func (m Map) FromRaw(rawMap map[string]any) error
- func (m Map) Get(key string) (Value, bool)
- func (m Map) Len() int
- func (m Map) PutBool(k string, v bool)
- func (m Map) PutDouble(k string, v float64)
- func (m Map) PutEmpty(k string) Value
- func (m Map) PutEmptyBytes(k string) ByteSlice
- func (m Map) PutEmptyMap(k string) Map
- func (m Map) PutEmptySlice(k string) Slice
- func (m Map) PutInt(k string, v int64)
- func (m Map) PutStr(k string, v string)
- func (m Map) Range(f func(k string, v Value) bool)
- func (m Map) Remove(key string) bool
- func (m Map) RemoveIf(f func(string, Value) bool)
- func (m Map) Sort()
- type Resource
- type Slice
- func (es Slice) AppendEmpty() Value
- func (es Slice) AsRaw() []any
- func (es Slice) At(ix int) Value
- func (es Slice) CopyTo(dest Slice)
- func (es Slice) EnsureCapacity(newCap int)
- func (es Slice) FromRaw(rawSlice []any) error
- func (es Slice) Len() int
- func (es Slice) MoveAndAppendTo(dest Slice)
- func (es Slice) RemoveIf(f func(Value) bool)
- type SpanID
- type Timestamp
- type TraceID
- type TraceState
- type UInt64Slice
- func (ms UInt64Slice) Append(elms ...uint64)
- func (ms UInt64Slice) AsRaw() []uint64
- func (ms UInt64Slice) At(i int) uint64
- func (ms UInt64Slice) CopyTo(dest UInt64Slice)
- func (ms UInt64Slice) EnsureCapacity(newCap int)
- func (ms UInt64Slice) FromRaw(val []uint64)
- func (ms UInt64Slice) Len() int
- func (ms UInt64Slice) MoveTo(dest UInt64Slice)
- func (ms UInt64Slice) SetAt(i int, val uint64)
- type Value
- func (v Value) AsRaw() any
- func (v Value) AsString() string
- func (v Value) Bool() bool
- func (v Value) Bytes() ByteSlice
- func (v Value) CopyTo(dest Value)
- func (v Value) Double() float64
- func (v Value) Equal(av Value) bool
- func (v Value) FromRaw(iv any) error
- func (v Value) Int() int64
- func (v Value) Map() Map
- func (v Value) SetBool(bv bool)
- func (v Value) SetDouble(dv float64)
- func (v Value) SetEmptyBytes() ByteSlice
- func (v Value) SetEmptyMap() Map
- func (v Value) SetEmptySlice() Slice
- func (v Value) SetInt(iv int64)
- func (v Value) SetStr(sv string)
- func (v Value) Slice() Slice
- func (v Value) Str() string
- func (v Value) Type() ValueType
- type ValueType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByteSlice ¶ added in v0.60.0
ByteSlice represents a []byte slice. The instance of ByteSlice can be assigned to multiple objects since it's immutable.
Must use NewByteSlice function to create new instances. Important: zero-initialized instance is not valid for use.
func NewByteSlice ¶ added in v0.60.0
func NewByteSlice() ByteSlice
NewByteSlice creates a new empty ByteSlice.
func (ByteSlice) Append ¶ added in v0.61.0
Append appends extra elements to ByteSlice. Equivalent of byteSlice = append(byteSlice, elms...)
func (ByteSlice) At ¶ added in v0.60.0
At returns an item from particular index. Equivalent of byteSlice[i].
func (ByteSlice) CopyTo ¶ added in v0.60.0
CopyTo copies all elements from the current slice overriding the destination.
func (ByteSlice) EnsureCapacity ¶ added in v0.61.0
EnsureCapacity ensures ByteSlice has at least the specified capacity.
- If the newCap <= cap, then is no change in capacity.
- If the newCap > cap, then the slice capacity will be expanded to the provided value which will be equivalent of: buf := make([]byte, len(byteSlice), newCap) copy(buf, byteSlice) byteSlice = buf
func (ByteSlice) Len ¶ added in v0.60.0
Len returns length of the []byte slice value. Equivalent of len(byteSlice).
type Float64Slice ¶ added in v0.60.0
type Float64Slice internal.Float64Slice
Float64Slice represents a []float64 slice. The instance of Float64Slice can be assigned to multiple objects since it's immutable.
Must use NewFloat64Slice function to create new instances. Important: zero-initialized instance is not valid for use.
func NewFloat64Slice ¶ added in v0.60.0
func NewFloat64Slice() Float64Slice
NewFloat64Slice creates a new empty Float64Slice.
func (Float64Slice) Append ¶ added in v0.61.0
func (ms Float64Slice) Append(elms ...float64)
Append appends extra elements to Float64Slice. Equivalent of float64Slice = append(float64Slice, elms...)
func (Float64Slice) AsRaw ¶ added in v0.60.0
func (ms Float64Slice) AsRaw() []float64
AsRaw returns a copy of the []float64 slice.
func (Float64Slice) At ¶ added in v0.60.0
func (ms Float64Slice) At(i int) float64
At returns an item from particular index. Equivalent of float64Slice[i].
func (Float64Slice) CopyTo ¶ added in v0.60.0
func (ms Float64Slice) CopyTo(dest Float64Slice)
CopyTo copies all elements from the current slice overriding the destination.
func (Float64Slice) EnsureCapacity ¶ added in v0.61.0
func (ms Float64Slice) EnsureCapacity(newCap int)
EnsureCapacity ensures Float64Slice has at least the specified capacity.
- If the newCap <= cap, then is no change in capacity.
- If the newCap > cap, then the slice capacity will be expanded to the provided value which will be equivalent of: buf := make([]float64, len(float64Slice), newCap) copy(buf, float64Slice) float64Slice = buf
func (Float64Slice) FromRaw ¶ added in v0.60.0
func (ms Float64Slice) FromRaw(val []float64)
FromRaw copies raw []float64 into the slice Float64Slice.
func (Float64Slice) Len ¶ added in v0.60.0
func (ms Float64Slice) Len() int
Len returns length of the []float64 slice value. Equivalent of len(float64Slice).
func (Float64Slice) MoveTo ¶ added in v0.60.0
func (ms Float64Slice) MoveTo(dest Float64Slice)
MoveTo moves all elements from the current slice overriding the destination and resetting the current instance to its zero value.
func (Float64Slice) SetAt ¶ added in v0.60.0
func (ms Float64Slice) SetAt(i int, val float64)
SetAt sets float64 item at particular index. Equivalent of float64Slice[i] = val
type InstrumentationScope ¶
type InstrumentationScope internal.InstrumentationScope
func NewInstrumentationScope ¶
func NewInstrumentationScope() InstrumentationScope
NewInstrumentationScope creates a new empty InstrumentationScope.
This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice, OR directly access the member if this is embedded in another struct.
func (InstrumentationScope) Attributes ¶ added in v0.59.0
func (ms InstrumentationScope) Attributes() Map
Attributes returns the Attributes associated with this InstrumentationScope.
func (InstrumentationScope) CopyTo ¶ added in v0.59.0
func (ms InstrumentationScope) CopyTo(dest InstrumentationScope)
CopyTo copies all properties from the current struct overriding the destination.
func (InstrumentationScope) DroppedAttributesCount ¶ added in v0.59.0
func (ms InstrumentationScope) DroppedAttributesCount() uint32
DroppedAttributesCount returns the droppedattributescount associated with this InstrumentationScope.
func (InstrumentationScope) MoveTo ¶ added in v0.59.0
func (ms InstrumentationScope) MoveTo(dest InstrumentationScope)
MoveTo moves all properties from the current struct overriding the destination and resetting the current instance to its zero value
func (InstrumentationScope) Name ¶ added in v0.59.0
func (ms InstrumentationScope) Name() string
Name returns the name associated with this InstrumentationScope.
func (InstrumentationScope) SetDroppedAttributesCount ¶ added in v0.59.0
func (ms InstrumentationScope) SetDroppedAttributesCount(v uint32)
SetDroppedAttributesCount replaces the droppedattributescount associated with this InstrumentationScope.
func (InstrumentationScope) SetName ¶ added in v0.59.0
func (ms InstrumentationScope) SetName(v string)
SetName replaces the name associated with this InstrumentationScope.
func (InstrumentationScope) SetVersion ¶ added in v0.59.0
func (ms InstrumentationScope) SetVersion(v string)
SetVersion replaces the version associated with this InstrumentationScope.
func (InstrumentationScope) Version ¶ added in v0.59.0
func (ms InstrumentationScope) Version() string
Version returns the version associated with this InstrumentationScope.
type Map ¶
Map stores a map of string keys to elements of Value type.
func (Map) Clear ¶ added in v0.59.0
func (m Map) Clear()
Clear erases any existing entries in this Map instance.
func (Map) CopyTo ¶ added in v0.59.0
CopyTo copies all elements from the current map overriding the destination.
func (Map) EnsureCapacity ¶ added in v0.59.0
EnsureCapacity increases the capacity of this Map instance, if necessary, to ensure that it can hold at least the number of elements specified by the capacity argument.
func (Map) Get ¶ added in v0.59.0
Get returns the Value associated with the key and true. Returned Value is not a copy, it is a reference to the value stored in this map. It is allowed to modify the returned value using Value.Set* functions. Such modification will be applied to the value stored in this map.
If the key does not exist returns an invalid instance of the KeyValue and false. Calling any functions on the returned invalid instance will cause a panic.
func (Map) Len ¶ added in v0.59.0
Len returns the length of this map.
Because the Map is represented internally by a slice of pointers, and the data are comping from the wire, it is possible that when iterating using "Range" to get access to fewer elements because nil elements are skipped.
func (Map) PutBool ¶ added in v0.60.0
PutBool performs the Insert or Update action. The bool Value is inserted to the map that did not originally have the key. The key/value is updated to the map where the key already existed.
func (Map) PutDouble ¶ added in v0.60.0
PutDouble performs the Insert or Update action. The double Value is inserted to the map that did not originally have the key. The key/value is updated to the map where the key already existed.
func (Map) PutEmpty ¶ added in v0.60.0
PutEmpty inserts or updates an empty value to the map under given key and return the updated/inserted value.
func (Map) PutEmptyBytes ¶ added in v0.60.0
PutEmptyBytes inserts or updates an empty byte slice under given key and returns it.
func (Map) PutEmptyMap ¶ added in v0.60.0
PutEmptyMap inserts or updates an empty map under given key and returns it.
func (Map) PutEmptySlice ¶ added in v0.60.0
PutEmptySlice inserts or updates an empty slice under given key and returns it.
func (Map) PutInt ¶ added in v0.60.0
PutInt performs the Insert or Update action. The int Value is inserted to the map that did not originally have the key. The key/value is updated to the map where the key already existed.
func (Map) PutStr ¶ added in v0.62.0
PutStr performs the Insert or Update action. The Value is inserted to the map that did not originally have the key. The key/value is updated to the map where the key already existed.
func (Map) Range ¶ added in v0.59.0
Range calls f sequentially for each key and value present in the map. If f returns false, range stops the iteration.
Example:
sm.Range(func(k string, v Value) bool { ... })
func (Map) Remove ¶ added in v0.59.0
Remove removes the entry associated with the key and returns true if the key was present in the map, otherwise returns false.
type Resource ¶
func NewResource ¶
func NewResource() Resource
NewResource creates a new empty Resource.
This must be used only in testing code. Users should use "AppendEmpty" when part of a Slice, OR directly access the member if this is embedded in another struct.
func (Resource) Attributes ¶ added in v0.59.0
Attributes returns the Attributes associated with this Resource.
func (Resource) CopyTo ¶ added in v0.59.0
CopyTo copies all properties from the current struct overriding the destination.
func (Resource) DroppedAttributesCount ¶ added in v0.59.0
DroppedAttributesCount returns the droppedattributescount associated with this Resource.
func (Resource) MoveTo ¶ added in v0.59.0
MoveTo moves all properties from the current struct overriding the destination and resetting the current instance to its zero value
func (Resource) SetDroppedAttributesCount ¶ added in v0.59.0
SetDroppedAttributesCount replaces the droppedattributescount associated with this Resource.
type Slice ¶
Slice logically represents a slice of Value.
This is a reference type. If passed by value and callee modifies it, the caller will see the modification.
Must use NewSlice function to create new instances. Important: zero-initialized instance is not valid for use.
func NewSlice ¶
func NewSlice() Slice
NewSlice creates a Slice with 0 elements. Can use "EnsureCapacity" to initialize with a given capacity.
func (Slice) AppendEmpty ¶ added in v0.59.0
AppendEmpty will append to the end of the slice an empty Value. It returns the newly added Value.
func (Slice) At ¶ added in v0.59.0
At returns the element at the given index.
This function is used mostly for iterating over all the values in the slice:
for i := 0; i < es.Len(); i++ { e := es.At(i) ... // Do something with the element }
func (Slice) CopyTo ¶ added in v0.59.0
CopyTo copies all elements from the current slice overriding the destination.
func (Slice) EnsureCapacity ¶ added in v0.59.0
EnsureCapacity is an operation that ensures the slice has at least the specified capacity. 1. If the newCap <= cap then no change in capacity. 2. If the newCap > cap then the slice capacity will be expanded to equal newCap.
Here is how a new Slice can be initialized:
es := NewSlice() es.EnsureCapacity(4) for i := 0; i < 4; i++ { e := es.AppendEmpty() // Here should set all the values for e. }
func (Slice) Len ¶ added in v0.59.0
Len returns the number of elements in the slice.
Returns "0" for a newly instance created with "NewSlice()".
func (Slice) MoveAndAppendTo ¶ added in v0.59.0
MoveAndAppendTo moves all elements from the current slice and appends them to the dest. The current slice will be cleared.
type SpanID ¶
type SpanID [8]byte
SpanID is span identifier.
func NewSpanIDEmpty ¶ added in v0.60.0
func NewSpanIDEmpty() SpanID
NewSpanIDEmpty returns a new empty (all zero bytes) SpanID.
func (SpanID) IsEmpty ¶ added in v0.59.0
IsEmpty returns true if id doesn't contain at least one non-zero byte.
type Timestamp ¶
type Timestamp uint64
Timestamp is a time specified as UNIX Epoch time in nanoseconds since 1970-01-01 00:00:00 +0000 UTC.
func NewTimestampFromTime ¶
NewTimestampFromTime constructs a new Timestamp from the provided time.Time.
type TraceID ¶
type TraceID [16]byte
TraceID is a trace identifier.
func NewTraceIDEmpty ¶ added in v0.60.0
func NewTraceIDEmpty() TraceID
NewTraceIDEmpty returns a new empty (all zero bytes) TraceID.
func (TraceID) IsEmpty ¶ added in v0.59.0
IsEmpty returns true if id doesn't contain at least one non-zero byte.
type TraceState ¶ added in v0.60.0
type TraceState internal.TraceState
TraceState represents the trace state from the w3c-trace-context.
func NewTraceState ¶ added in v0.60.0
func NewTraceState() TraceState
func (TraceState) AsRaw ¶ added in v0.60.0
func (ms TraceState) AsRaw() string
AsRaw returns the string representation of the tracestate in w3c-trace-context format: https://www.w3.org/TR/trace-context/#tracestate-header
func (TraceState) CopyTo ¶ added in v0.60.0
func (ms TraceState) CopyTo(dest TraceState)
CopyTo copies the TraceState instance overriding the destination.
func (TraceState) FromRaw ¶ added in v0.60.0
func (ms TraceState) FromRaw(v string)
FromRaw copies the string representation in w3c-trace-context format of the tracestate into this TraceState.
func (TraceState) MoveTo ¶ added in v0.60.0
func (ms TraceState) MoveTo(dest TraceState)
MoveTo moves the TraceState instance overriding the destination and resetting the current instance to its zero value.
type UInt64Slice ¶ added in v0.60.0
type UInt64Slice internal.UInt64Slice
UInt64Slice represents a []uint64 slice. The instance of UInt64Slice can be assigned to multiple objects since it's immutable.
Must use NewUInt64Slice function to create new instances. Important: zero-initialized instance is not valid for use.
func NewUInt64Slice ¶ added in v0.60.0
func NewUInt64Slice() UInt64Slice
NewUInt64Slice creates a new empty UInt64Slice.
func (UInt64Slice) Append ¶ added in v0.61.0
func (ms UInt64Slice) Append(elms ...uint64)
Append appends extra elements to UInt64Slice. Equivalent of uInt64Slice = append(uInt64Slice, elms...)
func (UInt64Slice) AsRaw ¶ added in v0.60.0
func (ms UInt64Slice) AsRaw() []uint64
AsRaw returns a copy of the []uint64 slice.
func (UInt64Slice) At ¶ added in v0.60.0
func (ms UInt64Slice) At(i int) uint64
At returns an item from particular index. Equivalent of uInt64Slice[i].
func (UInt64Slice) CopyTo ¶ added in v0.60.0
func (ms UInt64Slice) CopyTo(dest UInt64Slice)
CopyTo copies all elements from the current slice overriding the destination.
func (UInt64Slice) EnsureCapacity ¶ added in v0.61.0
func (ms UInt64Slice) EnsureCapacity(newCap int)
EnsureCapacity ensures UInt64Slice has at least the specified capacity.
- If the newCap <= cap, then is no change in capacity.
- If the newCap > cap, then the slice capacity will be expanded to the provided value which will be equivalent of: buf := make([]uint64, len(uInt64Slice), newCap) copy(buf, uInt64Slice) uInt64Slice = buf
func (UInt64Slice) FromRaw ¶ added in v0.60.0
func (ms UInt64Slice) FromRaw(val []uint64)
FromRaw copies raw []uint64 into the slice UInt64Slice.
func (UInt64Slice) Len ¶ added in v0.60.0
func (ms UInt64Slice) Len() int
Len returns length of the []uint64 slice value. Equivalent of len(uInt64Slice).
func (UInt64Slice) MoveTo ¶ added in v0.60.0
func (ms UInt64Slice) MoveTo(dest UInt64Slice)
MoveTo moves all elements from the current slice overriding the destination and resetting the current instance to its zero value.
func (UInt64Slice) SetAt ¶ added in v0.60.0
func (ms UInt64Slice) SetAt(i int, val uint64)
SetAt sets uint64 item at particular index. Equivalent of uInt64Slice[i] = val
type Value ¶
Value is a mutable cell containing any value. Typically used as an element of Map or Slice. Must use one of NewValue+ functions below to create new instances.
Intended to be passed by value since internally it is just a pointer to actual value representation. For the same reason passing by value and calling setters will modify the original, e.g.:
func f1(val Value) { val.SetInt(234) } func f2() { v := NewValueStr("a string") f1(v) _ := v.Type() // this will return ValueTypeInt }
Important: zero-initialized instance is not valid for use. All Value functions below must be called only on instances that are created via NewValue+ functions.
func NewValueBool ¶
NewValueBool creates a new Value with the given bool value.
func NewValueBytes ¶
func NewValueBytes() Value
NewValueBytes creates a new empty Value of byte type.
func NewValueDouble ¶
NewValueDouble creates a new Value with the given float64 value.
func NewValueEmpty ¶
func NewValueEmpty() Value
NewValueEmpty creates a new Value with an empty value.
func NewValueInt ¶
NewValueInt creates a new Value with the given int64 value.
func NewValueStr ¶ added in v0.62.0
NewValueStr creates a new Value with the given string value.
func (Value) AsString ¶ added in v0.59.0
AsString converts an OTLP Value object of any type to its equivalent string representation. This differs from GetString which only returns a non-empty value if the ValueType is ValueTypeStr.
func (Value) Bool ¶ added in v0.61.0
Bool returns the bool value associated with this Value. If the Type() is not ValueTypeBool then returns false. Calling this function on zero-initialized Value will cause a panic.
func (Value) Bytes ¶ added in v0.61.0
Bytes returns the ByteSlice value associated with this Value. If the Type() is not ValueTypeBytes then returns an invalid ByteSlice object. Note that using such slice can cause panic.
Calling this function on zero-initialized Value will cause a panic.
func (Value) Double ¶ added in v0.61.0
Double returns the float64 value associated with this Value. If the Type() is not ValueTypeDouble then returns float64(0). Calling this function on zero-initialized Value will cause a panic.
func (Value) Equal ¶ added in v0.59.0
Equal checks for equality, it returns true if the objects are equal otherwise false.
func (Value) Int ¶ added in v0.61.0
Int returns the int64 value associated with this Value. If the Type() is not ValueTypeInt then returns int64(0). Calling this function on zero-initialized Value will cause a panic.
func (Value) Map ¶ added in v0.61.0
Map returns the map value associated with this Value. If the Type() is not ValueTypeMap then returns an invalid map. Note that using such map can cause panic.
Calling this function on zero-initialized Value will cause a panic.
func (Value) SetBool ¶ added in v0.61.0
SetBool replaces the bool value associated with this Value, it also changes the type to be ValueTypeBool. Calling this function on zero-initialized Value will cause a panic.
func (Value) SetDouble ¶ added in v0.61.0
SetDouble replaces the float64 value associated with this Value, it also changes the type to be ValueTypeDouble. Calling this function on zero-initialized Value will cause a panic.
func (Value) SetEmptyBytes ¶ added in v0.61.0
SetEmptyBytes sets value to an empty byte slice and returns it. Calling this function on zero-initialized Value will cause a panic.
func (Value) SetEmptyMap ¶ added in v0.61.0
SetEmptyMap sets value to an empty map and returns it. Calling this function on zero-initialized Value will cause a panic.
func (Value) SetEmptySlice ¶ added in v0.61.0
SetEmptySlice sets value to an empty slice and returns it. Calling this function on zero-initialized Value will cause a panic.
func (Value) SetInt ¶ added in v0.61.0
SetInt replaces the int64 value associated with this Value, it also changes the type to be ValueTypeInt. Calling this function on zero-initialized Value will cause a panic.
func (Value) SetStr ¶ added in v0.61.0
SetStr replaces the string value associated with this Value, it also changes the type to be ValueTypeStr. The shorter name is used instead of SetString to avoid implementing fmt.Stringer interface by the corresponding getter method. Calling this function on zero-initialized Value will cause a panic.
func (Value) Slice ¶ added in v0.61.0
Slice returns the slice value associated with this Value. If the Type() is not ValueTypeSlice then returns an invalid slice. Note that using such slice can cause panic.
Calling this function on zero-initialized Value will cause a panic.
func (Value) Str ¶ added in v0.61.0
Str returns the string value associated with this Value. The shorter name is used instead of String to avoid implementing fmt.Stringer interface. If the Type() is not ValueTypeStr then returns empty string. Calling this function on zero-initialized Value will cause a panic.