import "go.opentelemetry.io/otel/metric/number"
Package number provides a number abstraction for instruments that either support int64 or float64 input values.
This package is currently in a pre-GA phase. Backwards incompatible changes may be introduced in subsequent minor version releases as we work to track the evolving OpenTelemetry specification and user feedback.
doc.go kind_string.go number.go
Kind describes the data type of the Number.
const ( // Int64Kind means that the Number stores int64. Int64Kind Kind = iota // Float64Kind means that the Number stores float64. Float64Kind )
Maximum returns the maximum representable value for a given Kind
Minimum returns the minimum representable value for a given Kind
Zero returns a zero value for a given Kind
Number represents either an integral or a floating point value. It needs to be accompanied with a source of Kind that describes the actual type of the value stored within Number.
NewFloat64Number creates a floating point Number.
NewInt64Number creates an integral Number.
NewNumberFromRaw creates a new Number from a raw value.
NewNumberSignChange returns a number with the same magnitude and the opposite sign. `kind` must describe the kind of number in `nn`.
AddFloat64 assumes that the number contains a float64 and adds the passed float64 to it.
AddFloat64Atomic assumes that the number contains a float64 and adds the passed float64 to it atomically.
AddInt64 assumes that the number contains an int64 and adds the passed int64 to it.
AddInt64Atomic assumes that the number contains an int64 and adds the passed int64 to it atomically.
AddNumber assumes that this and the passed number are of the passed kind and adds the passed number to this number.
AddNumberAtomic assumes that this and the passed number are of the passed kind and adds the passed number to this number atomically.
AddRaw assumes that this number and the passed raw value are of the passed kind and adds the passed raw value to this number.
AddRawAtomic assumes that this number and the passed raw value are of the passed kind and adds the passed raw value to this number atomically.
AsFloat64 assumes that the measurement value contains a float64 and returns it as such.
AsFloat64Atomic assumes that the measurement value contains a float64 and returns it as such atomically.
AsFloat64Ptr assumes that the number contains a float64 and returns a pointer to it.
AsInt64 assumes that the value contains an int64 and returns it as such.
AsInt64Atomic assumes that the number contains an int64 and returns it as such atomically.
AsInt64Ptr assumes that the number contains an int64 and returns a pointer to it.
AsInterface returns the number as an interface{}, typically used for Kind-correct JSON conversion.
AsNumber gets the Number.
AsNumberAtomic gets the Number atomically.
AsRaw gets the uninterpreted raw value. Might be useful for some atomic operations.
AsRawAtomic gets the uninterpreted raw value atomically. Might be useful for some atomic operations.
AsRawPtr gets the pointer to the raw, uninterpreted raw value. Might be useful for some atomic operations.
CoerceToFloat64 casts the number to float64. May result in data/precision loss.
CoerceToInt64 casts the number to int64. May result in data/precision loss.
CompareAndSwapFloat64 assumes that this number contains a float64 and does the atomic CAS operation on it.
CompareAndSwapInt64 assumes that this number contains an int64 and does the atomic CAS operation on it.
CompareAndSwapNumber does the atomic CAS operation on this number. This number and passed old and new numbers should be of the same kind.
CompareAndSwapRaw does the atomic CAS operation on this number. This number and passed old and new raw values should be of the same kind.
CompareFloat64 assumes that the Number contains a float64 and performs a comparison between the value and the other value. It returns the typical result of the compare function: -1 if the value is less than the other, 0 if both are equal, 1 if the value is greater than the other.
Do not compare NaN values.
CompareInt64 assumes that the Number contains an int64 and performs a comparison between the value and the other value. It returns the typical result of the compare function: -1 if the value is less than the other, 0 if both are equal, 1 if the value is greater than the other.
CompareNumber compares two Numbers given their kind. Both numbers should have the same kind. This returns:
0 if the numbers are equal -1 if the subject `n` is less than the argument `nn` +1 if the subject `n` is greater than the argument `nn`
CompareRaw compares two numbers, where one is input as a raw uint64, interpreting both values as a `kind` of number.
Emit returns a string representation of the raw value of the Number. A %d is used for integral values, %f for floating point values.
IsNegative returns true if the actual value is less than zero.
IsPositive returns true if the actual value is greater than zero.
IsZero returns true if the actual value is equal to zero.
SetFloat64 assumes that the number contains a float64 and sets it to the passed value.
SetFloat64Atomic assumes that the number contains a float64 and sets it to the passed value atomically.
SetInt64 assumes that the number contains an int64 and sets it to the passed value.
SetInt64Atomic assumes that the number contains an int64 and sets it to the passed value atomically.
SetNumber sets the number to the passed number. Both should be of the same kind.
SetNumberAtomic sets the number to the passed number atomically. Both should be of the same kind.
SetRaw sets the number to the passed raw value. Both number and the raw number should represent the same kind.
SetRawAtomic sets the number to the passed raw value atomically. Both number and the raw number should represent the same kind.
SwapFloat64 assumes that the number contains an float64, sets it to the passed value and returns the old float64 value.
SwapFloat64Atomic assumes that the number contains an float64, sets it to the passed value and returns the old float64 value atomically.
SwapInt64 assumes that the number contains an int64, sets it to the passed value and returns the old int64 value.
SwapInt64Atomic assumes that the number contains an int64, sets it to the passed value and returns the old int64 value atomically.
SwapNumber sets the number to the passed number and returns the old number. Both this number and the passed number should be of the same kind.
SwapNumberAtomic sets the number to the passed number and returns the old number atomically. Both this number and the passed number should be of the same kind.
SwapRaw sets the number to the passed raw value and returns the old raw value. Both number and the raw number should represent the same kind.
SwapRawAtomic sets the number to the passed raw value and returns the old raw value atomically. Both number and the raw number should represent the same kind.
Package number imports 5 packages (graph) and is imported by 25 packages. Updated 2020-11-19. Refresh now. Tools for package owners.