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