Documentation
¶
Index ¶
- Variables
- type ImmutableByteSlice
- type ImmutableFloat64Slice
- type ImmutableUInt64Slice
- 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]interface{}
- func (m Map) Clear()
- func (m Map) CopyTo(dest Map)
- func (m Map) EnsureCapacity(capacity int)
- func (m Map) Get(key string) (Value, bool)
- func (m Map) Insert(k string, v Value)
- func (m Map) InsertBool(k string, v bool)
- func (m Map) InsertBytes(k string, v ImmutableByteSlice)
- func (m Map) InsertDouble(k string, v float64)
- func (m Map) InsertInt(k string, v int64)
- func (m Map) InsertNull(k string)
- func (m Map) InsertString(k string, v string)
- func (m Map) Len() int
- 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() Map
- func (m Map) Update(k string, v Value)deprecated
- func (m Map) UpdateBool(k string, v bool)
- func (m Map) UpdateBytes(k string, v ImmutableByteSlice)
- func (m Map) UpdateDouble(k string, v float64)
- func (m Map) UpdateInt(k string, v int64)
- func (m Map) UpdateString(k string, v string)
- func (m Map) Upsert(k string, v Value)deprecated
- func (m Map) UpsertBool(k string, v bool)
- func (m Map) UpsertBytes(k string, v ImmutableByteSlice)
- func (m Map) UpsertDouble(k string, v float64)
- func (m Map) UpsertEmpty(k string) Value
- func (m Map) UpsertEmptyMap(k string) Map
- func (m Map) UpsertEmptySlice(k string) Slice
- func (m Map) UpsertInt(k string, v int64)
- func (m Map) UpsertString(k string, v string)
- type Resource
- type Slice
- type SpanID
- type Timestamp
- type TraceID
- type Value
- func (v Value) AsString() string
- func (v Value) BoolVal() bool
- func (v Value) BytesVal() ImmutableByteSlice
- func (v Value) CopyTo(dest Value)
- func (v Value) DoubleVal() float64
- func (v Value) Equal(av Value) bool
- func (v Value) IntVal() int64
- func (v Value) MapVal() Map
- func (v Value) SetBoolVal(bv bool)
- func (v Value) SetBytesVal(bv ImmutableByteSlice)
- func (v Value) SetDoubleVal(dv float64)
- func (v Value) SetEmptyMapVal() Map
- func (v Value) SetEmptySliceVal() Slice
- func (v Value) SetIntVal(iv int64)
- func (v Value) SetStringVal(sv string)
- func (v Value) SliceVal() Slice
- func (v Value) StringVal() string
- func (v Value) Type() ValueType
- type ValueType
Constants ¶
This section is empty.
Variables ¶
var EmptySpanID = NewSpanID([8]byte{})
EmptySpanID represents the empty (all zero bytes) SpanID.
var EmptyTraceID = NewTraceID([16]byte{})
EmptyTraceID represents the empty (all zero bytes) TraceID.
Functions ¶
This section is empty.
Types ¶
type ImmutableByteSlice ¶ added in v0.54.0
type ImmutableByteSlice internal.ImmutableByteSlice
ImmutableByteSlice represents a []byte slice that cannot be mutated. The instance of ImmutableByteSlice can be assigned to multiple objects since it's immutable.
func NewImmutableByteSlice ¶ added in v0.54.0
func NewImmutableByteSlice(orig []byte) ImmutableByteSlice
NewImmutableByteSlice creates a new ImmutableByteSlice by copying the provided []byte slice.
func (ImmutableByteSlice) AsRaw ¶ added in v0.59.0
func (ms ImmutableByteSlice) AsRaw() []byte
AsRaw returns a copy of the []byte slice.
func (ImmutableByteSlice) At ¶ added in v0.59.0
func (ms ImmutableByteSlice) At(i int) byte
At returns an item from particular index.
func (ImmutableByteSlice) Len ¶ added in v0.59.0
func (ms ImmutableByteSlice) Len() int
Len returns length of the []byte slice value.
type ImmutableFloat64Slice ¶ added in v0.54.0
type ImmutableFloat64Slice internal.ImmutableFloat64Slice
ImmutableFloat64Slice represents a []float64 slice that cannot be mutated. The instance of ImmutableFloat64Slice can be assigned to multiple objects since it's immutable.
func NewImmutableFloat64Slice ¶ added in v0.54.0
func NewImmutableFloat64Slice(orig []float64) ImmutableFloat64Slice
NewImmutableFloat64Slice creates a new ImmutableFloat64Slice by copying the provided []float64 slice.
func (ImmutableFloat64Slice) AsRaw ¶ added in v0.59.0
func (ms ImmutableFloat64Slice) AsRaw() []float64
AsRaw returns a copy of the []float64 slice.
func (ImmutableFloat64Slice) At ¶ added in v0.59.0
func (ms ImmutableFloat64Slice) At(i int) float64
At returns an item from particular index.
func (ImmutableFloat64Slice) Len ¶ added in v0.59.0
func (ms ImmutableFloat64Slice) Len() int
Len returns length of the []float64 slice value.
type ImmutableUInt64Slice ¶ added in v0.54.0
type ImmutableUInt64Slice internal.ImmutableUInt64Slice
ImmutableUInt64Slice represents a []uint64 slice that cannot be mutated. The instance of ImmutableUInt64Slice can be assigned to multiple objects since it's immutable.
func NewImmutableUInt64Slice ¶ added in v0.54.0
func NewImmutableUInt64Slice(orig []uint64) ImmutableUInt64Slice
NewImmutableUInt64Slice creates a new ImmutableUInt64Slice by copying the provided []uint64 slice.
func (ImmutableUInt64Slice) AsRaw ¶ added in v0.59.0
func (ms ImmutableUInt64Slice) AsRaw() []uint64
AsRaw returns a copy of the []uint64 slice.
func (ImmutableUInt64Slice) At ¶ added in v0.59.0
func (ms ImmutableUInt64Slice) At(i int) uint64
At returns an item from particular index.
func (ImmutableUInt64Slice) Len ¶ added in v0.59.0
func (ms ImmutableUInt64Slice) Len() int
Len returns length of the []uint64 slice value.
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 to the dest.
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 to dest 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 NewMapFromRaw ¶
NewMapFromRaw creates a Map with values from the given map[string]interface{}.
func (Map) Clear ¶ added in v0.59.0
func (m Map) Clear()
Clear erases any existing entries in this Map instance.
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) Insert ¶ added in v0.59.0
Insert adds the Value to the map when the key does not exist. No action is applied to the map where the key already exists.
Calling this function with a zero-initialized Value struct will cause a panic.
Important: this function should not be used if the caller has access to the raw value to avoid an extra allocation.
NOTE: The method will be deprecated in 0.60.0. Replace it with the following function calls: For primitive types, use Insert<Type> methods, e.g. InsertString. For complex and unknown types, use:
_, ok := m.Get(k) if !ok { v.CopyTo(m.UpsertEmpty(k)) // or use m.UpsertEmpty<Type> for complex types. }
func (Map) InsertBool ¶ added in v0.59.0
InsertBool adds the bool Value to the map when the key does not exist. No action is applied to the map where the key already exists.
func (Map) InsertBytes ¶ added in v0.59.0
func (m Map) InsertBytes(k string, v ImmutableByteSlice)
InsertBytes adds the ImmutableByteSlice Value to the map when the key does not exist. No action is applied to the map where the key already exists.
func (Map) InsertDouble ¶ added in v0.59.0
InsertDouble adds the double Value to the map when the key does not exist. No action is applied to the map where the key already exists.
func (Map) InsertInt ¶ added in v0.59.0
InsertInt adds the int Value to the map when the key does not exist. No action is applied to the map where the key already exists.
func (Map) InsertNull ¶ added in v0.59.0
InsertNull adds a null Value to the map when the key does not exist. No action is applied to the map where the key already exists. Deprecated: [0.59.0] Use Get and UpsertEmpty instead.
func (Map) InsertString ¶ added in v0.59.0
InsertString adds the string Value to the map when the key does not exist. No action is applied to the map where the key already exists.
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) 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.
func (Map) RemoveIf ¶ added in v0.59.0
RemoveIf removes the entries for which the function in question returns true
func (Map) Sort ¶ added in v0.59.0
Sort sorts the entries in the Map so two instances can be compared. Returns the same instance to allow nicer code like:
assert.EqualValues(t, expected.Sort(), actual.Sort())
func (Map) Update
deprecated
added in
v0.59.0
Update updates an existing Value with a value. No action is applied to the map where the key does not exist.
Calling this function with a zero-initialized Value struct will cause a panic.
Important: this function should not be used if the caller has access to the raw value to avoid an extra allocation.
Deprecated: [0.59.0] Replace it with the following function calls: For primitive types, use Update<Type> methods, e.g. UpdateString. For complex and unknown types, use:
toVal, ok := m.Get(k) if ok { v.CopyTo(toVal) // or use m.UpsertEmpty<Type> for complex types. }
func (Map) UpdateBool ¶ added in v0.59.0
UpdateBool updates an existing bool Value with a value. No action is applied to the map where the key does not exist.
func (Map) UpdateBytes ¶ added in v0.59.0
func (m Map) UpdateBytes(k string, v ImmutableByteSlice)
UpdateBytes updates an existing ImmutableByteSlice Value with a value. No action is applied to the map where the key does not exist.
func (Map) UpdateDouble ¶ added in v0.59.0
UpdateDouble updates an existing double Value with a value. No action is applied to the map where the key does not exist.
func (Map) UpdateInt ¶ added in v0.59.0
UpdateInt updates an existing int Value with a value. No action is applied to the map where the key does not exist.
func (Map) UpdateString ¶ added in v0.59.0
UpdateString updates an existing string Value with a value. No action is applied to the map where the key does not exist.
func (Map) Upsert
deprecated
added in
v0.59.0
Upsert 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.
Calling this function with a zero-initialized Value struct will cause a panic.
Important: this function should not be used if the caller has access to the raw value to avoid an extra allocation.
Deprecated: [0.59.0] Replace it with the following function calls: For primitive types, use Upsert<Type> methods, e.g. UpsertString. For complex types, use UpsertEmpty<Type> methods, e.g. UpsertEmptyMap, and fill it with the data. If you don't know the value type, replace it with v.CopyTo(m.UpsertEmpty()).
func (Map) UpsertBool ¶ added in v0.59.0
UpsertBool 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) UpsertBytes ¶ added in v0.59.0
func (m Map) UpsertBytes(k string, v ImmutableByteSlice)
UpsertBytes performs the Insert or Update action. The ImmutableByteSlice 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) UpsertDouble ¶ added in v0.59.0
UpsertDouble 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) UpsertEmpty ¶ added in v0.59.0
UpsertEmpty inserts or updates an empty value to the map under given key and return the updated/inserted value.
func (Map) UpsertEmptyMap ¶ added in v0.59.0
UpsertEmptyMap inserts or updates an empty map under given key and returns it.
func (Map) UpsertEmptySlice ¶ added in v0.59.0
UpsertEmptySlice inserts or updates an empty clice under given key and returns it.
func (Map) UpsertInt ¶ added in v0.59.0
UpsertInt 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) UpsertString ¶ added in v0.59.0
UpsertString 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.
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 to the dest.
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 to dest 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 NewSliceFromRaw ¶ added in v0.56.0
func NewSliceFromRaw(rawSlice []interface{}) Slice
NewSliceFromRaw creates a Slice with values from the given []interface{}.
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) AsRaw ¶ added in v0.59.0
func (es Slice) AsRaw() []interface{}
AsRaw converts the Slice to a standard go slice.
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 to the dest.
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 struct {
// contains filtered or unexported fields
}
SpanID is span identifier.
func InvalidSpanID
deprecated
func InvalidSpanID() SpanID
Deprecated: [v0.59.0] use EmptySpanID.
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 struct {
// contains filtered or unexported fields
}
TraceID is a trace identifier.
func InvalidTraceID
deprecated
func InvalidTraceID() TraceID
Deprecated: [v0.59.0] use EmptyTraceID.
func NewTraceID ¶
NewTraceID returns a new TraceID from the given byte array.
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.SetIntVal(234) } func f2() { v := NewValueString("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(v ImmutableByteSlice) Value
NewValueBytes creates a new Value with the given ImmutableByteSlice value.
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 NewValueString ¶
NewValueString 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 StringVal which only returns a non-empty value if the ValueType is ValueTypeString.
func (Value) BoolVal ¶ added in v0.59.0
BoolVal 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) BytesVal ¶ added in v0.59.0
func (v Value) BytesVal() ImmutableByteSlice
BytesVal returns the ImmutableByteSlice value associated with this Value. If the Type() is not ValueTypeBytes then returns an empty slice. Calling this function on zero-initialized Value will cause a panic.
func (Value) DoubleVal ¶ added in v0.59.0
DoubleVal 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) IntVal ¶ added in v0.59.0
IntVal 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) MapVal ¶ added in v0.59.0
MapVal 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) SetBoolVal ¶ added in v0.59.0
SetBoolVal 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) SetBytesVal ¶ added in v0.59.0
func (v Value) SetBytesVal(bv ImmutableByteSlice)
SetBytesVal replaces the ImmutableByteSlice value associated with this Value, it also changes the type to be ValueTypeBytes. Calling this function on zero-initialized Value will cause a panic.
func (Value) SetDoubleVal ¶ added in v0.59.0
SetDoubleVal 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) SetEmptyMapVal ¶ added in v0.59.0
SetEmptyMapVal sets value to an empty map and returns it. Calling this function on zero-initialized Value will cause a panic.
func (Value) SetEmptySliceVal ¶ added in v0.59.0
SetEmptySliceVal sets value to an empty slice and returns it. Calling this function on zero-initialized Value will cause a panic.
func (Value) SetIntVal ¶ added in v0.59.0
SetIntVal 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) SetStringVal ¶ added in v0.59.0
SetStringVal replaces the string value associated with this Value, it also changes the type to be ValueTypeString. Calling this function on zero-initialized Value will cause a panic.
func (Value) SliceVal ¶ added in v0.59.0
SliceVal 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.