store and report git info
This commit is contained in:
parent
56bd8445a4
commit
bcbbe000f3
@ -27,6 +27,7 @@ func main() {
|
||||
r := hw.V{
|
||||
Hostname: hn,
|
||||
V: hw.Version,
|
||||
G: hw.Git,
|
||||
}
|
||||
if err := json.NewEncoder(w).Encode(r); err != nil {
|
||||
log.Printf("json: %+v", err)
|
||||
|
@ -20,6 +20,7 @@ var success *prometheus.CounterVec
|
||||
type state struct {
|
||||
Hostname string `json:"hostname"`
|
||||
V string `json:"version"`
|
||||
G string `json:"git"`
|
||||
|
||||
sync.RWMutex
|
||||
Counts map[string]int `json:"counts"`
|
||||
@ -84,6 +85,7 @@ func main() {
|
||||
fetcher := state{
|
||||
Hostname: hn,
|
||||
V: hw.Version,
|
||||
G: hw.Git,
|
||||
Counts: map[string]int{},
|
||||
}
|
||||
go fetcher.update(target)
|
||||
|
2
hw.go
2
hw.go
@ -3,6 +3,7 @@ package hw
|
||||
import "net/http"
|
||||
|
||||
var Version = "unset"
|
||||
var Git = "unset"
|
||||
|
||||
// OK simply return 200
|
||||
func OK(w http.ResponseWriter, req *http.Request) {}
|
||||
@ -11,4 +12,5 @@ func OK(w http.ResponseWriter, req *http.Request) {}
|
||||
type V struct {
|
||||
Hostname string `json:"hostname"`
|
||||
V string `json:"version"`
|
||||
G string `json:"git"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user