-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathdata.go
37 lines (34 loc) · 911 Bytes
/
data.go
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
28
29
30
31
32
33
34
35
36
37
package main
import (
"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
found, err = stores.IsTextMetric(name)
if err != nil {
panic("Error reading metric " + name + " from TextStore: " + err.Error())
}
if found {
our_el, err := stores.ReadTextMetric(name)
if err == nil {
return *our_el
} else {
panic("Error reading metric " + name + " from TextStore: " + err.Error())
}
}
found, err = stores.IsEsMetric(name)
if err != nil {
panic("Error reading metric " + name + " from EsStore: " + err.Error())
}
if found {
our_el, err := stores.ReadEsMetric(name)
if err == nil {
return *our_el
} else {
panic("Error reading metric " + name + " from EsStore: " + err.Error())
}
}
panic("Could not find metric " + name + " in any of the stores")
}