yabeda-rb / yabeda-prometheus

Adapter to expose metrics collected by Yabeda plugins to Prometheus
MIT License
113 stars 18 forks source link

Support prometheus-client-0.10.0 #6

Closed alexander37137 closed 4 years ago

alexander37137 commented 5 years ago

In prometheus-client version 0.10.0 fixed support of pre-fork servers https://github.com/prometheus/client_ruby/issues/9#issuecomment-505435175 But yabeda-prometheus failed to start with this version with such exception

web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/prometheus-client-0.10.0.pre.alpha.2/lib/prometheus/client/label_set_validator.rb:18:in `initialize'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/yabeda-prometheus-0.1.4/lib/yabeda/prometheus/metric_wrapper.rb:12:in `new'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/yabeda-prometheus-0.1.4/lib/yabeda/prometheus/metric_wrapper.rb:12:in `initialize'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/yabeda-prometheus-0.1.4/lib/yabeda/prometheus/adapter.rb:17:in `new'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/yabeda-prometheus-0.1.4/lib/yabeda/prometheus/adapter.rb:17:in `register_counter!'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/yabeda-0.1.3/lib/yabeda/base_adapter.rb:8:in `register!'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/yabeda-0.1.3/lib/yabeda/dsl/class_methods.rb:62:in `block in register_metric'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/yabeda-0.1.3/lib/yabeda/dsl/class_methods.rb:62:in `each_value'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/yabeda-0.1.3/lib/yabeda/dsl/class_methods.rb:62:in `register_metric'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/yabeda-0.1.3/lib/yabeda/dsl/class_methods.rb:41:in `counter'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/yabeda-sidekiq-0.1.3/lib/yabeda/sidekiq.rb:21:in `block in <module:Sidekiq>'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/yabeda-0.1.3/lib/yabeda/dsl/class_methods.rb:17:in `class_exec'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/yabeda-0.1.3/lib/yabeda/dsl/class_methods.rb:17:in `configure'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/yabeda-sidekiq-0.1.3/lib/yabeda/sidekiq.rb:18:in `<module:Sidekiq>'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/yabeda-sidekiq-0.1.3/lib/yabeda/sidekiq.rb:12:in `<module:Yabeda>'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/yabeda-sidekiq-0.1.3/lib/yabeda/sidekiq.rb:11:in `<main>'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/lib/ruby/2.6.0/bundler/runtime.rb:95:in `rescue in block in require'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/lib/ruby/2.6.0/bundler/runtime.rb:72:in `block in require'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/lib/ruby/2.6.0/bundler/runtime.rb:65:in `each'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/lib/ruby/2.6.0/bundler/runtime.rb:65:in `require'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/lib/ruby/2.6.0/bundler.rb:114:in `require'
web_1        | 13:20:20 sidekiq-1.1 | /rest/u/apps/elections_admin/current/config/application.rb:18:in `<top (required)>'
web_1        | 13:20:20 sidekiq-1.1 | /rest/u/apps/elections_admin/current/config/environment.rb:2:in `require_relative'
web_1        | 13:20:20 sidekiq-1.1 | /rest/u/apps/elections_admin/current/config/environment.rb:2:in `<top (required)>'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/sidekiq-5.2.7/lib/sidekiq/cli.rb:288:in `require'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/sidekiq-5.2.7/lib/sidekiq/cli.rb:288:in `boot_system'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/sidekiq-5.2.7/lib/sidekiq/cli.rb:46:in `run'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/gems/sidekiq-5.2.7/bin/sidekiq:12:in `<top (required)>'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/bin/sidekiq:23:in `load'
web_1        | 13:20:20 sidekiq-1.1 | /usr/local/bundle/bin/sidekiq:23:in `<main>'
web_1        | 13:20:20 sidekiq-1.1 | 2019-08-16T13:20:20.523Z 13 TID-goc7qexxt INFO: Booting Sidekiq 5.2.7 with redis options {:id=>"Sidekiq-server-PID-13", :url=>nil}
web_1        | 13:20:21 sidekiq-2.1 | missing keyword: expected_labels
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/prometheus-client-0.10.0.pre.alpha.2/lib/prometheus/client/label_set_validator.rb:18:in `initialize'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/yabeda-prometheus-0.1.4/lib/yabeda/prometheus/metric_wrapper.rb:12:in `new'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/yabeda-prometheus-0.1.4/lib/yabeda/prometheus/metric_wrapper.rb:12:in `initialize'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/yabeda-prometheus-0.1.4/lib/yabeda/prometheus/adapter.rb:17:in `new'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/yabeda-prometheus-0.1.4/lib/yabeda/prometheus/adapter.rb:17:in `register_counter!'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/yabeda-0.1.3/lib/yabeda/base_adapter.rb:8:in `register!'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/yabeda-0.1.3/lib/yabeda/dsl/class_methods.rb:62:in `block in register_metric'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/yabeda-0.1.3/lib/yabeda/dsl/class_methods.rb:62:in `each_value'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/yabeda-0.1.3/lib/yabeda/dsl/class_methods.rb:62:in `register_metric'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/yabeda-0.1.3/lib/yabeda/dsl/class_methods.rb:41:in `counter'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/yabeda-sidekiq-0.1.3/lib/yabeda/sidekiq.rb:21:in `block in <module:Sidekiq>'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/yabeda-0.1.3/lib/yabeda/dsl/class_methods.rb:17:in `class_exec'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/yabeda-0.1.3/lib/yabeda/dsl/class_methods.rb:17:in `configure'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/yabeda-sidekiq-0.1.3/lib/yabeda/sidekiq.rb:18:in `<module:Sidekiq>'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/yabeda-sidekiq-0.1.3/lib/yabeda/sidekiq.rb:12:in `<module:Yabeda>'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/yabeda-sidekiq-0.1.3/lib/yabeda/sidekiq.rb:11:in `<main>'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/lib/ruby/2.6.0/bundler/runtime.rb:95:in `rescue in block in require'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/lib/ruby/2.6.0/bundler/runtime.rb:72:in `block in require'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/lib/ruby/2.6.0/bundler/runtime.rb:65:in `each'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/lib/ruby/2.6.0/bundler/runtime.rb:65:in `require'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/lib/ruby/2.6.0/bundler.rb:114:in `require'
web_1        | 13:20:21 sidekiq-2.1 | /rest/u/apps/elections_admin/current/config/application.rb:18:in `<top (required)>'
web_1        | 13:20:21 sidekiq-2.1 | /rest/u/apps/elections_admin/current/config/environment.rb:2:in `require_relative'
web_1        | 13:20:21 sidekiq-2.1 | /rest/u/apps/elections_admin/current/config/environment.rb:2:in `<top (required)>'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/sidekiq-5.2.7/lib/sidekiq/cli.rb:288:in `require'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/sidekiq-5.2.7/lib/sidekiq/cli.rb:288:in `boot_system'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/sidekiq-5.2.7/lib/sidekiq/cli.rb:46:in `run'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/gems/sidekiq-5.2.7/bin/sidekiq:12:in `<top (required)>'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/bin/sidekiq:23:in `load'
web_1        | 13:20:21 sidekiq-2.1 | /usr/local/bundle/bin/sidekiq:23:in `<main>'
Envek commented 5 years ago

Sorry for the late reply – I will take a look in a couple of days

Envek commented 5 years ago

The problem here is that they changed API in 0.10 (see their UPGRADING file), so now I have to break compatibility with prometheus-client-mmap (anyway now it should be redundant, because now official client implemented the same). Stay tuned.

Envek commented 4 years ago

Support for prometheus-client 1.0 (they have bumped version from 0.10 to 1.0) was released in 0.2.0. Enjoy!