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

Add throttling metrics #227

Merged
merged 3 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
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
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