Skip to content

Commit

Permalink
Merge pull request #227 from Athishpranav2003/add-throttling-metrics
Browse files Browse the repository at this point in the history
Add throttling metrics
  • Loading branch information
ashie authored Aug 9, 2024
2 parents d2dc295 + 5fc1132 commit c031f8f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
4 changes: 4 additions & 0 deletions lib/fluent/plugin/in_prometheus_tail_monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c031f8f

Please sign in to comment.