houston에 constlabel 설정 가능

This commit is contained in:
2024-02-15 12:17:22 +09:00
parent dcc94d2609
commit 9d4718592d
4 changed files with 16 additions and 10 deletions

View File

@ -213,7 +213,7 @@ func (hc *houstonClient) launch(meta *procmeta) error {
return err
}
stdReader := func(childProcName string, r io.ReadCloser, index int) {
stdReader := func(jobName string, r io.ReadCloser, index int) {
defer func() {
reco := recover()
if reco != nil {
@ -308,7 +308,12 @@ func (hc *houstonClient) launch(meta *procmeta) error {
if desc.ConstLabels == nil {
desc.ConstLabels = make(map[string]string)
}
desc.ConstLabels["index"] = fmt.Sprintf("%d", index)
for k, v := range hc.config.ConstLabels {
desc.ConstLabels[k] = v
}
desc.ConstLabels["job"] = jobName
metricExporter.RegisterMetric(&desc)
} else {