forked from nwilkens/graphite-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.go
More file actions
27 lines (25 loc) · 638 Bytes
/
data.go
File metadata and controls
27 lines (25 loc) · 638 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main
import (
"fmt"
"github.com/graphite-ng/graphite-ng/chains"
"github.com/graphite-ng/graphite-ng/stores"
)
func ReadMetric(name string) (our_el chains.ChainEl) {
var found bool
var err error
for _, store := range stores.List {
found, err = (*store).Has(name)
if err != nil {
panic(fmt.Sprintf("Error checking store %s for %s: %s", store, name, err))
}
if found {
our_el, err := (*store).Get(name)
if err == nil {
return *our_el
} else {
panic(fmt.Sprintf("Error reading store %s for %s: %s", store, name, err))
}
}
}
panic("Could not find metric " + name + " in any of the stores")
}