mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -08:00
Hotfix erroneous "label index missing" error
This commit is contained in:
parent
3635569257
commit
2ef3682560
10
index.go
10
index.go
|
@ -567,7 +567,10 @@ func (r *indexReader) LabelValues(names ...string) (StringTuples, error) {
|
||||||
key := strings.Join(names, string(sep))
|
key := strings.Join(names, string(sep))
|
||||||
off, ok := r.labels[key]
|
off, ok := r.labels[key]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("label index doesn't exist")
|
// XXX(fabxc): hot fix. Should return a partial data error and handle cases
|
||||||
|
// where the entire block has no data gracefully.
|
||||||
|
return emptyStringTuples{}, nil
|
||||||
|
//return nil, fmt.Errorf("label index doesn't exist")
|
||||||
}
|
}
|
||||||
|
|
||||||
flag, b, err := r.section(off)
|
flag, b, err := r.section(off)
|
||||||
|
@ -590,6 +593,11 @@ func (r *indexReader) LabelValues(names ...string) (StringTuples, error) {
|
||||||
return st, nil
|
return st, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type emptyStringTuples struct{}
|
||||||
|
|
||||||
|
func (emptyStringTuples) At(i int) ([]string, error) { return nil, nil }
|
||||||
|
func (emptyStringTuples) Len() int { return 0 }
|
||||||
|
|
||||||
func (r *indexReader) LabelIndices() ([][]string, error) {
|
func (r *indexReader) LabelIndices() ([][]string, error) {
|
||||||
res := [][]string{}
|
res := [][]string{}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue