Documentation ¶
Overview ¶
Package record contains the various record types used for encoding various Head block data in the WAL and in-memory snapshot.
Index ¶
- Variables
- func DecodeFloatHistogram(buf *encoding.Decbuf, fh *histogram.FloatHistogram)
- func DecodeHistogram(buf *encoding.Decbuf, h *histogram.Histogram)
- func EncodeFloatHistogram(buf *encoding.Encbuf, h *histogram.FloatHistogram)
- func EncodeHistogram(buf *encoding.Encbuf, h *histogram.Histogram)
- func EncodeLabels(buf *encoding.Encbuf, lbls labels.Labels)
- func GetMetricType(t model.MetricType) uint8
- func ToMetricType(m uint8) model.MetricType
- type Decoder
- func (d *Decoder) DecodeLabels(dec *encoding.Decbuf) labels.Labels
- func (d *Decoder) Exemplars(rec []byte, exemplars []RefExemplar) ([]RefExemplar, error)
- func (d *Decoder) ExemplarsFromBuffer(dec *encoding.Decbuf, exemplars []RefExemplar) ([]RefExemplar, error)
- func (d *Decoder) FloatHistogramSamples(rec []byte, histograms []RefFloatHistogramSample) ([]RefFloatHistogramSample, error)
- func (d *Decoder) HistogramSamples(rec []byte, histograms []RefHistogramSample) ([]RefHistogramSample, error)
- func (d *Decoder) Metadata(rec []byte, metadata []RefMetadata) ([]RefMetadata, error)
- func (d *Decoder) MmapMarkers(rec []byte, markers []RefMmapMarker) ([]RefMmapMarker, error)
- func (d *Decoder) Samples(rec []byte, samples []RefSample) ([]RefSample, error)
- func (d *Decoder) Series(rec []byte, series []RefSeries) ([]RefSeries, error)
- func (d *Decoder) Tombstones(rec []byte, tstones []tombstones.Stone) ([]tombstones.Stone, error)
- func (d *Decoder) Type(rec []byte) Type
- type Encoder
- func (e *Encoder) EncodeExemplarsIntoBuffer(exemplars []RefExemplar, buf *encoding.Encbuf)
- func (e *Encoder) Exemplars(exemplars []RefExemplar, b []byte) []byte
- func (e *Encoder) FloatHistogramSamples(histograms []RefFloatHistogramSample, b []byte) []byte
- func (e *Encoder) HistogramSamples(histograms []RefHistogramSample, b []byte) []byte
- func (e *Encoder) Metadata(metadata []RefMetadata, b []byte) []byte
- func (e *Encoder) MmapMarkers(markers []RefMmapMarker, b []byte) []byte
- func (e *Encoder) Samples(samples []RefSample, b []byte) []byte
- func (e *Encoder) Series(series []RefSeries, b []byte) []byte
- func (e *Encoder) Tombstones(tstones []tombstones.Stone, b []byte) []byte
- type MetricType
- type RefExemplar
- type RefFloatHistogramSample
- type RefHistogramSample
- type RefMetadata
- type RefMmapMarker
- type RefSample
- type RefSeries
- type Type
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned if a looked up resource was not found. Duplicate ErrNotFound from head.go.
Functions ¶
func DecodeFloatHistogram ¶ added in v0.46.0
func DecodeFloatHistogram(buf *encoding.Decbuf, fh *histogram.FloatHistogram)
Decode decodes a Histogram from a byte slice.
func DecodeHistogram ¶ added in v0.46.0
DecodeHistogram decodes a Histogram from a byte slice.
func EncodeFloatHistogram ¶ added in v0.46.0
func EncodeFloatHistogram(buf *encoding.Encbuf, h *histogram.FloatHistogram)
EncodeFloatHistogram encodes the Float Histogram into a byte slice.
func EncodeHistogram ¶ added in v0.46.0
EncodeHistogram encodes a Histogram into a byte slice.
func EncodeLabels ¶ added in v0.38.0
EncodeLabels encodes the contents of labels into buf.
func GetMetricType ¶ added in v0.38.0
func GetMetricType(t model.MetricType) uint8
func ToMetricType ¶ added in v0.50.0
func ToMetricType(m uint8) model.MetricType
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder decodes series, sample, metadata and tombstone records.
func NewDecoder ¶ added in v0.51.0
func NewDecoder(t *labels.SymbolTable) Decoder
func (*Decoder) DecodeLabels ¶ added in v0.38.0
DecodeLabels decodes one set of labels from buf.
func (*Decoder) Exemplars ¶
func (d *Decoder) Exemplars(rec []byte, exemplars []RefExemplar) ([]RefExemplar, error)
func (*Decoder) ExemplarsFromBuffer ¶
func (d *Decoder) ExemplarsFromBuffer(dec *encoding.Decbuf, exemplars []RefExemplar) ([]RefExemplar, error)
func (*Decoder) FloatHistogramSamples ¶ added in v0.42.0
func (d *Decoder) FloatHistogramSamples(rec []byte, histograms []RefFloatHistogramSample) ([]RefFloatHistogramSample, error)
func (*Decoder) HistogramSamples ¶ added in v0.40.0
func (d *Decoder) HistogramSamples(rec []byte, histograms []RefHistogramSample) ([]RefHistogramSample, error)
func (*Decoder) Metadata ¶ added in v0.38.0
func (d *Decoder) Metadata(rec []byte, metadata []RefMetadata) ([]RefMetadata, error)
Metadata appends metadata in rec to the given slice.
func (*Decoder) MmapMarkers ¶ added in v0.39.0
func (d *Decoder) MmapMarkers(rec []byte, markers []RefMmapMarker) ([]RefMmapMarker, error)
func (*Decoder) Tombstones ¶
func (d *Decoder) Tombstones(rec []byte, tstones []tombstones.Stone) ([]tombstones.Stone, error)
Tombstones appends tombstones in rec to the given slice.
type Encoder ¶
type Encoder struct{}
Encoder encodes series, sample, and tombstones records. The zero value is ready to use.
func (*Encoder) EncodeExemplarsIntoBuffer ¶
func (e *Encoder) EncodeExemplarsIntoBuffer(exemplars []RefExemplar, buf *encoding.Encbuf)
func (*Encoder) FloatHistogramSamples ¶ added in v0.42.0
func (e *Encoder) FloatHistogramSamples(histograms []RefFloatHistogramSample, b []byte) []byte
func (*Encoder) HistogramSamples ¶ added in v0.40.0
func (e *Encoder) HistogramSamples(histograms []RefHistogramSample, b []byte) []byte
func (*Encoder) Metadata ¶ added in v0.38.0
func (e *Encoder) Metadata(metadata []RefMetadata, b []byte) []byte
Metadata appends the encoded metadata to b and returns the resulting slice.
func (*Encoder) MmapMarkers ¶ added in v0.39.0
func (e *Encoder) MmapMarkers(markers []RefMmapMarker, b []byte) []byte
func (*Encoder) Tombstones ¶
func (e *Encoder) Tombstones(tstones []tombstones.Stone, b []byte) []byte
Tombstones appends the encoded tombstones to b and returns the resulting slice.
type MetricType ¶ added in v0.38.0
type MetricType uint8
MetricType represents the type of a series.
const ( UnknownMT MetricType = 0 Counter MetricType = 1 Gauge MetricType = 2 HistogramSample MetricType = 3 GaugeHistogram MetricType = 4 Summary MetricType = 5 Info MetricType = 6 Stateset MetricType = 7 )
type RefExemplar ¶
RefExemplar is an exemplar with the labels, timestamp, value the exemplar was collected/observed with, and a reference to a series.
type RefFloatHistogramSample ¶ added in v0.42.0
type RefFloatHistogramSample struct { Ref chunks.HeadSeriesRef T int64 FH *histogram.FloatHistogram }
RefFloatHistogramSample is a float histogram.
type RefHistogramSample ¶ added in v0.40.0
type RefHistogramSample struct { Ref chunks.HeadSeriesRef T int64 H *histogram.Histogram }
RefHistogramSample is a histogram.
type RefMetadata ¶ added in v0.38.0
type RefMetadata struct { Ref chunks.HeadSeriesRef Type uint8 Unit string Help string }
RefMetadata is the metadata associated with a series ID.
type RefMmapMarker ¶ added in v0.39.0
type RefMmapMarker struct { Ref chunks.HeadSeriesRef MmapRef chunks.ChunkDiskMapperRef }
RefMmapMarker marks that the all the samples of the given series until now have been m-mapped to disk.
type RefSample ¶
type RefSample struct { Ref chunks.HeadSeriesRef T int64 V float64 }
RefSample is a timestamp/value pair associated with a reference to a series. TODO(beorn7): Perhaps make this "polymorphic", including histogram and float-histogram pointers? Then get rid of RefHistogramSample.
type RefSeries ¶
type RefSeries struct { Ref chunks.HeadSeriesRef Labels labels.Labels }
RefSeries is the series labels with the series ID.
type Type ¶
type Type uint8
Type represents the data type of a record.
const ( // Unknown is returned for unrecognised WAL record types. Unknown Type = 255 // Series is used to match WAL records of type Series. Series Type = 1 // Samples is used to match WAL records of type Samples. Samples Type = 2 // Tombstones is used to match WAL records of type Tombstones. Tombstones Type = 3 // Exemplars is used to match WAL records of type Exemplars. Exemplars Type = 4 // MmapMarkers is used to match OOO WBL records of type MmapMarkers. MmapMarkers Type = 5 // Metadata is used to match WAL records of type Metadata. Metadata Type = 6 // HistogramSamples is used to match WAL records of type Histograms. HistogramSamples Type = 7 // FloatHistogramSamples is used to match WAL records of type Float Histograms. FloatHistogramSamples Type = 8 )