Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug with new promtail stream lag metric #5675

Merged
merged 1 commit into from
Mar 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions clients/pkg/promtail/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,16 @@ func (c *client) sendBatch(tenantID string, batch *batch) {
return
}
lblSet := make(prometheus.Labels)
for i := range lbls {
for _, lbl := range c.streamLagLabels {
for _, lbl := range c.streamLagLabels {
// label from streamLagLabels may not be found but we still need an empty value
// so that the prometheus client library doesn't panic on inconsistent label cardinality
value := ""
for i := range lbls {
if lbls[i].Name == lbl {
lblSet[lbl] = lbls[i].Value
value = lbls[i].Value
}
}
lblSet[lbl] = value
}
if lblSet != nil {
// always set host
Expand Down