diff --git a/README.md b/README.md index 769da6e..4ae8450 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 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 e7db19a..10bc698 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 times files got 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) if monitor_info.members.include?(:throttled) end end end