metricsdata

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MetricDataMerger kv.MergerType = "MetricDataMerger"

Functions

func NewMerger

func NewMerger(flusher kv.Flusher) (kv.Merger, error)

NewMerger creates a metric data merger

Types

type FieldReader

type FieldReader interface {
	// SlotRange returns the time slot range of metric level
	SlotRange() timeutil.SlotRange
	// GetFieldData returns the field data by field id,
	// if metricReader is completed, return nil, if found data returns field data else returns nil
	GetFieldData(fieldID field.ID) []byte
	// Reset resets the field data for reading
	Reset(seriesEntry []byte, slotRange timeutil.SlotRange)
	// Close closes the metricReader
	Close()
}

FieldReader represents the field metricReader when does metric data merge. !!!!NOTICE: need get field value in order by field

type Filter

type Filter interface {
	// Filter filters data under each sst file based on query condition
	Filter(seriesIDs *roaring.Bitmap, fields field.Metas) ([]flow.FilterResultSet, error)
}

Filter implements filtering metrics from sst files.

func NewFilter

func NewFilter(familyTime int64, snapshot version.Snapshot, readers []MetricReader) Filter

NewFilter creates the sst file data filter

type Flusher

type Flusher interface {
	// PrepareMetric prepares to write a new metric block
	PrepareMetric(
		metricID uint32,
		fieldMetas field.Metas,
	)
	// FlushField writes a compressed field data to writer.
	// It will be called in order with field metas even if field data is empty
	FlushField(data []byte) error
	// FlushSeries writes a full series, this will be called after writing all fields of this entry.
	FlushSeries(seriesID uint32) error
	// CommitMetric ends writing a full metric block
	// this will be called after writing all entries of this metric.
	CommitMetric(slotRange timeutil.SlotRange) error
	// GetFieldMetas returns current field metas of metric.
	GetFieldMetas() field.Metas
	// GetEncoder returns tsd encoder by field index.
	GetEncoder(fieldIdx int) *encoding.TSDEncoder

	// Closer closes the writer, syncs all data to the file.
	io.Closer
}

Flusher is a wrapper of kv.Builder, provides ability to flush a metric-table file to disk. The layout is available in `tsdb/doc.go` Level1: metric-block Level2: series entry Level3: compressed field data

flush step: 1. flush field metas of metric level 2. flush field store of one series 3. flush series id 4. flush metric data include field metadata and all series ids data

func NewFlusher

func NewFlusher(kvFlusher kv.Flusher) (Flusher, error)

NewFlusher returns a new Flusher, interval is used to calculate the time-range of field data slots.`

type MetricReader

type MetricReader interface {
	// Path returns file path
	Path() string
	// GetSeriesIDs returns the series ids in this sst file
	GetSeriesIDs() *roaring.Bitmap
	// GetFields returns the field metas in this sst file
	GetFields() field.Metas
	// GetTimeRange returns the time range in this sst file
	GetTimeRange() timeutil.SlotRange
	// Load loads the data from sst file, then returns the file metric scanner.
	Load(ctx *flow.DataLoadContext) flow.DataLoader
	// contains filtered or unexported methods
}

MetricReader represents the metric block metricReader

func NewReader

func NewReader(path string, metricBlock []byte) (MetricReader, error)

NewReader creates a metric block metricReader

type SeriesMerger

type SeriesMerger interface {
	// contains filtered or unexported methods
}

SeriesMerger represents series data merger which merge multi fields under same series id

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL