Documentation ¶
Index ¶
- Constants
- func EmptyTransform(b []byte) []byte
- func NoOpTransform(b []byte) []byte
- func SuffixTransform(b []byte) []byte
- type ID
- func (id ID) Contains(aggType Type) bool
- func (id ID) Equal(other ID) bool
- func (id *ID) FromProto(pb aggregationpb.AggregationID) error
- func (id ID) IsDefault() bool
- func (id ID) MarshalJSON() ([]byte, error)
- func (id ID) MarshalYAML() (interface{}, error)
- func (id ID) String() string
- func (id ID) ToProto(pb *aggregationpb.AggregationID) error
- func (id ID) Types() (Types, error)
- func (id *ID) UnmarshalJSON(data []byte) error
- func (id *ID) UnmarshalYAML(unmarshal func(interface{}) error) error
- type IDCompressor
- type IDDecompressor
- type QuantileTypeStringFn
- type Type
- func (i Type) Bytes() []byte
- func (a Type) ID() int
- func (a Type) IsValid() bool
- func (a Type) IsValidForCounter() bool
- func (a Type) IsValidForGauge() bool
- func (a Type) IsValidForTimer() bool
- func (a Type) MarshalText() ([]byte, error)
- func (a Type) Name() []byte
- func (a Type) Proto() (aggregationpb.AggregationType, error)
- func (a Type) Quantile() (float64, bool)
- func (i Type) String() string
- func (a *Type) UnmarshalText(data []byte) error
- func (a *Type) UnmarshalYAML(unmarshal func(interface{}) error) error
- type TypeStringTransformFn
- type Types
- func (aggTypes Types) Contains(aggType Type) bool
- func (aggTypes Types) IsDefault() bool
- func (aggTypes Types) IsValidForCounter() bool
- func (aggTypes Types) IsValidForGauge() bool
- func (aggTypes Types) IsValidForTimer() bool
- func (aggTypes Types) PooledQuantiles(p pool.FloatsPool) ([]float64, bool)
- func (aggTypes Types) Proto() ([]aggregationpb.AggregationType, error)
- func (aggTypes Types) String() string
- type TypesAlloc
- type TypesConfiguration
- type TypesOptions
- type TypesPool
Constants ¶
const ( // IDLen is the length of the ID. // The IDLen will be 1 when maxTypeID <= 63. IDLen = (maxTypeID)/64 + 1 )
Variables ¶
This section is empty.
Functions ¶
func EmptyTransform ¶
EmptyTransform transforms the input byte slice to an empty byte slice.
func NoOpTransform ¶
NoOpTransform returns the input byte slice as is.
func SuffixTransform ¶
SuffixTransform transforms the input byte slice to a suffix by prepending a dot at the beginning.
Types ¶
type ID ¶
ID represents a compressed view of Types.
var ( // DefaultID is a default ID. DefaultID ID )
func CompressTypes ¶
CompressTypes compresses a list of aggregation types to an ID.
func MustCompressTypes ¶
MustCompressTypes compresses a list of aggregation types to an ID, it panics if an error was encountered.
func NewIDFromProto ¶
func NewIDFromProto(input []aggregationpb.AggregationType) (ID, error)
NewIDFromProto creates an ID from proto.
func (ID) Contains ¶
Contains checks if the given aggregation type is contained in the aggregation id.
func (*ID) FromProto ¶
func (id *ID) FromProto(pb aggregationpb.AggregationID) error
FromProto converts the protobuf message to an aggregation id in place.
func (ID) MarshalJSON ¶
MarshalJSON returns the JSON encoding of an ID.
func (ID) MarshalYAML ¶ added in v0.12.0
func (ID) ToProto ¶
func (id ID) ToProto(pb *aggregationpb.AggregationID) error
ToProto converts the aggregation id to a protobuf message in place.
func (*ID) UnmarshalJSON ¶
UnmarshalJSON unmarshals JSON-encoded data into an ID.
func (*ID) UnmarshalYAML ¶
UnmarshalYAML unmarshals YAML-encoded data into an ID.
type IDCompressor ¶
type IDCompressor interface { // Compress compresses a set of aggregation types into an aggregation id. Compress(aggTypes Types) (ID, error) // MustCompress compresses a set of aggregation types into an aggregation id, // and panics if an error is encountered. MustCompress(aggTypes Types) ID }
IDCompressor can compress Types into an ID.
func NewIDCompressor ¶
func NewIDCompressor() IDCompressor
NewIDCompressor returns a new IDCompressor.
type IDDecompressor ¶
type IDDecompressor interface { // Decompress decompresses an aggregation id into a set of aggregation types. Decompress(id ID) (Types, error) // MustDecompress decompresses an aggregation id into a set of aggregation types, // and panics if an error is encountered. MustDecompress(id ID) Types }
IDDecompressor can decompress ID.
func NewIDDecompressor ¶
func NewIDDecompressor() IDDecompressor
NewIDDecompressor returns a new IDDecompressor.
func NewPooledIDDecompressor ¶
func NewPooledIDDecompressor(pool TypesPool) IDDecompressor
NewPooledIDDecompressor returns a new pooled TypeDecompressor.
type QuantileTypeStringFn ¶
QuantileTypeStringFn returns the type string for a quantile value.
type Type ¶
type Type int
Type defines an aggregation function.
const ( UnknownType Type = iota Last Min Max Mean Median Count Sum SumSq Stdev P10 P20 P30 P40 P50 P60 P70 P80 P90 P95 P99 P999 P9999 )
Supported aggregation types.
func NewTypeFromProto ¶
func NewTypeFromProto(input aggregationpb.AggregationType) (Type, error)
NewTypeFromProto creates an aggregation type from a proto.
func (Type) IsValidForCounter ¶
IsValidForCounter if an Type is valid for Counter.
func (Type) IsValidForGauge ¶
IsValidForGauge if an Type is valid for Gauge.
func (Type) IsValidForTimer ¶
IsValidForTimer if an Type is valid for Timer.
func (Type) MarshalText ¶ added in v0.12.0
MarshalText returns the text encoding of an aggregation type.
func (Type) Proto ¶
func (a Type) Proto() (aggregationpb.AggregationType, error)
Proto returns the proto of the aggregation type.
func (*Type) UnmarshalText ¶ added in v0.12.0
UnmarshalText unmarshals text-encoded data into an aggregation type.
func (*Type) UnmarshalYAML ¶
UnmarshalYAML unmarshals text-encoded data into an aggregation type.
type TypeStringTransformFn ¶
TypeStringTransformFn transforms the type string.
type Types ¶
type Types []Type
Types is a list of Types.
var ( // DefaultTypes is a default list of aggregation types. DefaultTypes Types // ValidTypes is the list of all the valid aggregation types. ValidTypes = map[Type]struct{}{ Last: emptyStruct, Min: emptyStruct, Max: emptyStruct, Mean: emptyStruct, Median: emptyStruct, Count: emptyStruct, Sum: emptyStruct, SumSq: emptyStruct, Stdev: emptyStruct, P10: emptyStruct, P20: emptyStruct, P30: emptyStruct, P40: emptyStruct, P50: emptyStruct, P60: emptyStruct, P70: emptyStruct, P80: emptyStruct, P90: emptyStruct, P95: emptyStruct, P99: emptyStruct, P999: emptyStruct, P9999: emptyStruct, } )
func NewTypesFromProto ¶
func NewTypesFromProto(input []aggregationpb.AggregationType) (Types, error)
NewTypesFromProto creates a list of aggregation types from a proto.
func ParseTypes ¶
ParseTypes parses a list of aggregation types in the form of type1,type2,type3.
func (Types) IsValidForCounter ¶
IsValidForCounter checks if the list of aggregation types is valid for Counter.
func (Types) IsValidForGauge ¶
IsValidForGauge checks if the list of aggregation types is valid for Gauge.
func (Types) IsValidForTimer ¶
IsValidForTimer checks if the list of aggregation types is valid for Timer.
func (Types) PooledQuantiles ¶
func (aggTypes Types) PooledQuantiles(p pool.FloatsPool) ([]float64, bool)
PooledQuantiles returns all the quantiles found in the list of aggregation types. Using a floats pool if available.
A boolean will also be returned to indicate whether the returned float slice is from the pool.
func (Types) Proto ¶
func (aggTypes Types) Proto() ([]aggregationpb.AggregationType, error)
Proto returns the proto of the aggregation types.
type TypesConfiguration ¶
type TypesConfiguration struct { // Default aggregation types for counter metrics. DefaultCounterAggregationTypes *Types `yaml:"defaultCounterAggregationTypes"` // Default aggregation types for timer metrics. DefaultTimerAggregationTypes *Types `yaml:"defaultTimerAggregationTypes"` // Default aggregation types for gauge metrics. DefaultGaugeAggregationTypes *Types `yaml:"defaultGaugeAggregationTypes"` // CounterTransformFnType configures the type string transformation function for counters. CounterTransformFnType *transformFnType `yaml:"counterTransformFnType"` // TimerTransformFnType configures the type string transformation function for timers. TimerTransformFnType *transformFnType `yaml:"timerTransformFnType"` // GaugeTransformFnType configures the type string transformation function for gauges. GaugeTransformFnType *transformFnType `yaml:"gaugeTransformFnType"` // Pool of aggregation types. AggregationTypesPool pool.ObjectPoolConfiguration `yaml:"aggregationTypesPool"` // Pool of quantile slices. QuantilesPool pool.BucketizedPoolConfiguration `yaml:"quantilesPool"` }
TypesConfiguration contains configuration for aggregation types.
func (TypesConfiguration) NewOptions ¶
func (c TypesConfiguration) NewOptions(instrumentOpts instrument.Options) (TypesOptions, error)
NewOptions creates a new Option.
type TypesOptions ¶
type TypesOptions interface { // SetDefaultCounterAggregationTypes sets the default aggregation types for counters. SetDefaultCounterAggregationTypes(value Types) TypesOptions // DefaultCounterAggregationTypes returns the default aggregation types for counters. DefaultCounterAggregationTypes() Types // SetDefaultTimerAggregationTypes sets the default aggregation types for timers. SetDefaultTimerAggregationTypes(value Types) TypesOptions // DefaultTimerAggregationTypes returns the default aggregation types for timers. DefaultTimerAggregationTypes() Types // SetDefaultGaugeAggregationTypes sets the default aggregation types for gauges. SetDefaultGaugeAggregationTypes(value Types) TypesOptions // DefaultGaugeAggregationTypes returns the default aggregation types for gauges. DefaultGaugeAggregationTypes() Types // SetQuantileTypeStringFn sets the quantile type string function for timers. SetQuantileTypeStringFn(value QuantileTypeStringFn) TypesOptions // QuantileTypeStringFn returns the quantile type string function for timers. QuantileTypeStringFn() QuantileTypeStringFn // SetCounterTypeStringTransformFn sets the transformation function for counter type strings. SetCounterTypeStringTransformFn(value TypeStringTransformFn) TypesOptions // CounterTypeStringTransformFn returns the transformation function for counter type strings. CounterTypeStringTransformFn() TypeStringTransformFn // SetTimerTypeStringTransformFn sets the transformation function for timer type strings. SetTimerTypeStringTransformFn(value TypeStringTransformFn) TypesOptions // TimerTypeStringTransformFn returns the transformation function for timer type strings. TimerTypeStringTransformFn() TypeStringTransformFn // SetGaugeTypeStringTransformFn sets the transformation function for gauge type strings. SetGaugeTypeStringTransformFn(value TypeStringTransformFn) TypesOptions // GaugeTypeStringTransformFn returns the transformation function for gauge type strings. GaugeTypeStringTransformFn() TypeStringTransformFn // SetTypesPool sets the aggregation types pool. SetTypesPool(pool TypesPool) TypesOptions // TypesPool returns the aggregation types pool. TypesPool() TypesPool // SetQuantilesPool sets the timer quantiles pool. SetQuantilesPool(pool pool.FloatsPool) TypesOptions // QuantilesPool returns the timer quantiles pool. QuantilesPool() pool.FloatsPool // TypeStringForCounter returns the type string for the aggregation type for counters. TypeStringForCounter(value Type) []byte // TypeStringForTimer returns the type string for the aggregation type for timers. TypeStringForTimer(value Type) []byte // TypeStringForGauge returns the type string for the aggregation type for gauges. TypeStringForGauge(value Type) []byte // TypeForCounter returns the aggregation type for given counter type string. TypeForCounter(value []byte) Type // TypeForTimer returns the aggregation type for given timer type string. TypeForTimer(value []byte) Type // TypeForGauge returns the aggregation type for given gauge type string. TypeForGauge(value []byte) Type // Quantiles returns the quantiles for timers. Quantiles() []float64 // IsContainedInDefaultAggregationTypes checks if the given aggregation type is // contained in the default aggregation types for the metric type. IsContainedInDefaultAggregationTypes(at Type, mt metric.Type) bool }
TypesOptions provides a set of options for aggregation types.
func NewTypesOptions ¶
func NewTypesOptions() TypesOptions
NewTypesOptions returns a default TypesOptions.
type TypesPool ¶
type TypesPool interface { // Init initializes the aggregation types pool. Init(alloc TypesAlloc) // Get gets an empty list of aggregation types from the pool. Get() Types // Put returns aggregation types to the pool. Put(value Types) }
TypesPool provides a pool of aggregation types.
func NewTypesPool ¶
func NewTypesPool(opts pool.ObjectPoolOptions) TypesPool
NewTypesPool creates a new pool for aggregation types.