metric 등록 오류 수정

This commit is contained in:
2023-12-01 02:34:24 +09:00
parent 3913c6cdcf
commit ee1459d760

View File

@ -297,12 +297,11 @@ func (hc *houstonClient) launch(meta *procmeta) error {
logger.Println("unmarshal metric failed :", err, string(metricBuffer)) logger.Println("unmarshal metric failed :", err, string(metricBuffer))
continue continue
} }
if index != 0 {
if desc.ConstLabels == nil { if desc.ConstLabels == nil {
desc.ConstLabels = make(map[string]string) desc.ConstLabels = make(map[string]string)
} }
desc.ConstLabels["index"] = fmt.Sprintf("%d", index) desc.ConstLabels["index"] = fmt.Sprintf("%d", index)
}
metricExporter.RegisterMetric(&desc) metricExporter.RegisterMetric(&desc)
} else { } else {