Documentation
¶
Index ¶
- Variables
- func CompareLower(sa, sb []byte) int
- func IsSorted(l []*Label) bool
- func MergedLabels(seriesLabels, commonLabels []*Label) iter.Seq[*Label]
- func MetricName(ts *TimeSeries) []byte
- func Sort(l []*Label)
- type Iterator
- func (i *Iterator) Close() error
- func (i *Iterator) Err() error
- func (i *Iterator) Next() bool
- func (i *Iterator) ParseTimeSeriesInto(ts *TimeSeries, line string) (*TimeSeries, error)
- func (i *Iterator) Reset(r io.ReadCloser)
- func (i *Iterator) TimeSeriesInto(ts *TimeSeries) (*TimeSeries, error)
- func (i *Iterator) Value() string
- type Label
- type LabelDropRule
- type LabelFilter
- type Labels
- type Pool
- type Resetter
- type Sample
- type TimeSeries
- type WriteRequest
Constants ¶
This section is empty.
Variables ¶
var ( WriteRequestPool = NewPool( func() *WriteRequest { return &WriteRequest{} }, ) TimeSeriesPool = NewPool( func() *TimeSeries { return &TimeSeries{} }, ) )
Functions ¶
func CompareLower ¶
func MergedLabels ¶ added in v0.4.0
MergedLabels returns an iterator over the sorted merge of seriesLabels and commonLabels without materializing the merged slice. If both inputs contain the same label name, the per-series label takes precedence.
Both input slices must be sorted according to Sort and must not be modified while the iterator is running.
func MetricName ¶
func MetricName(ts *TimeSeries) []byte
Types ¶
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
func NewIterator ¶
func NewIterator(r io.ReadCloser) *Iterator
func (*Iterator) ParseTimeSeriesInto ¶
func (i *Iterator) ParseTimeSeriesInto(ts *TimeSeries, line string) (*TimeSeries, error)
func (*Iterator) Reset ¶
func (i *Iterator) Reset(r io.ReadCloser)
func (*Iterator) TimeSeriesInto ¶
func (i *Iterator) TimeSeriesInto(ts *TimeSeries) (*TimeSeries, error)
type LabelDropRule ¶ added in v0.4.0
LabelDropRule drops matching label names from matching metrics.
type LabelFilter ¶ added in v0.4.0
type LabelFilter struct {
Drop []LabelDropRule
Keep [][]byte
}
LabelFilter contains immutable request-level label filtering rules.
func (*LabelFilter) Drops ¶ added in v0.4.0
func (f *LabelFilter) Drops(metricName, name []byte) bool
Drops reports whether name is excluded for metricName. The metric name label is always retained, and explicit keep entries take precedence.
type TimeSeries ¶
TimeSeries is a timeseries.
func (*TimeSeries) AppendLabel ¶
func (m *TimeSeries) AppendLabel(key []byte, value []byte)
func (*TimeSeries) AppendLabelString ¶
func (m *TimeSeries) AppendLabelString(key string, value string)
func (*TimeSeries) AppendSample ¶
func (m *TimeSeries) AppendSample(timestamp int64, value float64)
func (*TimeSeries) Reset ¶
func (ts *TimeSeries) Reset()
type WriteRequest ¶
type WriteRequest struct {
Timeseries []*TimeSeries
// CommonLabels is an immutable sorted set of labels shared by every time
// series in this request. It is materialized into each series when the
// request is marshaled to the Prometheus remote write protobuf format.
CommonLabels []*Label
// LabelFilter is an immutable set of request-level filtering rules applied
// when consumers walk the effective labels for each time series.
LabelFilter *LabelFilter
}
WriteRequest represents Prometheus remote write API request
func (*WriteRequest) Labels ¶ added in v0.4.0
func (wr *WriteRequest) Labels(series *TimeSeries) iter.Seq[*Label]
Labels returns the effective sorted labels for series, including common labels and request-level filtering. Per-series labels take precedence when both inputs contain the same name.
func (*WriteRequest) Marshal ¶
func (wr *WriteRequest) Marshal() (dAtA []byte, err error)
func (*WriteRequest) Unmarshal ¶
func (wr *WriteRequest) Unmarshal(src []byte) (err error)
Unmarshal unmarshals m from src.