Documentation ¶
Index ¶
- Constants
- Variables
- func BucketNameOfHistogramExplicitBound(upperBound float64) string
- func UpperBound(bucketName string) (float64, error)
- type BrokerBatchRows
- func (br *BrokerBatchRows) EvictOutOfTimeRange(behind, ahead int64) (evicted int)
- func (br *BrokerBatchRows) Len() int
- func (br *BrokerBatchRows) Less(i, j int) bool
- func (br *BrokerBatchRows) NewShardGroupIterator(numOfShards int32) *BrokerBatchShardIterator
- func (br *BrokerBatchRows) Release()
- func (br *BrokerBatchRows) Rows() []BrokerRow
- func (br *BrokerBatchRows) Swap(i, j int)
- func (br *BrokerBatchRows) TryAppend(appendFunc func(row *BrokerRow) error) error
- type BrokerBatchShardFamilyIterator
- type BrokerBatchShardIterator
- type BrokerRow
- type BrokerRowFlatDecoder
- type BrokerRowProtoConverter
- func (rc *BrokerRowProtoConverter) ConvertTo(m *protoMetricsV1.Metric, row *BrokerRow) error
- func (rc *BrokerRowProtoConverter) MarshalProtoMetricListV1To(ml protoMetricsV1.MetricList, writer io.Writer) (n int, err error)
- func (rc *BrokerRowProtoConverter) MarshalProtoMetricV1(m *protoMetricsV1.Metric) ([]byte, error)
- func (rc *BrokerRowProtoConverter) MarshalProtoMetricV1To(m *protoMetricsV1.Metric, writer io.Writer) (n int, err error)
- func (rc *BrokerRowProtoConverter) Reset()
- type CompoundFieldIterator
- func (itr *CompoundFieldIterator) BucketLen() int
- func (itr *CompoundFieldIterator) BucketName() field.Name
- func (itr *CompoundFieldIterator) Count() float64
- func (itr *CompoundFieldIterator) HasNextBucket() bool
- func (itr *CompoundFieldIterator) HistogramCountFieldName() field.Name
- func (itr *CompoundFieldIterator) HistogramMaxFieldName() field.Name
- func (itr *CompoundFieldIterator) HistogramMinFieldName() field.Name
- func (itr *CompoundFieldIterator) HistogramSumFieldName() field.Name
- func (itr *CompoundFieldIterator) Max() float64
- func (itr *CompoundFieldIterator) Min() float64
- func (itr *CompoundFieldIterator) NextExplicitBound() float64
- func (itr *CompoundFieldIterator) NextValue() float64
- func (itr *CompoundFieldIterator) Reset()
- func (itr *CompoundFieldIterator) Sum() float64
- type ID
- type KeyValueIterator
- type SimpleFieldIterator
- func (itr *SimpleFieldIterator) HasNext() bool
- func (itr *SimpleFieldIterator) Len() int
- func (itr *SimpleFieldIterator) NextName() field.Name
- func (itr *SimpleFieldIterator) NextRawName() []byte
- func (itr *SimpleFieldIterator) NextRawType() flatMetricsV1.SimpleFieldType
- func (itr *SimpleFieldIterator) NextType() field.Type
- func (itr *SimpleFieldIterator) NextValue() float64
- func (itr *SimpleFieldIterator) Reset()
- type StorageBatchRows
- type StorageRow
- func (mr *StorageRow) Name() []byte
- func (mr *StorageRow) NameSpace() []byte
- func (mr *StorageRow) NewCompoundFieldIterator() (*CompoundFieldIterator, bool)
- func (mr *StorageRow) NewKeyValueIterator() *KeyValueIterator
- func (mr *StorageRow) NewSimpleFieldIterator() *SimpleFieldIterator
- func (mr *StorageRow) SimpleFieldsLen() int
- func (mr *StorageRow) TagsHash() uint64
- func (mr *StorageRow) TagsLen() int
- func (mr *StorageRow) Timestamp() int64
- func (mr *StorageRow) Unmarshal(data []byte)
Constants ¶
const EmptyMetricID = ID(0)
EmptyMetricID represents empty value for metric id.
Variables ¶
var ( // ErrBadMetricPBFormat represents write bad pb format ErrBadMetricPBFormat = errors.New("bad metric proto") ErrMetricPBNilMetric = fmt.Errorf("%w, metric is nil", ErrBadMetricPBFormat) // ErrMetricPBEmptyMetricName represents metric name is empty when write data ErrMetricPBEmptyMetricName = fmt.Errorf("%w, metric name is empty", ErrBadMetricPBFormat) ErrMetricEmptyTagKeyValue = fmt.Errorf("%w tag key value is empty", ErrBadMetricPBFormat) // ErrMetricPBEmptyField represents field is empty when write data ErrMetricPBEmptyField = fmt.Errorf("%w, fields are empty", ErrBadMetricPBFormat) // ErrMetricEmptyFieldName represents that field-name is empty in pb structure ErrMetricEmptyFieldName = fmt.Errorf("%w, field name is empty", ErrBadMetricPBFormat) // ErrMetricNanField represents field value is not a number ErrMetricNanField = fmt.Errorf("%w, field is not a number", ErrBadMetricPBFormat) // ErrMetricInfField represents field value is infinity, positive or negative ErrMetricInfField = fmt.Errorf("%w, field is infinity", ErrBadMetricPBFormat) )
Functions ¶
func BucketNameOfHistogramExplicitBound ¶
BucketNameOfHistogramExplicitBound converts reserved field-name for histogram buckets.
func UpperBound ¶
UpperBound extracts the upper-bound from bucketName
Types ¶
type BrokerBatchRows ¶
type BrokerBatchRows struct {
// contains filtered or unexported fields
}
BrokerBatchRows holds rows from ingestion row will be putted into buffer after validation and re-building
func NewBrokerBatchRows ¶
func NewBrokerBatchRows() (batch *BrokerBatchRows)
NewBrokerBatchRows returns a new batch for decoding flat metrics.
func (*BrokerBatchRows) EvictOutOfTimeRange ¶
func (br *BrokerBatchRows) EvictOutOfTimeRange(behind, ahead int64) (evicted int)
EvictOutOfTimeRange evicts and marks out-of-range metrics invalid
func (*BrokerBatchRows) Len ¶
func (br *BrokerBatchRows) Len() int
func (*BrokerBatchRows) Less ¶
func (br *BrokerBatchRows) Less(i, j int) bool
func (*BrokerBatchRows) NewShardGroupIterator ¶
func (br *BrokerBatchRows) NewShardGroupIterator(numOfShards int32) *BrokerBatchShardIterator
func (*BrokerBatchRows) Release ¶
func (br *BrokerBatchRows) Release()
Release releases rows context into sync.Pool
func (*BrokerBatchRows) Rows ¶
func (br *BrokerBatchRows) Rows() []BrokerRow
func (*BrokerBatchRows) Swap ¶
func (br *BrokerBatchRows) Swap(i, j int)
type BrokerBatchShardFamilyIterator ¶
type BrokerBatchShardFamilyIterator struct {
// contains filtered or unexported fields
}
BrokerBatchShardFamilyIterator grouping broker rows with families rows will be batched inserted into shard-channel for replication
func (*BrokerBatchShardFamilyIterator) HasNextFamily ¶
func (itr *BrokerBatchShardFamilyIterator) HasNextFamily() bool
func (*BrokerBatchShardFamilyIterator) NextFamily ¶
func (itr *BrokerBatchShardFamilyIterator) NextFamily() (familyTime int64, rows []BrokerRow)
type BrokerBatchShardIterator ¶
type BrokerBatchShardIterator struct {
// contains filtered or unexported fields
}
BrokerBatchShardIterator grouping broker rows with shard-id, rows will be batched inserted into shard-channel for replication
func (*BrokerBatchShardIterator) FamilyRowsForNextShard ¶
func (itr *BrokerBatchShardIterator) FamilyRowsForNextShard( interval timeutil.Interval, ) ( shardIdx int, familyIterator *BrokerBatchShardFamilyIterator, )
func (*BrokerBatchShardIterator) HasRowsForNextShard ¶
func (itr *BrokerBatchShardIterator) HasRowsForNextShard() bool
func (*BrokerBatchShardIterator) Reset ¶
func (itr *BrokerBatchShardIterator) Reset()
Reset re-sorts batch rows for batching inserting
type BrokerRow ¶
type BrokerRow struct { // IsOutOfTimeRange marks if this row is out-of time-range // data is not accessible when its set to true IsOutOfTimeRange bool // contains filtered or unexported fields }
func (*BrokerRow) FromBlock ¶
FromBlock resets buffer, unmarshal from a new block, make sure that metric and shard id will be overwritten manually
func (*BrokerRow) Metric ¶
func (row *BrokerRow) Metric() flatMetricsV1.Metric
type BrokerRowFlatDecoder ¶
type BrokerRowFlatDecoder struct {
// contains filtered or unexported fields
}
func NewBrokerRowFlatDecoder ¶
func NewBrokerRowFlatDecoder( reader io.Reader, namespace []byte, enrichedTags tag.Tags, limits *models.Limits, ) ( decoder *BrokerRowFlatDecoder, releaseFunc func(decoder *BrokerRowFlatDecoder), )
func (*BrokerRowFlatDecoder) DecodeTo ¶
func (itr *BrokerRowFlatDecoder) DecodeTo(row *BrokerRow) error
DecodeTo decodes next flat block into BrokerRow
func (*BrokerRowFlatDecoder) HasNext ¶
func (itr *BrokerRowFlatDecoder) HasNext() bool
HasNext checks if the raw block is fully decode
func (*BrokerRowFlatDecoder) ReadLen ¶
func (itr *BrokerRowFlatDecoder) ReadLen() int
type BrokerRowProtoConverter ¶
type BrokerRowProtoConverter struct {
// contains filtered or unexported fields
}
func NewBrokerRowProtoConverter ¶
func NewBrokerRowProtoConverter( namespace []byte, enrichedTags tag.Tags, limits *models.Limits, ) ( cvt *BrokerRowProtoConverter, releaseFunc func(cvt *BrokerRowProtoConverter), )
NewBrokerRowProtoConverter returns a new converter for converting proto metrics into flat metrics. namespace and enrichedTags will also be bound to the metric
func NewProtoConverter ¶
func NewProtoConverter(limits *models.Limits) *BrokerRowProtoConverter
NewProtoConverter returns a converter for converting proto metrics into flat metric
func (*BrokerRowProtoConverter) ConvertTo ¶
func (rc *BrokerRowProtoConverter) ConvertTo(m *protoMetricsV1.Metric, row *BrokerRow) error
ConvertTo converts the proto metric into BrokerRow
func (*BrokerRowProtoConverter) MarshalProtoMetricListV1To ¶
func (rc *BrokerRowProtoConverter) MarshalProtoMetricListV1To(ml protoMetricsV1.MetricList, writer io.Writer) (n int, err error)
func (*BrokerRowProtoConverter) MarshalProtoMetricV1 ¶
func (rc *BrokerRowProtoConverter) MarshalProtoMetricV1(m *protoMetricsV1.Metric) ([]byte, error)
func (*BrokerRowProtoConverter) MarshalProtoMetricV1To ¶
func (rc *BrokerRowProtoConverter) MarshalProtoMetricV1To(m *protoMetricsV1.Metric, writer io.Writer) (n int, err error)
func (*BrokerRowProtoConverter) Reset ¶
func (rc *BrokerRowProtoConverter) Reset()
Reset resets all data-structures
type CompoundFieldIterator ¶
type CompoundFieldIterator struct {
// contains filtered or unexported fields
}
func (*CompoundFieldIterator) BucketLen ¶
func (itr *CompoundFieldIterator) BucketLen() int
func (*CompoundFieldIterator) BucketName ¶
func (itr *CompoundFieldIterator) BucketName() field.Name
func (*CompoundFieldIterator) Count ¶
func (itr *CompoundFieldIterator) Count() float64
func (*CompoundFieldIterator) HasNextBucket ¶
func (itr *CompoundFieldIterator) HasNextBucket() bool
func (*CompoundFieldIterator) HistogramCountFieldName ¶
func (itr *CompoundFieldIterator) HistogramCountFieldName() field.Name
func (*CompoundFieldIterator) HistogramMaxFieldName ¶
func (itr *CompoundFieldIterator) HistogramMaxFieldName() field.Name
func (*CompoundFieldIterator) HistogramMinFieldName ¶
func (itr *CompoundFieldIterator) HistogramMinFieldName() field.Name
func (*CompoundFieldIterator) HistogramSumFieldName ¶
func (itr *CompoundFieldIterator) HistogramSumFieldName() field.Name
func (*CompoundFieldIterator) Max ¶
func (itr *CompoundFieldIterator) Max() float64
func (*CompoundFieldIterator) Min ¶
func (itr *CompoundFieldIterator) Min() float64
func (*CompoundFieldIterator) NextExplicitBound ¶
func (itr *CompoundFieldIterator) NextExplicitBound() float64
func (*CompoundFieldIterator) NextValue ¶
func (itr *CompoundFieldIterator) NextValue() float64
func (*CompoundFieldIterator) Reset ¶
func (itr *CompoundFieldIterator) Reset()
func (*CompoundFieldIterator) Sum ¶
func (itr *CompoundFieldIterator) Sum() float64
type KeyValueIterator ¶
type KeyValueIterator struct {
// contains filtered or unexported fields
}
func (*KeyValueIterator) HasNext ¶
func (itr *KeyValueIterator) HasNext() bool
func (*KeyValueIterator) Len ¶
func (itr *KeyValueIterator) Len() int
func (*KeyValueIterator) NextKey ¶
func (itr *KeyValueIterator) NextKey() []byte
func (*KeyValueIterator) NextValue ¶
func (itr *KeyValueIterator) NextValue() []byte
func (*KeyValueIterator) Reset ¶
func (itr *KeyValueIterator) Reset()
type SimpleFieldIterator ¶
type SimpleFieldIterator struct {
// contains filtered or unexported fields
}
func (*SimpleFieldIterator) HasNext ¶
func (itr *SimpleFieldIterator) HasNext() bool
func (*SimpleFieldIterator) Len ¶
func (itr *SimpleFieldIterator) Len() int
func (*SimpleFieldIterator) NextName ¶
func (itr *SimpleFieldIterator) NextName() field.Name
func (*SimpleFieldIterator) NextRawName ¶
func (itr *SimpleFieldIterator) NextRawName() []byte
func (*SimpleFieldIterator) NextRawType ¶
func (itr *SimpleFieldIterator) NextRawType() flatMetricsV1.SimpleFieldType
func (*SimpleFieldIterator) NextType ¶
func (itr *SimpleFieldIterator) NextType() field.Type
func (*SimpleFieldIterator) NextValue ¶
func (itr *SimpleFieldIterator) NextValue() float64
func (*SimpleFieldIterator) Reset ¶
func (itr *SimpleFieldIterator) Reset()
Reset iterator for re-iterating simpleFields
type StorageBatchRows ¶
type StorageBatchRows struct {
// contains filtered or unexported fields
}
StorageBatchRows holds multi rows for inserting into memdb It is reused in sync.Pool
func NewStorageBatchRows ¶
func NewStorageBatchRows() (ctx *StorageBatchRows)
NewStorageBatchRows returns write-context for batch writing.
func (*StorageBatchRows) Len ¶
func (br *StorageBatchRows) Len() int
func (*StorageBatchRows) Less ¶
func (br *StorageBatchRows) Less(i, j int) bool
func (*StorageBatchRows) Rows ¶
func (br *StorageBatchRows) Rows() []StorageRow
func (*StorageBatchRows) Swap ¶
func (br *StorageBatchRows) Swap(i, j int)
func (*StorageBatchRows) UnmarshalRows ¶
func (br *StorageBatchRows) UnmarshalRows(rowsBlock []byte)
type StorageRow ¶
type StorageRow struct { MetricID ID SeriesID uint32 SlotIndex uint16 FieldIDs []field.ID Writable bool // Writable symbols if all meta information is set // contains filtered or unexported fields }
StorageRow represents a metric row with meta information and fields.
func (*StorageRow) NewCompoundFieldIterator ¶
func (mr *StorageRow) NewCompoundFieldIterator() (*CompoundFieldIterator, bool)
func (*StorageRow) NewKeyValueIterator ¶
func (mr *StorageRow) NewKeyValueIterator() *KeyValueIterator
func (*StorageRow) NewSimpleFieldIterator ¶
func (mr *StorageRow) NewSimpleFieldIterator() *SimpleFieldIterator
func (*StorageRow) SimpleFieldsLen ¶
func (mr *StorageRow) SimpleFieldsLen() int
func (*StorageRow) Unmarshal ¶
func (mr *StorageRow) Unmarshal(data []byte)
Unmarshal unmarshalls bytes slice into a metric-row without metric context