Consolidates the V struct
This commit is contained in:
parent
ce2faa39eb
commit
56bd8445a4
@ -13,11 +13,6 @@ import (
|
||||
"mcquay.me/metrics"
|
||||
)
|
||||
|
||||
type v struct {
|
||||
Hostname string `json:"hostname"`
|
||||
V string `json:"version"`
|
||||
}
|
||||
|
||||
func main() {
|
||||
m, err := metrics.New("hw")
|
||||
if err != nil {
|
||||
@ -29,7 +24,7 @@ func main() {
|
||||
}
|
||||
http.HandleFunc("/", m.WrapFunc("/", func(w http.ResponseWriter, req *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
r := v{
|
||||
r := hw.V{
|
||||
Hostname: hn,
|
||||
V: hw.Version,
|
||||
}
|
||||
|
@ -17,11 +17,6 @@ import (
|
||||
|
||||
var success *prometheus.CounterVec
|
||||
|
||||
type v struct {
|
||||
Hostname string `json:"hostname"`
|
||||
V string `json:"version"`
|
||||
}
|
||||
|
||||
type state struct {
|
||||
Hostname string `json:"hostname"`
|
||||
V string `json:"version"`
|
||||
@ -45,7 +40,7 @@ func (s *state) update(target string) {
|
||||
continue
|
||||
}
|
||||
success.WithLabelValues("true").Inc()
|
||||
rv := v{}
|
||||
rv := hw.V{}
|
||||
if err := json.NewDecoder(httpResp.Body).Decode(&rv); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user