Skip to content

Commit

Permalink
renaming by taking out _in_disk and _from_disk terms from New Metric …
Browse files Browse the repository at this point in the history
…specific parameters name and restoring back the interval parameter default value to 5
  • Loading branch information
pmoogi-redhat committed Mar 1, 2021
1 parent ba3f8d1 commit b74b907
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class PrometheusTailMonitorInput < Fluent::Plugin::Input

helpers :timer

config_param :interval, :time, default: 1
config_param :interval, :time, default: 5
attr_reader :registry

MONITOR_IVARS = [
Expand Down Expand Up @@ -51,11 +51,11 @@ def start
inode: get_gauge(
:fluentd_tail_file_inode,
'Current inode of file.'),
totalbytes_logged_in_disk: get_gauge(
:fluentd_totalbytes_logged_in_disk,
totalbytes_logged: get_gauge(
:fluentd_totalbytes_logged,
'totalbytes logged in disk.'),
totalbytes_collected_from_disk: get_gauge(
:fluentd_totalbytes_collected_from_disk,
totalbytes_collected: get_gauge(
:fluentd_totalbytes_collected,
'totalbytes read or collected from disk.'),
}
timer_execute(:in_prometheus_tail_monitor, @interval, &method(:update_monitor_info))
Expand All @@ -78,13 +78,13 @@ def update_monitor_info
# Access to internal variable of internal class...
# Very fragile implementation
pe = watcher.instance_variable_get(:@pe)
totalbytes_logged_in_disk=watcher.instance_variable_get(:@totalbytes_logged_in_disk)
totalbytes_collected_from_disk=watcher.instance_variable_get(:@totalbytes_collected_from_disk)
totalbytes_logged=watcher.instance_variable_get(:@totalbytes_logged)
totalbytes_collected=watcher.instance_variable_get(:@totalbytes_collected)
label = labels(info, watcher.path)
@metrics[:inode].set(label, pe.read_inode)
@metrics[:position].set(label, pe.read_pos)
@metrics[:totalbytes_logged_in_disk].set(label,totalbytes_logged_in_disk)
@metrics[:totalbytes_collected_from_disk].set(label,totalbytes_collected_from_disk)
@metrics[:totalbytes_logged].set(label,totalbytes_logged)
@metrics[:totalbytes_collected].set(label,totalbytes_collected)
end
end
end
Expand Down

0 comments on commit b74b907

Please sign in to comment.