mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 00:13:30 +01:00
app/vmselect/netstorage: remove Get prefix from netstorage functions
This makes these function names more consistent with the server side
This commit is contained in:
parent
ea2aa617e5
commit
bc9d704ef4
@ -206,7 +206,7 @@ func MetricsIndexHandler(startTime time.Time, at *auth.Token, w http.ResponseWri
|
||||
jsonp := r.FormValue("jsonp")
|
||||
denyPartialResponse := searchutils.GetDenyPartialResponse(r)
|
||||
sq := storage.NewSearchQuery(at.AccountID, at.ProjectID, 0, 0, nil, 0)
|
||||
metricNames, isPartial, err := netstorage.GetLabelValues(nil, at, denyPartialResponse, "__name__", sq, 0, deadline)
|
||||
metricNames, isPartial, err := netstorage.LabelValues(nil, at, denyPartialResponse, "__name__", sq, 0, deadline)
|
||||
if err != nil {
|
||||
return fmt.Errorf(`cannot obtain metric names: %w`, err)
|
||||
}
|
||||
@ -228,7 +228,7 @@ func metricsFind(at *auth.Token, denyPartialResponse bool, tr storage.TimeRange,
|
||||
n := strings.IndexAny(qTail, "*{[")
|
||||
if n < 0 {
|
||||
query := qHead + qTail
|
||||
suffixes, isPartial, err := netstorage.GetTagValueSuffixes(nil, at, denyPartialResponse, tr, label, query, delimiter, deadline)
|
||||
suffixes, isPartial, err := netstorage.TagValueSuffixes(nil, at, denyPartialResponse, tr, label, query, delimiter, deadline)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
@ -248,7 +248,7 @@ func metricsFind(at *auth.Token, denyPartialResponse bool, tr storage.TimeRange,
|
||||
}
|
||||
if n == len(qTail)-1 && strings.HasSuffix(qTail, "*") {
|
||||
query := qHead + qTail[:len(qTail)-1]
|
||||
suffixes, isPartial, err := netstorage.GetTagValueSuffixes(nil, at, denyPartialResponse, tr, label, query, delimiter, deadline)
|
||||
suffixes, isPartial, err := netstorage.TagValueSuffixes(nil, at, denyPartialResponse, tr, label, query, delimiter, deadline)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
|
@ -179,11 +179,11 @@ func TagsAutoCompleteValuesHandler(startTime time.Time, at *auth.Token, w http.R
|
||||
}
|
||||
isPartial := false
|
||||
if len(exprs) == 0 && len(etfs) == 0 {
|
||||
// Fast path: there are no `expr` filters, so use netstorage.GetGraphiteTagValues.
|
||||
// Fast path: there are no `expr` filters, so use netstorage.GraphiteTagValues.
|
||||
// Escape special chars in tagPrefix as Graphite does.
|
||||
// See https://github.com/graphite-project/graphite-web/blob/3ad279df5cb90b211953e39161df416e54a84948/webapp/graphite/tags/base.py#L228
|
||||
filter := regexp.QuoteMeta(valuePrefix)
|
||||
tagValues, isPartial, err = netstorage.GetGraphiteTagValues(nil, at, denyPartialResponse, tag, filter, limit, deadline)
|
||||
tagValues, isPartial, err = netstorage.GraphiteTagValues(nil, at, denyPartialResponse, tag, filter, limit, deadline)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -264,12 +264,12 @@ func TagsAutoCompleteTagsHandler(startTime time.Time, at *auth.Token, w http.Res
|
||||
var labels []string
|
||||
isPartial := false
|
||||
if len(exprs) == 0 && len(etfs) == 0 {
|
||||
// Fast path: there are no `expr` filters, so use netstorage.GetGraphiteTags.
|
||||
// Fast path: there are no `expr` filters, so use netstorage.GraphiteTags.
|
||||
|
||||
// Escape special chars in tagPrefix as Graphite does.
|
||||
// See https://github.com/graphite-project/graphite-web/blob/3ad279df5cb90b211953e39161df416e54a84948/webapp/graphite/tags/base.py#L181
|
||||
filter := regexp.QuoteMeta(tagPrefix)
|
||||
labels, isPartial, err = netstorage.GetGraphiteTags(nil, at, denyPartialResponse, filter, limit, deadline)
|
||||
labels, isPartial, err = netstorage.GraphiteTags(nil, at, denyPartialResponse, filter, limit, deadline)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -403,7 +403,7 @@ func TagValuesHandler(startTime time.Time, at *auth.Token, tagName string, w htt
|
||||
}
|
||||
filter := r.FormValue("filter")
|
||||
denyPartialResponse := searchutils.GetDenyPartialResponse(r)
|
||||
tagValues, isPartial, err := netstorage.GetGraphiteTagValues(nil, at, denyPartialResponse, tagName, filter, limit, deadline)
|
||||
tagValues, isPartial, err := netstorage.GraphiteTagValues(nil, at, denyPartialResponse, tagName, filter, limit, deadline)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -432,7 +432,7 @@ func TagsHandler(startTime time.Time, at *auth.Token, w http.ResponseWriter, r *
|
||||
}
|
||||
filter := r.FormValue("filter")
|
||||
denyPartialResponse := searchutils.GetDenyPartialResponse(r)
|
||||
labels, isPartial, err := netstorage.GetGraphiteTags(nil, at, denyPartialResponse, filter, limit, deadline)
|
||||
labels, isPartial, err := netstorage.GraphiteTags(nil, at, denyPartialResponse, filter, limit, deadline)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -684,8 +684,8 @@ func DeleteSeries(qt *querytracer.Tracer, at *auth.Token, sq *storage.SearchQuer
|
||||
return deletedTotal, nil
|
||||
}
|
||||
|
||||
// GetLabelNames returns label names matching the given sq until the given deadline.
|
||||
func GetLabelNames(qt *querytracer.Tracer, at *auth.Token, 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 LabelNames(qt *querytracer.Tracer, at *auth.Token, denyPartialResponse bool, sq *storage.SearchQuery, maxLabelNames int, deadline searchutils.Deadline) ([]string, bool, error) {
|
||||
qt = qt.NewChild("get labels: %s", sq)
|
||||
defer qt.Done()
|
||||
if deadline.Exceeded() {
|
||||
@ -737,15 +737,15 @@ func GetLabelNames(qt *querytracer.Tracer, at *auth.Token, denyPartialResponse b
|
||||
return labelNames, isPartial, nil
|
||||
}
|
||||
|
||||
// GetGraphiteTags returns Graphite tags until the given deadline.
|
||||
func GetGraphiteTags(qt *querytracer.Tracer, at *auth.Token, denyPartialResponse bool, filter string, limit int, deadline searchutils.Deadline) ([]string, bool, error) {
|
||||
// GraphiteTags returns Graphite tags until the given deadline.
|
||||
func GraphiteTags(qt *querytracer.Tracer, at *auth.Token, denyPartialResponse bool, filter string, limit int, deadline searchutils.Deadline) ([]string, bool, error) {
|
||||
qt = qt.NewChild("get graphite tags: filter=%s, limit=%d", filter, limit)
|
||||
defer qt.Done()
|
||||
if deadline.Exceeded() {
|
||||
return nil, false, fmt.Errorf("timeout exceeded before starting the query processing: %s", deadline.String())
|
||||
}
|
||||
sq := storage.NewSearchQuery(at.AccountID, at.ProjectID, 0, 0, nil, 0)
|
||||
labels, isPartial, err := GetLabelNames(qt, at, denyPartialResponse, sq, 0, deadline)
|
||||
labels, isPartial, err := LabelNames(qt, at, denyPartialResponse, sq, 0, deadline)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
@ -785,8 +785,8 @@ func hasString(a []string, s string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// GetLabelValues returns label values matching the given labelName and sq until the given deadline.
|
||||
func GetLabelValues(qt *querytracer.Tracer, at *auth.Token, denyPartialResponse bool, labelName string, sq *storage.SearchQuery,
|
||||
// LabelValues returns label values matching the given labelName and sq until the given deadline.
|
||||
func LabelValues(qt *querytracer.Tracer, at *auth.Token, denyPartialResponse bool, labelName string, sq *storage.SearchQuery,
|
||||
maxLabelValues int, deadline searchutils.Deadline) ([]string, bool, error) {
|
||||
qt = qt.NewChild("get values for label %s: %s", labelName, sq)
|
||||
defer qt.Done()
|
||||
@ -840,8 +840,8 @@ func GetLabelValues(qt *querytracer.Tracer, at *auth.Token, denyPartialResponse
|
||||
return labelValues, isPartial, nil
|
||||
}
|
||||
|
||||
// GetGraphiteTagValues returns tag values for the given tagName until the given deadline.
|
||||
func GetGraphiteTagValues(qt *querytracer.Tracer, at *auth.Token, 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 GraphiteTagValues(qt *querytracer.Tracer, at *auth.Token, denyPartialResponse bool, tagName, filter string, limit int, deadline searchutils.Deadline) ([]string, bool, error) {
|
||||
qt = qt.NewChild("get graphite tag values for tagName=%s, filter=%s, limit=%d", tagName, filter, limit)
|
||||
defer qt.Done()
|
||||
if deadline.Exceeded() {
|
||||
@ -851,7 +851,7 @@ func GetGraphiteTagValues(qt *querytracer.Tracer, at *auth.Token, denyPartialRes
|
||||
tagName = ""
|
||||
}
|
||||
sq := storage.NewSearchQuery(at.AccountID, at.ProjectID, 0, 0, nil, 0)
|
||||
tagValues, isPartial, err := GetLabelValues(qt, at, denyPartialResponse, tagName, sq, 0, deadline)
|
||||
tagValues, isPartial, err := LabelValues(qt, at, denyPartialResponse, tagName, sq, 0, deadline)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
@ -867,10 +867,10 @@ func GetGraphiteTagValues(qt *querytracer.Tracer, at *auth.Token, denyPartialRes
|
||||
return tagValues, isPartial, nil
|
||||
}
|
||||
|
||||
// GetTagValueSuffixes returns tag value suffixes for the given tagKey and the given tagValuePrefix.
|
||||
// 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 GetTagValueSuffixes(qt *querytracer.Tracer, at *auth.Token, denyPartialResponse bool, tr storage.TimeRange, tagKey, tagValuePrefix string,
|
||||
func TagValueSuffixes(qt *querytracer.Tracer, at *auth.Token, denyPartialResponse bool, tr storage.TimeRange, tagKey, tagValuePrefix string,
|
||||
delimiter byte, deadline searchutils.Deadline) ([]string, bool, error) {
|
||||
qt = qt.NewChild("get tag value suffixes for tagKey=%s, tagValuePrefix=%s, timeRange=%s", tagKey, tagValuePrefix, &tr)
|
||||
defer qt.Done()
|
||||
@ -931,10 +931,10 @@ func deduplicateStrings(a []string) []string {
|
||||
return a
|
||||
}
|
||||
|
||||
// GetTSDBStatus returns tsdb status according to https://prometheus.io/docs/prometheus/latest/querying/api/#tsdb-stats
|
||||
// TSDBStatus returns tsdb status according to https://prometheus.io/docs/prometheus/latest/querying/api/#tsdb-stats
|
||||
//
|
||||
// It accepts aribtrary filters on time series in sq.
|
||||
func GetTSDBStatus(qt *querytracer.Tracer, at *auth.Token, denyPartialResponse bool, sq *storage.SearchQuery, focusLabel string, topN int, deadline searchutils.Deadline) (*storage.TSDBStatus, bool, error) {
|
||||
func TSDBStatus(qt *querytracer.Tracer, at *auth.Token, denyPartialResponse bool, sq *storage.SearchQuery, focusLabel string, topN int, deadline searchutils.Deadline) (*storage.TSDBStatus, bool, error) {
|
||||
qt = qt.NewChild("get tsdb stats: %s, focusLabel=%q, topN=%d", sq, focusLabel, topN)
|
||||
defer qt.Done()
|
||||
if deadline.Exceeded() {
|
||||
@ -1039,8 +1039,8 @@ func toTopHeapEntries(m map[string]uint64, topN int) []storage.TopHeapEntry {
|
||||
return a
|
||||
}
|
||||
|
||||
// GetSeriesCount returns the number of unique series for the given at.
|
||||
func GetSeriesCount(qt *querytracer.Tracer, at *auth.Token, denyPartialResponse bool, deadline searchutils.Deadline) (uint64, bool, error) {
|
||||
// SeriesCount returns the number of unique series for the given at.
|
||||
func SeriesCount(qt *querytracer.Tracer, at *auth.Token, denyPartialResponse bool, deadline searchutils.Deadline) (uint64, bool, error) {
|
||||
qt = qt.NewChild("get series count")
|
||||
defer qt.Done()
|
||||
if deadline.Exceeded() {
|
||||
|
@ -516,7 +516,7 @@ func LabelValuesHandler(qt *querytracer.Tracer, startTime time.Time, at *auth.To
|
||||
}
|
||||
denyPartialResponse := searchutils.GetDenyPartialResponse(r)
|
||||
sq := storage.NewSearchQuery(at.AccountID, at.ProjectID, cp.start, cp.end, cp.filterss, *maxUniqueTimeseries)
|
||||
labelValues, isPartial, err := netstorage.GetLabelValues(qt, at, denyPartialResponse, labelName, sq, limit, cp.deadline)
|
||||
labelValues, isPartial, err := netstorage.LabelValues(qt, at, denyPartialResponse, labelName, sq, limit, cp.deadline)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot obtain values for label %q: %w", labelName, err)
|
||||
}
|
||||
@ -582,7 +582,7 @@ func TSDBStatusHandler(qt *querytracer.Tracer, startTime time.Time, at *auth.Tok
|
||||
start := int64(date*secsPerDay) * 1000
|
||||
end := int64((date+1)*secsPerDay)*1000 - 1
|
||||
sq := storage.NewSearchQuery(at.AccountID, at.ProjectID, start, end, cp.filterss, *maxTSDBStatusSeries)
|
||||
status, isPartial, err := netstorage.GetTSDBStatus(qt, at, denyPartialResponse, sq, focusLabel, topN, cp.deadline)
|
||||
status, isPartial, err := netstorage.TSDBStatus(qt, at, denyPartialResponse, sq, focusLabel, topN, cp.deadline)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot obtain tsdb stats: %w", err)
|
||||
}
|
||||
@ -615,7 +615,7 @@ func LabelsHandler(qt *querytracer.Tracer, startTime time.Time, at *auth.Token,
|
||||
}
|
||||
denyPartialResponse := searchutils.GetDenyPartialResponse(r)
|
||||
sq := storage.NewSearchQuery(at.AccountID, at.ProjectID, cp.start, cp.end, cp.filterss, *maxUniqueTimeseries)
|
||||
labels, isPartial, err := netstorage.GetLabelNames(qt, at, denyPartialResponse, sq, limit, cp.deadline)
|
||||
labels, isPartial, err := netstorage.LabelNames(qt, at, denyPartialResponse, sq, limit, cp.deadline)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot obtain labels: %w", err)
|
||||
}
|
||||
@ -638,7 +638,7 @@ func SeriesCountHandler(startTime time.Time, at *auth.Token, w http.ResponseWrit
|
||||
|
||||
deadline := searchutils.GetDeadlineForStatusRequest(r, startTime)
|
||||
denyPartialResponse := searchutils.GetDenyPartialResponse(r)
|
||||
n, isPartial, err := netstorage.GetSeriesCount(nil, at, denyPartialResponse, deadline)
|
||||
n, isPartial, err := netstorage.SeriesCount(nil, at, denyPartialResponse, deadline)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot obtain series count: %w", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user