From dcc5e02ce32059a47a4857523b11d7546958cec2 Mon Sep 17 00:00:00 2001 From: Athish Pranav D Date: Mon, 5 Aug 2024 11:46:04 +0530 Subject: [PATCH 1/3] Appended exposed throttling metrics to tail monitor plugin Signed-off-by: Athish Pranav D --- lib/fluent/plugin/in_prometheus_tail_monitor.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/fluent/plugin/in_prometheus_tail_monitor.rb b/lib/fluent/plugin/in_prometheus_tail_monitor.rb index e7db19a..4e9adee 100644 --- a/lib/fluent/plugin/in_prometheus_tail_monitor.rb +++ b/lib/fluent/plugin/in_prometheus_tail_monitor.rb @@ -60,6 +60,9 @@ def start rotated_file_metrics: get_gauge( :fluentd_tail_file_rotated, 'Number of files rotated.'), + throttled_file_metrics: get_gauge( + :fluentd_tail_file_throttled, + 'Number of files throttled.'), } timer_execute(:in_prometheus_tail_monitor, @interval, &method(:update_monitor_info)) end @@ -89,6 +92,7 @@ def update_monitor_info @metrics[:closed_file_metrics].set(monitor_info.closed.get, labels: label) @metrics[:opened_file_metrics].set(monitor_info.opened.get, labels: label) @metrics[:rotated_file_metrics].set(monitor_info.rotated.get, labels: label) + @metrics[:throttled_file_metrics].set(monitor_info.throttled.get, labels: label) end end end From e4cfd6ff6d80f42aef11c2101010b908e326ff12 Mon Sep 17 00:00:00 2001 From: Athish Pranav D Date: Mon, 5 Aug 2024 11:47:02 +0530 Subject: [PATCH 2/3] Updated README Signed-off-by: Athish Pranav D --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 769da6e..9968c6a 100644 --- a/README.md +++ b/README.md @@ -168,6 +168,7 @@ This plugin uses internal class of Fluentd, so it's easy to break. - `fluentd_tail_file_closed`: Number of closed files - `fluentd_tail_file_opened`: Number of opened files - `fluentd_tail_file_rotated`: Number of rotated files +- `fluentd_tail_file_throttled`: Number of throttled files Default labels: From 5fc1132daec347477a55b83db09ff1e18e96cf39 Mon Sep 17 00:00:00 2001 From: Athish Pranav D Date: Thu, 8 Aug 2024 10:05:07 +0530 Subject: [PATCH 3/3] Merging with changes for comments Signed-off-by: Athish Pranav D --- README.md | 2 +- lib/fluent/plugin/in_prometheus_tail_monitor.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9968c6a..4ae8450 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,7 @@ This plugin uses internal class of Fluentd, so it's easy to break. - `fluentd_tail_file_closed`: Number of closed files - `fluentd_tail_file_opened`: Number of opened files - `fluentd_tail_file_rotated`: Number of rotated files -- `fluentd_tail_file_throttled`: Number of throttled files +- `fluentd_tail_file_throttled`: Number of times files got throttled (only with fluentd version > 1.17) Default labels: diff --git a/lib/fluent/plugin/in_prometheus_tail_monitor.rb b/lib/fluent/plugin/in_prometheus_tail_monitor.rb index 4e9adee..10bc698 100644 --- a/lib/fluent/plugin/in_prometheus_tail_monitor.rb +++ b/lib/fluent/plugin/in_prometheus_tail_monitor.rb @@ -62,7 +62,7 @@ def start 'Number of files rotated.'), throttled_file_metrics: get_gauge( :fluentd_tail_file_throttled, - 'Number of files throttled.'), + 'Number of times files got throttled.'), } timer_execute(:in_prometheus_tail_monitor, @interval, &method(:update_monitor_info)) end @@ -92,7 +92,7 @@ def update_monitor_info @metrics[:closed_file_metrics].set(monitor_info.closed.get, labels: label) @metrics[:opened_file_metrics].set(monitor_info.opened.get, labels: label) @metrics[:rotated_file_metrics].set(monitor_info.rotated.get, labels: label) - @metrics[:throttled_file_metrics].set(monitor_info.throttled.get, labels: label) + @metrics[:throttled_file_metrics].set(monitor_info.throttled.get, labels: label) if monitor_info.members.include?(:throttled) end end end