location 레이블 변경

This commit is contained in:
2023-11-26 18:42:05 +09:00
parent 7e7d023252
commit 92711de4a1

View File

@ -131,7 +131,7 @@ func init() {
logger.Println("metrics are going to be generated for houston") logger.Println("metrics are going to be generated for houston")
go mc.metricWriter() go mc.metricWriter()
NewMetric = newMetricImpl NewMetric = newMetricImpl
ConcurrentUser = NewMetric(MetricGuage, "concurrent_user", "concurrent user count", map[string]string{"location": "lobby"}) ConcurrentUser = NewMetric(MetricGuage, "concurrent_user", "concurrent user count", map[string]string{"game": "lobby"})
} else { } else {
logger.Println("metrics are NOT going to be generated. parent is not houston :", filename, string(fn)) logger.Println("metrics are NOT going to be generated. parent is not houston :", filename, string(fn))
} }
@ -147,15 +147,6 @@ func newMetricImpl(mt MetricType, name string, help string, constLabels map[stri
hash := md5.New() hash := md5.New()
hash.Write([]byte(name)) hash.Write([]byte(name))
if constLabels == nil {
constLabels = make(map[string]string)
}
hn, _ := os.Hostname()
sn := path.Base(os.Args[0])
constLabels["hostname"] = hn
constLabels["service"] = sn
key := hex.EncodeToString(hash.Sum(nil))[:metric_key_size] key := hex.EncodeToString(hash.Sum(nil))[:metric_key_size]
temp, _ := json.Marshal(MetricDescription{ temp, _ := json.Marshal(MetricDescription{
Key: key, Key: key,