feat: labels map en config (role) → extra_label en métricas + stream labels en logs
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user