diff --git a/lib/storage/index_db.go b/lib/storage/index_db.go index ad74c923df..fb16349849 100644 --- a/lib/storage/index_db.go +++ b/lib/storage/index_db.go @@ -876,7 +876,7 @@ func (is *indexSearch) searchLabelNamesWithFiltersOnDate(qt *querytracer.Tracer, if filter != nil && filter.Len() <= 100e3 { // It is faster to obtain label names by metricIDs from the filter // instead of scanning the inverted index for the matching filters. - // This hould help https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2978 + // This would help https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2978 metricIDs := filter.AppendTo(nil) qt.Printf("sort %d metricIDs", len(metricIDs)) return is.getLabelNamesForMetricIDs(qt, metricIDs, lns, maxLabelNames) @@ -1072,7 +1072,7 @@ func (is *indexSearch) searchLabelValuesWithFiltersOnDate(qt *querytracer.Tracer if filter != nil && filter.Len() < 100e3 { // It is faster to obtain label values by metricIDs from the filter // instead of scanning the inverted index for the matching filters. - // This hould help https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2978 + // This would help https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2978 metricIDs := filter.AppendTo(nil) qt.Printf("sort %d metricIDs", len(metricIDs)) return is.getLabelValuesForMetricIDs(qt, lvs, labelName, metricIDs, maxLabelValues) @@ -1135,6 +1135,9 @@ func (is *indexSearch) searchLabelValuesWithFiltersOnDate(qt *querytracer.Tracer } func (is *indexSearch) getLabelValuesForMetricIDs(qt *querytracer.Tracer, lvs map[string]struct{}, labelName string, metricIDs []uint64, maxLabelValues int) error { + if labelName == "" { + labelName = "__name__" + } var mn MetricName foundLabelValues := 0 var buf []byte