fluent / fluent-plugin-prometheus

A fluent plugin that collects metrics and exposes for Prometheus.
Apache License 2.0
258 stars 79 forks source link

plugin doesn't support config reloading #162

Closed ilansh closed 4 years ago

ilansh commented 4 years ago

Fluentd accepts signals to reload its configuration on the fly, see docs here:
https://docs.fluentd.org/deployment/signals#sigusr2

However, fluent-plugin-prometheus does not support it, and in fact - as a result the entire configuration file can't be reloaded.
The error emitted by fluentd is:

2020-07-08 15:25:38 +0000 [error]: Failed to reload config file: Unreloadable plugin plugin: prometheus_output_monitor, plugin_id: object:2b2865ee5e40, class_name: Fluent::Plugin::PrometheusOutputMonitorInput)

I dived in a little and found that this is because the plugin defines class variables.
Here are the relevant lines:
https://github.com/fluent/fluentd/blob/be81226ff3a270cba3087cfa3f16266bdf4f7b5b/lib/fluent/plugin/base.rb#L193 and
https://github.com/fluent/fluentd/blob/be81226ff3a270cba3087cfa3f16266bdf4f7b5b/lib/fluent/engine.rb#L173

repeatedly commented 4 years ago

Patch: https://github.com/fluent/fluent-plugin-prometheus/pull/164

repeatedly commented 4 years ago

Release v1.8.2