Documentation ¶
Index ¶
- Constants
- Variables
- func DeserializeToSeriesGroup(sg *SeriesGroup, buf []byte) ([]types.Datum, error)
- func PutTimeSeriesIntoPool(ts *TimeSeriesBinary)
- func PutTimeSeriesSliceIntoPool(tss []*TimeSeriesBinary)
- func ToPromBucketSpans(bss []BucketSpan) []prompb.BucketSpan
- type BucketSpan
- func (z *BucketSpan) DecodeMsg(dc *msgp.Reader) (err error)
- func (z BucketSpan) EncodeMsg(en *msgp.Writer) (err error)
- func (z BucketSpan) MarshalMsg(b []byte) (o []byte, err error)
- func (z BucketSpan) Msgsize() (s int)
- func (bs *BucketSpan) ToPromBucketSpan() prompb.BucketSpan
- func (z *BucketSpan) UnmarshalMsg(bts []byte) (o []byte, err error)
- type ByteString
- func (z *ByteString) DecodeMsg(dc *msgp.Reader) (err error)
- func (z ByteString) EncodeMsg(en *msgp.Writer) (err error)
- func (z ByteString) MarshalMsg(b []byte) (o []byte, err error)
- func (z ByteString) Msgsize() (s int)
- func (v ByteString) String() string
- func (v *ByteString) UnmarshalMsg(bts []byte) (o []byte, err error)
- type FloatHistogram
- func (z *FloatHistogram) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *FloatHistogram) EncodeMsg(en *msgp.Writer) (err error)
- func (z *FloatHistogram) MarshalMsg(b []byte) (o []byte, err error)
- func (z *FloatHistogram) Msgsize() (s int)
- func (h *FloatHistogram) ToPromFloatHistogram() prompb.Histogram
- func (z *FloatHistogram) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Histogram
- func (z *Histogram) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *Histogram) EncodeMsg(en *msgp.Writer) (err error)
- func (z *Histogram) MarshalMsg(b []byte) (o []byte, err error)
- func (z *Histogram) Msgsize() (s int)
- func (h *Histogram) ToPromHistogram() prompb.Histogram
- func (z *Histogram) UnmarshalMsg(bts []byte) (o []byte, err error)
- type HistogramCount
- func (z *HistogramCount) DecodeMsg(dc *msgp.Reader) (err error)
- func (z HistogramCount) EncodeMsg(en *msgp.Writer) (err error)
- func (z HistogramCount) MarshalMsg(b []byte) (o []byte, err error)
- func (z HistogramCount) Msgsize() (s int)
- func (z *HistogramCount) UnmarshalMsg(bts []byte) (o []byte, err error)
- type HistogramZeroCount
- func (z *HistogramZeroCount) DecodeMsg(dc *msgp.Reader) (err error)
- func (z HistogramZeroCount) EncodeMsg(en *msgp.Writer) (err error)
- func (z HistogramZeroCount) MarshalMsg(b []byte) (o []byte, err error)
- func (z HistogramZeroCount) Msgsize() (s int)
- func (z *HistogramZeroCount) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Histograms
- type LabelHandle
- type LabelHandles
- type Serialization
- func (s *Serialization) AddPrometheusMetadata(name string, unit string, help string, pType string) error
- func (s *Serialization) AddPrometheusMetric(ts int64, value float64, lbls labels.Labels, h *histogram.Histogram, ...) error
- func (s *Serialization) Marshal(handle func(map[string]string, []byte) error) error
- func (s *Serialization) Unmarshal(_ map[string]string, buf []byte) (items []types.Datum, err error)
- type SeriesGroup
- type TimeSeriesBinary
- func (z *TimeSeriesBinary) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *TimeSeriesBinary) EncodeMsg(en *msgp.Writer) (err error)
- func (ts *TimeSeriesBinary) FromFloatHistogram(timestamp int64, h *histogram.FloatHistogram)
- func (ts *TimeSeriesBinary) FromHistogram(timestamp int64, h *histogram.Histogram)
- func (z *TimeSeriesBinary) MarshalMsg(b []byte) (o []byte, err error)
- func (z *TimeSeriesBinary) Msgsize() (s int)
- func (z *TimeSeriesBinary) UnmarshalMsg(bts []byte) (o []byte, err error)
Constants ¶
const MetaHelp = "__alloy_metadata_help__"
const MetaType = "__alloy_metadata_type__"
const MetaUnit = "__alloy_metadata_unit__"
Variables ¶
var OutStandingTimeSeriesBinary = atomic.Int32{}
Functions ¶
func DeserializeToSeriesGroup ¶
func DeserializeToSeriesGroup(sg *SeriesGroup, buf []byte) ([]types.Datum, error)
DeserializeToSeriesGroup transforms a buffer to a SeriesGroup and converts the stringmap + indexes into actual Labels.
func PutTimeSeriesIntoPool ¶
func PutTimeSeriesIntoPool(ts *TimeSeriesBinary)
func PutTimeSeriesSliceIntoPool ¶
func PutTimeSeriesSliceIntoPool(tss []*TimeSeriesBinary)
func ToPromBucketSpans ¶
func ToPromBucketSpans(bss []BucketSpan) []prompb.BucketSpan
Types ¶
type BucketSpan ¶
func FromPromSpan ¶
func FromPromSpan(spans []histogram.Span) []BucketSpan
func (*BucketSpan) DecodeMsg ¶
func (z *BucketSpan) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (BucketSpan) EncodeMsg ¶
func (z BucketSpan) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (BucketSpan) MarshalMsg ¶
func (z BucketSpan) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (BucketSpan) Msgsize ¶
func (z BucketSpan) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*BucketSpan) ToPromBucketSpan ¶
func (bs *BucketSpan) ToPromBucketSpan() prompb.BucketSpan
func (*BucketSpan) UnmarshalMsg ¶
func (z *BucketSpan) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type ByteString ¶
type ByteString []byte
func (*ByteString) DecodeMsg ¶
func (z *ByteString) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (ByteString) EncodeMsg ¶
func (z ByteString) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (ByteString) MarshalMsg ¶
func (z ByteString) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (ByteString) Msgsize ¶
func (z ByteString) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (ByteString) String ¶
func (v ByteString) String() string
String returns the underlying bytes as a string without copying. This is a huge performance win with no side effect as long as the underlying byte slice is not reused. In this case it is not.
func (*ByteString) UnmarshalMsg ¶
func (v *ByteString) UnmarshalMsg(bts []byte) (o []byte, err error)
type FloatHistogram ¶
type FloatHistogram struct { Count HistogramCount Sum float64 Schema int32 ZeroThreshold float64 ZeroCount HistogramZeroCount NegativeSpans []BucketSpan NegativeDeltas []int64 NegativeCounts []float64 PositiveSpans []BucketSpan PositiveDeltas []int64 PositiveCounts []float64 ResetHint int32 TimestampMillisecond int64 }
func (*FloatHistogram) DecodeMsg ¶
func (z *FloatHistogram) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*FloatHistogram) EncodeMsg ¶
func (z *FloatHistogram) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*FloatHistogram) MarshalMsg ¶
func (z *FloatHistogram) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*FloatHistogram) Msgsize ¶
func (z *FloatHistogram) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*FloatHistogram) ToPromFloatHistogram ¶
func (h *FloatHistogram) ToPromFloatHistogram() prompb.Histogram
func (*FloatHistogram) UnmarshalMsg ¶
func (z *FloatHistogram) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Histogram ¶
type Histogram struct { Count HistogramCount Sum float64 Schema int32 ZeroThreshold float64 ZeroCount HistogramZeroCount NegativeSpans []BucketSpan NegativeBuckets []int64 NegativeCounts []float64 PositiveSpans []BucketSpan PositiveBuckets []int64 PositiveCounts []float64 ResetHint int32 TimestampMillisecond int64 }
func (*Histogram) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (*Histogram) Msgsize ¶
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*Histogram) ToPromHistogram ¶
type HistogramCount ¶
func (*HistogramCount) DecodeMsg ¶
func (z *HistogramCount) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (HistogramCount) EncodeMsg ¶
func (z HistogramCount) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (HistogramCount) MarshalMsg ¶
func (z HistogramCount) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (HistogramCount) Msgsize ¶
func (z HistogramCount) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*HistogramCount) UnmarshalMsg ¶
func (z *HistogramCount) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type HistogramZeroCount ¶
func (*HistogramZeroCount) DecodeMsg ¶
func (z *HistogramZeroCount) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (HistogramZeroCount) EncodeMsg ¶
func (z HistogramZeroCount) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (HistogramZeroCount) MarshalMsg ¶
func (z HistogramZeroCount) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (HistogramZeroCount) Msgsize ¶
func (z HistogramZeroCount) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*HistogramZeroCount) UnmarshalMsg ¶
func (z *HistogramZeroCount) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Histograms ¶
type Histograms struct { Histogram *Histogram FloatHistogram *FloatHistogram }
func (*Histograms) DecodeMsg ¶
func (z *Histograms) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*Histograms) EncodeMsg ¶
func (z *Histograms) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*Histograms) MarshalMsg ¶
func (z *Histograms) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*Histograms) Msgsize ¶
func (z *Histograms) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*Histograms) UnmarshalMsg ¶
func (z *Histograms) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type LabelHandle ¶
type LabelHandles ¶
type LabelHandles []LabelHandle
func (LabelHandles) Get ¶
func (lh LabelHandles) Get(name string) string
func (LabelHandles) Has ¶
func (lh LabelHandles) Has(name string) bool
type Serialization ¶
type Serialization struct {
// contains filtered or unexported fields
}
func GetSerializer ¶
func GetSerializer() *Serialization
func (*Serialization) AddPrometheusMetadata ¶
func (*Serialization) AddPrometheusMetric ¶
type SeriesGroup ¶
type SeriesGroup struct { Strings []ByteString Series []*TimeSeriesBinary Metadata []*TimeSeriesBinary }
SeriesGroup is the holder for TimeSeries, Metadata, and the strings array. When serialized the Labels Key,Value array will be transformed into LabelNames and LabelsValues that point to the index in Strings. This deduplicates the strings and decreases the size on disk.
func (*SeriesGroup) DecodeMsg ¶
func (z *SeriesGroup) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*SeriesGroup) EncodeMsg ¶
func (z *SeriesGroup) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*SeriesGroup) MarshalMsg ¶
func (z *SeriesGroup) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*SeriesGroup) Msgsize ¶
func (z *SeriesGroup) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*SeriesGroup) UnmarshalMsg ¶
func (z *SeriesGroup) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type TimeSeriesBinary ¶
type TimeSeriesBinary struct { // Labels are not serialized to msgp, instead we store separately a dictionary of strings and use `LabelNames` and `LabelValues` to refer to the dictionary by ID. LabelsNames []uint32 LabelsValues []uint32 // TS is unix milliseconds. TS int64 Value float64 Hash uint64 Histograms Histograms }
TimeSeriesBinary is an optimized format for handling metrics and metadata. It should never be instantiated directly but instead use GetTimeSeriesFromPool and PutTimeSeriesSliceIntoPool. This allows us to reuse these objects and avoid allocations.
func GetTimeSeriesFromPool ¶
func GetTimeSeriesFromPool() *TimeSeriesBinary
func (*TimeSeriesBinary) DecodeMsg ¶
func (z *TimeSeriesBinary) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*TimeSeriesBinary) EncodeMsg ¶
func (z *TimeSeriesBinary) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*TimeSeriesBinary) FromFloatHistogram ¶
func (ts *TimeSeriesBinary) FromFloatHistogram(timestamp int64, h *histogram.FloatHistogram)
func (*TimeSeriesBinary) FromHistogram ¶
func (ts *TimeSeriesBinary) FromHistogram(timestamp int64, h *histogram.Histogram)
func (*TimeSeriesBinary) MarshalMsg ¶
func (z *TimeSeriesBinary) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*TimeSeriesBinary) Msgsize ¶
func (z *TimeSeriesBinary) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*TimeSeriesBinary) UnmarshalMsg ¶
func (z *TimeSeriesBinary) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler