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)
- 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) 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 ¶
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 (ByteSlice) Append ¶
Append appends extra elements to ByteSlice. Equivalent of byteSlice = append(byteSlice, elms...)
func (ByteSlice) CopyTo ¶
CopyTo copies all elements from the current slice overriding the destination.
func (ByteSlice) EnsureCapacity ¶
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
type Float64Slice ¶
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 ¶
func NewFloat64Slice() Float64Slice
NewFloat64Slice creates a new empty Float64Slice.
func (Float64Slice) Append ¶
func (ms Float64Slice) Append(elms ...float64)
Append appends extra elements to Float64Slice. Equivalent of float64Slice = append(float64Slice, elms...)
func (Float64Slice) AsRaw ¶
func (ms Float64Slice) AsRaw() []float64
AsRaw returns a copy of the []float64 slice.
func (Float64Slice) At ¶
func (ms Float64Slice) At(i int) float64
At returns an item from particular index. Equivalent of float64Slice[i].
func (Float64Slice) CopyTo ¶
func (ms Float64Slice) CopyTo(dest Float64Slice)
CopyTo copies all elements from the current slice overriding the destination.
func (Float64Slice) EnsureCapacity ¶
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 ¶
func (ms Float64Slice) FromRaw(val []float64)
FromRaw copies raw []float64 into the slice Float64Slice.
func (Float64Slice) Len ¶
func (ms Float64Slice) Len() int
Len returns length of the []float64 slice value. Equivalent of len(float64Slice).
func (Float64Slice) MoveTo ¶
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 ¶
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
InstrumentationScope is a message representing the instrumentation scope information.
This is a reference type, if passed by value and callee modifies it the caller will see the modification.
Must use NewInstrumentationScope function to create new instances. Important: zero-initialized instance is not valid for use.
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 ¶
func (ms InstrumentationScope) Attributes() Map
Attributes returns the Attributes associated with this InstrumentationScope.
func (InstrumentationScope) CopyTo ¶
func (ms InstrumentationScope) CopyTo(dest InstrumentationScope)
CopyTo copies all properties from the current struct overriding the destination.
func (InstrumentationScope) DroppedAttributesCount ¶
func (ms InstrumentationScope) DroppedAttributesCount() uint32
DroppedAttributesCount returns the droppedattributescount associated with this InstrumentationScope.
func (InstrumentationScope) MoveTo ¶
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 ¶
func (ms InstrumentationScope) Name() string
Name returns the name associated with this InstrumentationScope.
func (InstrumentationScope) SetDroppedAttributesCount ¶
func (ms InstrumentationScope) SetDroppedAttributesCount(v uint32)
SetDroppedAttributesCount replaces the droppedattributescount associated with this InstrumentationScope.
func (InstrumentationScope) SetName ¶
func (ms InstrumentationScope) SetName(v string)
SetName replaces the name associated with this InstrumentationScope.
func (InstrumentationScope) SetVersion ¶
func (ms InstrumentationScope) SetVersion(v string)
SetVersion replaces the version associated with this InstrumentationScope.
func (InstrumentationScope) Version ¶
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) EnsureCapacity ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
PutEmpty inserts or updates an empty value to the map under given key and return the updated/inserted value.
func (Map) PutEmptyBytes ¶
PutEmptyBytes inserts or updates an empty byte slice under given key and returns it.
func (Map) PutEmptyMap ¶
PutEmptyMap inserts or updates an empty map under given key and returns it.
func (Map) PutEmptySlice ¶
PutEmptySlice inserts or updates an empty slice under given key and returns it.
func (Map) PutInt ¶
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 ¶
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 ¶
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 { ... })
type Resource ¶
Resource is a message representing the resource information.
This is a reference type, if passed by value and callee modifies it the caller will see the modification.
Must use NewResource function to create new instances. Important: zero-initialized instance is not valid for use.
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 ¶
Attributes returns the Attributes associated with this Resource.
func (Resource) CopyTo ¶
CopyTo copies all properties from the current struct overriding the destination.
func (Resource) DroppedAttributesCount ¶
DroppedAttributesCount returns the droppedattributescount associated with this Resource.
func (Resource) MoveTo ¶
MoveTo moves all properties from the current struct overriding the destination and resetting the current instance to its zero value
func (Resource) SetDroppedAttributesCount ¶
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 ¶
AppendEmpty will append to the end of the slice an empty Value. It returns the newly added Value.
func (Slice) At ¶
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) EnsureCapacity ¶
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 ¶
Len returns the number of elements in the slice.
Returns "0" for a newly instance created with "NewSlice()".
func (Slice) MoveAndAppendTo ¶
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 ¶
func NewSpanIDEmpty() SpanID
NewSpanIDEmpty returns a new empty (all zero bytes) SpanID.
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 ¶
func NewTraceIDEmpty() TraceID
NewTraceIDEmpty returns a new empty (all zero bytes) TraceID.
type TraceState ¶
type TraceState internal.TraceState
TraceState represents the trace state from the w3c-trace-context.
func NewTraceState ¶
func NewTraceState() TraceState
func (TraceState) AsRaw ¶
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 ¶
func (ms TraceState) CopyTo(dest TraceState)
CopyTo copies the TraceState instance overriding the destination.
func (TraceState) FromRaw ¶
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 ¶
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 ¶
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 ¶
func NewUInt64Slice() UInt64Slice
NewUInt64Slice creates a new empty UInt64Slice.
func (UInt64Slice) Append ¶
func (ms UInt64Slice) Append(elms ...uint64)
Append appends extra elements to UInt64Slice. Equivalent of uInt64Slice = append(uInt64Slice, elms...)
func (UInt64Slice) AsRaw ¶
func (ms UInt64Slice) AsRaw() []uint64
AsRaw returns a copy of the []uint64 slice.
func (UInt64Slice) At ¶
func (ms UInt64Slice) At(i int) uint64
At returns an item from particular index. Equivalent of uInt64Slice[i].
func (UInt64Slice) CopyTo ¶
func (ms UInt64Slice) CopyTo(dest UInt64Slice)
CopyTo copies all elements from the current slice overriding the destination.
func (UInt64Slice) EnsureCapacity ¶
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 ¶
func (ms UInt64Slice) FromRaw(val []uint64)
FromRaw copies raw []uint64 into the slice UInt64Slice.
func (UInt64Slice) Len ¶
func (ms UInt64Slice) Len() int
Len returns length of the []uint64 slice value. Equivalent of len(uInt64Slice).
func (UInt64Slice) MoveTo ¶
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 ¶
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 ¶
NewValueStr creates a new Value with the given string value.
func (Value) AsString ¶
AsString converts an OTLP Value object of any type to its equivalent string representation. This differs from Str which only returns a non-empty value if the ValueType is ValueTypeStr.
func (Value) Bool ¶
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 ¶
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 ¶
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) Int ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
SetEmptyMap sets value to an empty map and returns it. Calling this function on zero-initialized Value will cause a panic.
func (Value) SetEmptySlice ¶
SetEmptySlice sets value to an empty slice and returns it. Calling this function on zero-initialized Value will cause a panic.
func (Value) SetInt ¶
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 ¶
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 ¶
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.