vmsketch

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

README

vmsketch performs the following tasks:

  • Accepts inserts from vminsert and stores them to allocated sketch cache instances.

  • Performs select requests from vmselect.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SketchCache *promsketch.VMSketches

SketchCache is a rollup cache with sketches.

Every sketch call must be wrapped into WG.Add(1) ... WG.Done() for proper graceful shutdown when Stop is called.

WG must be incremented before Storage call.

Use syncwg instead of sync, since Add is called from concurrent goroutines.

Functions

func AddRow

func AddRow(metricNameRaw []byte, timestamp int64, value float64) error

func AddRows

func AddRows(mrs []storage.MetricRow) error

AddRows adds mrs to the sketch cache.

The caller should limit the number of concurrent calls to AddRows() in order to limit memory usage.

func GetSeriesCount

func GetSeriesCount() (uint64, error)

GetSeriesCount returns the number of time series in the storage.

func Init

func Init()

Init initializes vmsketch.

func MaxWorkers

func MaxWorkers() int

MaxWorkers returns the maximum number of concurrent goroutines, which can be used by RunParallel()

func OutputTimeseriesCoverage

func OutputTimeseriesCoverage(mns []string, funcNames []string)

func RegisterMetricNameFuncName

func RegisterMetricNameFuncName(mn *storage.MetricName, funcName string, window int64, item_window int64) error

RegisterMetricNames registers all the metrics from mrs in the storage.

func SearchAndUpdateWindowMetricNameFuncName

func SearchAndUpdateWindowMetricNameFuncName(mn *storage.MetricName, funcName string, window int64) bool

SearchMetricNames returns metric names for the given tfss on the given tr.

func Stop

func Stop()

Stop stops the vmsketch

Types

type SketchResult

type SketchResult struct {
	MetricName *storage.MetricName
	// contains filtered or unexported fields
}

Result is a single timeseries result.

Search returns Result slice.

func (*SketchResult) Eval

func (sr *SketchResult) Eval(mn *storage.MetricName, funcName string, args []float64, mint, maxt, cur_time int64) float64

type SketchResults

type SketchResults struct {
	// contains filtered or unexported fields
}

Results holds results returned from ProcessSearchQuery.

func SearchTimeSeriesCoverage

func SearchTimeSeriesCoverage(start, end int64, mns []string, funcNames []string, maxMetrics int, deadline searchutils.Deadline) (*SketchResults, bool, error)

func (*SketchResults) Cancel

func (srs *SketchResults) Cancel()

Cancel cancels srs work.

func (*SketchResults) Len

func (srs *SketchResults) Len() int

Len returns the number of results in srs.

func (*SketchResults) RunParallel

func (srs *SketchResults) RunParallel(qt *querytracer.Tracer, f func(sr *SketchResult, workerID uint) error) error

RunParallel runs f in parallel for all the results from srs.

f shouldn't hold references to rs after returning. workerID is the id of the worker goroutine that calls f. The workerID is in the range [0..MaxWorkers()-1]. Data processing is immediately stopped if f returns non-nil error.

srs becomes unusable after the call to RunParallel.

Jump to

Keyboard shortcuts

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