Skip to content

Commit

Permalink
feat: log metrics labels on pod term
Browse files Browse the repository at this point in the history
  • Loading branch information
alexec committed Oct 5, 2021
1 parent f318ebf commit 64f8f10
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion runner/sidecar/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,13 @@ func logMetrics(ctx context.Context) error {
} else if g := m.Gauge; g != nil && g.Value != nil {
v = g.Value
}
logger.Info("metric", "name", f.GetName(), "value", v)
logger := logger.WithValues("name", f.GetName(), "value", v)
for _, p := range m.Label {
if p != nil && p.Name != nil && p.Value != nil { // paranoid check
logger = logger.WithValues(*p.Name, *p.Value)
}
}
logger.Info("metric")
}
}
return nil
Expand Down

0 comments on commit 64f8f10

Please sign in to comment.