feat: labels map en config (role) → extra_label en métricas + stream labels en logs

This commit is contained in:
Egutierrez
2026-06-07 18:00:37 +02:00
parent 4cdb4b6557
commit 921ac3caa6
3 changed files with 20 additions and 3 deletions
+2 -2
View File
@@ -159,7 +159,7 @@ func shipJournald(ctx context.Context, cfg Config, binPath string) {
ts[i] = it.ts
ln[i] = it.line
}
labels := map[string]string{"instance": cfg.Node, "job": "journald", "unit": unit}
labels := cfg.extraLabels(map[string]string{"job": "journald", "unit": unit})
if err := infra.PushLokiStream(cfg.LokiURL, cfg.User, cfg.Pass, labels, ts, ln); err != nil {
log.Printf("logs: push error (unit=%s, %d lines): %v", unit, len(items), err)
}
@@ -195,7 +195,7 @@ func shipFileTail(ctx context.Context, cfg Config, path, job string) {
if fi, err := os.Stat(path); err == nil {
offset = fi.Size() // skip pre-existing history on first start
}
labels := map[string]string{"instance": cfg.Node, "job": job}
labels := cfg.extraLabels(map[string]string{"job": job})
ticker := time.NewTicker(3 * time.Second)
defer ticker.Stop()