Use NewMetric to create a new metric

This commit is contained in:
Holger Obermaier
2026-05-06 13:22:02 +02:00
parent 0f6fee9db4
commit 8e58072ff6
16 changed files with 52 additions and 141 deletions

View File

@@ -86,15 +86,7 @@ func (m *TopProcsCollector) Read(interval time.Duration, output chan lp.CCMessag
lines := strings.Split(string(stdout), "\n")
for i := 1; i < m.config.Num_procs+1; i++ {
name := fmt.Sprintf("topproc%d", i)
y, err := lp.NewMessage(
name,
m.tags,
m.meta,
map[string]any{
"value": lines[i],
},
time.Now())
if err == nil {
if y, err := lp.NewMetric(name, m.tags, m.meta, lines[i], time.Now()); err == nil {
output <- y
}
}