2022-06-27 11:20:39 +00:00
|
|
|
package vmselectapi
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/querytracer"
|
|
|
|
"github.com/VictoriaMetrics/VictoriaMetrics/lib/storage"
|
|
|
|
)
|
|
|
|
|
|
|
|
// API must implement vmselect API.
|
|
|
|
type API interface {
|
2022-07-05 21:53:03 +00:00
|
|
|
// InitSearch initialize series search for the given sq.
|
2022-06-27 11:20:39 +00:00
|
|
|
//
|
|
|
|
// The returned BlockIterator must be closed with MustClose to free up resources when it is no longer needed.
|
2022-07-05 21:53:03 +00:00
|
|
|
InitSearch(qt *querytracer.Tracer, sq *storage.SearchQuery, deadline uint64) (BlockIterator, error)
|
2022-06-27 11:20:39 +00:00
|
|
|
|
2022-07-05 21:53:03 +00:00
|
|
|
// SearchMetricNames returns metric names matching the given sq.
|
|
|
|
SearchMetricNames(qt *querytracer.Tracer, sq *storage.SearchQuery, deadline uint64) ([]string, error)
|
2022-06-27 11:20:39 +00:00
|
|
|
|
2022-07-05 21:53:03 +00:00
|
|
|
// LabelValues returns values for labelName label acorss series matching the given sq.
|
|
|
|
LabelValues(qt *querytracer.Tracer, sq *storage.SearchQuery, labelName string, maxLabelValues int, deadline uint64) ([]string, error)
|
2022-06-27 11:20:39 +00:00
|
|
|
|
|
|
|
// TagValueSuffixes returns tag value suffixes for the given args.
|
2022-07-05 20:47:46 +00:00
|
|
|
TagValueSuffixes(qt *querytracer.Tracer, accountID, projectID uint32, tr storage.TimeRange, tagKey, tagValuePrefix string, delimiter byte, maxSuffixes int, deadline uint64) ([]string, error)
|
2022-06-27 11:20:39 +00:00
|
|
|
|
2022-07-05 21:53:03 +00:00
|
|
|
// LabelNames returns lable names for series matching the given sq.
|
|
|
|
LabelNames(qt *querytracer.Tracer, sq *storage.SearchQuery, maxLableNames int, deadline uint64) ([]string, error)
|
2022-06-27 11:20:39 +00:00
|
|
|
|
|
|
|
// SeriesCount returns the number of series for the given (accountID, projectID).
|
|
|
|
SeriesCount(qt *querytracer.Tracer, accountID, projectID uint32, deadline uint64) (uint64, error)
|
|
|
|
|
|
|
|
// TSDBStatus returns tsdb status for the given sq.
|
2022-07-05 21:53:03 +00:00
|
|
|
TSDBStatus(qt *querytracer.Tracer, sq *storage.SearchQuery, focusLabel string, topN int, deadline uint64) (*storage.TSDBStatus, error)
|
2022-06-27 11:20:39 +00:00
|
|
|
|
2022-07-05 21:53:03 +00:00
|
|
|
// DeleteSeries deletes series matching the given sq.
|
|
|
|
DeleteSeries(qt *querytracer.Tracer, sq *storage.SearchQuery, deadline uint64) (int, error)
|
2022-06-27 11:20:39 +00:00
|
|
|
|
|
|
|
// RegisterMetricNames registers the given mrs in the storage.
|
2022-07-05 21:53:03 +00:00
|
|
|
RegisterMetricNames(qt *querytracer.Tracer, mrs []storage.MetricRow, deadline uint64) error
|
2022-06-27 11:20:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// BlockIterator must iterate through series blocks found by VMSelect.InitSearch.
|
|
|
|
//
|
|
|
|
// MustClose must be called in order to free up allocated resources when BlockIterator is no longer needed.
|
|
|
|
type BlockIterator interface {
|
|
|
|
// NextBlock reads the next block into mb.
|
|
|
|
//
|
|
|
|
// It returns true on success, false on error or if no blocks to read.
|
2022-06-28 09:55:20 +00:00
|
|
|
NextBlock(mb *storage.MetricBlock) bool
|
2022-06-27 11:20:39 +00:00
|
|
|
|
|
|
|
// MustClose frees up resources allocated by BlockIterator.
|
|
|
|
MustClose()
|
|
|
|
|
|
|
|
// Error returns the last error occurred in NextBlock(), which returns false.
|
|
|
|
Error() error
|
|
|
|
}
|