fluent / fluent-plugin-prometheus

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

tail_monitor plugin incompatible with prometheus-client 0.10.0 #119

Closed eherot closed 5 years ago

eherot commented 5 years ago

Here's the relevant part of the stack trace from the fluentd logs:

2019-10-07 20:25:04 +0000 [error]: unexpected error error_class=ArgumentError error="wrong number of arguments (given 2, expected 1)"
  2019-10-07 20:25:04 +0000 [error]: /var/lib/gems/2.3.0/gems/prometheus-client-0.10.0/lib/prometheus/client/registry.rb:56:in `gauge'
  2019-10-07 20:25:04 +0000 [error]: /var/lib/gems/2.3.0/gems/fluent-plugin-prometheus-1.6.0/lib/fluent/plugin/in_prometheus_tail_monitor.rb:53:in `start'
  2019-10-07 20:25:04 +0000 [error]: /var/lib/gems/2.3.0/gems/fluentd-1.7.3/lib/fluent/root_agent.rb:203:in `block in start'

From the looks of it the problem is this code:

      @metrics = {
        position: @registry.gauge(
          :fluentd_tail_file_position,
          'Current position of file.'),
        inode: @registry.gauge(
          :fluentd_tail_file_inode,
          'Current inode of file.'),
      }

...which no longer works because of this change (although even more arguments have since been added).

Adding a version constraint to limit prometheus-client to 0.9.0 seems to be an effective workaround but obviously it isn't a good permanent solution.

sungmincs commented 5 years ago

Having the same issue, started today as this one just got released. https://rubygems.org/gems/prometheus-client/versions/0.4.2

fluent-plugin-prometheus gemspec should have version locking such as ~> 0.9.0 https://github.com/fluent/fluent-plugin-prometheus/blob/master/fluent-plugin-prometheus.gemspec#L17

repeatedly commented 5 years ago

Release v1.6.1 with pinned prometheus-client version. Thanks for the report.

sungmincs commented 5 years ago

Do you have any backporting plan for this fix?

repeatedly commented 5 years ago

Why backport is needed? For v1, latest version is recommended.

sungmincs commented 5 years ago

We are currently using 1.3.0 and all the new docker builds started failing due to this dependency issue. As a workaround, I added prometheus-client 0.9 installation prior to fluent-plugin-prometheus installation, but just curious if there will be backports so we can plan ahead the future versioning.