Skip to content

Commit 9f14908

Browse files
author
zhangye
committed
Merge branch 'debug' into 'master'
Debug See merge request !41
2 parents 002f592 + 49278e1 commit 9f14908

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.7.12b
1+
0.7.12c

g/statsd.go

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ func (self *StatsDClient) Send(data map[string]float64, endpoint, tag string) er
3131
}
3232

3333
var Statsd = StatsDClient{}
34+
var Hostname string
3435

3536
func NewStatsdClient(addr string) {
3637
Statsd = StatsDClient{addr}

main.go

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ func serve() {
8686
}
8787

8888
g.NewStatsdClient(config.Statsd)
89+
g.Hostname = os.Getenv("HOSTNAME")
8990

9091
cluster, err := calcium.New(config)
9192
if err != nil {

utils/utils.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,8 @@ func SendMemCap(cpumemmap map[string]types.CPUAndMem, tag string) {
143143
for node, cpuandmem := range cpumemmap {
144144
data[node] = float64(cpuandmem.MemCap)
145145
}
146-
host := os.Getenv("HOSTNAME")
147-
log.Debugf("hostname: %s", host)
148-
clean_host := strings.Replace(host, ".", "-", -1)
146+
clean_host := strings.Replace(g.Hostname, ".", "-", -1)
147+
149148
err := g.Statsd.Send(data, clean_host, tag)
150149
if err != nil {
151150
log.Errorf("Error occured while sending data to statsd: %v", err)

0 commit comments

Comments
 (0)