netstorage

package
v1.100.1-cluster Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 32 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteSeries

func DeleteSeries(qt *querytracer.Tracer, sq *storage.SearchQuery, deadline searchutils.Deadline) (int, error)

DeleteSeries deletes time series matching the given sq.

func ExportBlocks added in v1.42.0

func ExportBlocks(qt *querytracer.Tracer, sq *storage.SearchQuery, deadline searchutils.Deadline,
	f func(mn *storage.MetricName, b *storage.Block, tr storage.TimeRange, workerID uint) error) error

ExportBlocks searches for time series matching sq and calls f for each found block.

f is called in parallel from multiple goroutines. It is the responsibility of f to call b.UnmarshalData before reading timestamps and values from the block. It is the responsibility of f to filter blocks according to the given tr.

func GraphiteTagValues added in v1.79.0

func GraphiteTagValues(qt *querytracer.Tracer, accountID, projectID uint32, denyPartialResponse bool, tagName, filter string, limit int, deadline searchutils.Deadline) ([]string, bool, error)

GraphiteTagValues returns tag values for the given tagName until the given deadline.

func GraphiteTags added in v1.79.0

func GraphiteTags(qt *querytracer.Tracer, accountID, projectID uint32, denyPartialResponse bool, filter string, limit int, deadline searchutils.Deadline) ([]string, bool, error)

GraphiteTags returns Graphite tags until the given deadline.

func Init

func Init(addrs []string)

Init initializes storage nodes' connections to the given addrs.

MustStop must be called when the initialized connections are no longer needed.

func InitTmpBlocksDir

func InitTmpBlocksDir(tmpDirPath string)

InitTmpBlocksDir initializes directory to store temporary search results.

It stores data in system-defined temporary directory if tmpDirPath is empty.

func LabelNames added in v1.79.0

func LabelNames(qt *querytracer.Tracer, denyPartialResponse bool, sq *storage.SearchQuery, maxLabelNames int, deadline searchutils.Deadline) ([]string, bool, error)

LabelNames returns label names matching the given sq until the given deadline.

func LabelValues added in v1.79.0

func LabelValues(qt *querytracer.Tracer, denyPartialResponse bool, labelName string, sq *storage.SearchQuery, maxLabelValues int, deadline searchutils.Deadline) ([]string, bool, error)

LabelValues returns label values matching the given labelName and sq until the given deadline.

func MaxWorkers added in v1.87.4

func MaxWorkers() int

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

func MustStop

func MustStop()

MustStop gracefully stops netstorage.

func ProcessBlocks

func ProcessBlocks(qt *querytracer.Tracer, denyPartialResponse bool, sq *storage.SearchQuery,
	processBlock func(mb *storage.MetricBlock, workerID uint) error, deadline searchutils.Deadline) (bool, error)

ProcessBlocks calls processBlock per each block matching the given sq.

func RegisterMetricNames

func RegisterMetricNames(qt *querytracer.Tracer, mrs []storage.MetricRow, deadline searchutils.Deadline) error

RegisterMetricNames registers metric names from mrs in the storage.

func SearchMetricNames added in v1.47.0

func SearchMetricNames(qt *querytracer.Tracer, denyPartialResponse bool, sq *storage.SearchQuery, deadline searchutils.Deadline) ([]string, bool, error)

SearchMetricNames returns all the metric names matching sq until the given deadline.

The returned metric names must be unmarshaled via storage.MetricName.UnmarshalString().

func SeriesCount added in v1.79.0

func SeriesCount(qt *querytracer.Tracer, accountID, projectID uint32, denyPartialResponse bool, deadline searchutils.Deadline) (uint64, bool, error)

SeriesCount returns the number of unique series.

func TSDBStatus added in v1.79.0

func TSDBStatus(qt *querytracer.Tracer, denyPartialResponse bool, sq *storage.SearchQuery, focusLabel string, topN int, deadline searchutils.Deadline) (*storage.TSDBStatus, bool, error)

TSDBStatus returns tsdb status according to https://prometheus.io/docs/prometheus/latest/querying/api/#tsdb-stats

It accepts arbitrary filters on time series in sq.

func TagValueSuffixes added in v1.79.0

func TagValueSuffixes(qt *querytracer.Tracer, accountID, projectID uint32, denyPartialResponse bool, tr storage.TimeRange, tagKey, tagValuePrefix string,
	delimiter byte, maxSuffixes int, deadline searchutils.Deadline) ([]string, bool, error)

TagValueSuffixes returns tag value suffixes for the given tagKey and the given tagValuePrefix.

It can be used for implementing https://graphite-api.readthedocs.io/en/latest/api.html#metrics-find

func Tenants

func Tenants(qt *querytracer.Tracer, tr storage.TimeRange, deadline searchutils.Deadline) ([]string, error)

Tenants returns tenants until the given deadline.

Types

type Result

type Result struct {
	// The name of the metric.
	MetricName storage.MetricName

	// Values are sorted by Timestamps.
	Values     []float64
	Timestamps []int64
}

Result is a single timeseries result.

ProcessSearchQuery returns Result slice.

type Results

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

Results holds results returned from ProcessSearchQuery.

func ProcessSearchQuery

func ProcessSearchQuery(qt *querytracer.Tracer, denyPartialResponse bool, sq *storage.SearchQuery, deadline searchutils.Deadline) (*Results, bool, error)

ProcessSearchQuery performs sq until the given deadline.

Results.RunParallel or Results.Cancel must be called on the returned Results.

func (*Results) Cancel

func (rss *Results) Cancel()

Cancel cancels rss work.

func (*Results) Len

func (rss *Results) Len() int

Len returns the number of results in rss.

func (*Results) RunParallel

func (rss *Results) RunParallel(qt *querytracer.Tracer, f func(rs *Result, workerID uint) error) error

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

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.

rss 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