|
|
|
@ -7,6 +7,7 @@ import ( |
|
|
|
|
"io" |
|
|
|
|
"math" |
|
|
|
|
"path/filepath" |
|
|
|
|
"strings" |
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
"github.com/opentracing/opentracing-go" |
|
|
|
@ -268,10 +269,17 @@ func (i *TSDBIndex) LabelNames(_ context.Context, _ string, _, _ model.Time, mat |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (i *TSDBIndex) LabelValues(_ context.Context, _ string, _, _ model.Time, name string, matchers ...*labels.Matcher) ([]string, error) { |
|
|
|
|
if len(matchers) == 0 { |
|
|
|
|
return i.reader.LabelValues(name) |
|
|
|
|
if len(matchers) != 0 { |
|
|
|
|
return labelValuesWithMatchers(i.reader, name, matchers...) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
labelValues, err := i.reader.LabelValues(name) |
|
|
|
|
if err != nil { |
|
|
|
|
return nil, err |
|
|
|
|
} |
|
|
|
|
return labelValuesWithMatchers(i.reader, name, matchers...) |
|
|
|
|
|
|
|
|
|
// cloning the string
|
|
|
|
|
return cloneStringList(labelValues), nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (i *TSDBIndex) Checksum() uint32 { |
|
|
|
@ -454,3 +462,11 @@ func (i *TSDBIndex) Volume( |
|
|
|
|
return p.Err() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func cloneStringList(strs []string) []string { |
|
|
|
|
res := make([]string, 0, len(strs)) |
|
|
|
|
for _, str := range strs { |
|
|
|
|
res = append(res, strings.Clone(str)) |
|
|
|
|
} |
|
|
|
|
return res |
|
|
|
|
} |
|
|
|
|