Skip to content

Commit 499bb84

Browse files
committed
metrics: add getter method automatically
Signed-off-by: Shizuo Fujita <[email protected]>
1 parent d066438 commit 499bb84

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/fluent/plugin_helper/metrics.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ def metrics_create(namespace: "fluentd", subsystem: "metrics", name:, help_text:
7272

7373
@_metrics["#{@plugin_type_or_id}_#{namespace}_#{subsystem}_#{name}"] = metrics
7474

75+
singleton_class.module_eval do
76+
unless method_defined?(name)
77+
define_method(name) { metrics.get }
78+
end
79+
end
80+
7581
metrics
7682
end
7783

0 commit comments

Comments
 (0)