From 70b6ee3c6c0399f318b13a62fa0214e66ebafb05 Mon Sep 17 00:00:00 2001 From: Jordan Rushing Date: Tue, 31 Aug 2021 13:39:46 -0500 Subject: [PATCH] Add missing `Inc()` to correctly increment the `dropStage.dropCount` metric on valid dropped log line; update related docs --- clients/pkg/logentry/stages/drop.go | 2 +- docs/sources/clients/promtail/stages/drop.md | 4 ++-- docs/sources/clients/promtail/stages/match.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clients/pkg/logentry/stages/drop.go b/clients/pkg/logentry/stages/drop.go index 368d641f6fe04..942cb628691d3 100644 --- a/clients/pkg/logentry/stages/drop.go +++ b/clients/pkg/logentry/stages/drop.go @@ -110,7 +110,7 @@ func (m *dropStage) Run(in chan Entry) chan Entry { out <- e continue } - m.dropCount.WithLabelValues(*m.cfg.DropReason) + m.dropCount.WithLabelValues(*m.cfg.DropReason).Inc() } }() return out diff --git a/docs/sources/clients/promtail/stages/drop.md b/docs/sources/clients/promtail/stages/drop.md index 2592f05518815..ef90ce8560565 100644 --- a/docs/sources/clients/promtail/stages/drop.md +++ b/docs/sources/clients/promtail/stages/drop.md @@ -137,7 +137,7 @@ However it would _not_ drop this log line: In this example the current time is 2020-08-12T12:00:00Z and `older_than` is 24h. All log lines which have a timestamp older than 2020-08-11T12:00:00Z will be dropped. -All lines dropped by this drop stage would also increment the `logentry_drop_lines_total` metric with a label `reason="line_too_old"` +All lines dropped by this drop stage would also increment the `logentry_dropped_lines_total` metric with a label `reason="line_too_old"` #### Dropping long log lines @@ -151,7 +151,7 @@ Given the pipeline: Would drop any log line longer than 8kb bytes, this is useful when Loki would reject a line for being too long. -All lines dropped by this drop stage would also increment the `logentry_drop_lines_total` metric with a label `reason="line_too_long"` +All lines dropped by this drop stage would also increment the `logentry_dropped_lines_total` metric with a label `reason="line_too_long"` ### Complex drops diff --git a/docs/sources/clients/promtail/stages/match.md b/docs/sources/clients/promtail/stages/match.md index 2016c5b5dd5e5..cf4aa35a541c6 100644 --- a/docs/sources/clients/promtail/stages/match.md +++ b/docs/sources/clients/promtail/stages/match.md @@ -104,7 +104,7 @@ label of `app` whose value is `pokey`. This does **not** match in our case, so the nested `json` stage is not ran. The fifth stage will drop any entries from the application `promtail` that matches -the regex `.*noisy error`. and will also increment the `logentry_drop_lines_total` +the regex `.*noisy error`. and will also increment the `logentry_dropped_lines_total` metric with a label `reason="promtail_noisy_error"` The final `output` stage changes the contents of the log line to be the value of