[prometheus, rails]如何在 rails 服务器上启用 prometheus

[promethues, rails]How to enable promethues on rails server

我有一个实时 rails 应用程序,我正在尝试安装 prometheus monitoring service, using its Ruby Client

我 运行 服务器上的教程运行良好,但一个小时后 merics url 死了。

如何让它在我的实时服务器上运行?

如果我添加现有项目,如下所示,Prometheus 会给出 "not found" 错误

I, [2015-08-31T10:54:40.274066 #3542]  INFO -- : Refreshing Gem list
/PATH/shared/bundle/ruby/2.2.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require': cannot load such file -- prometheus/client/rack/collector (LoadError)
    from /PATH/shared/bundle/ruby/2.2.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `block in require'
    from /PATH/shared/bundle/ruby/2.2.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /PATH/shared/bundle/ruby/2.2.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `require'
    from config.ru:8:in `block in <main>'
    from /PATH/shared/bundle/ruby/2.2.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `instance_eval'
    from /PATH/shared/bundle/ruby/2.2.0/gems/rack-1.5.5/lib/rack/builder.rb:55:in `initialize'
    from config.ru:1:in `new'
    from config.ru:1:in `<main>'
    from /PATH/shared/bundle/ruby/2.2.0/gems/unicorn-4.9.0/lib/unicorn.rb:48:in `eval'
    from /PATH/shared/bundle/ruby/2.2.0/gems/unicorn-4.9.0/lib/unicorn.rb:48:in `block in builder'
    from /PATH/shared/bundle/ruby/2.2.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:768:in `call'
    from /PATH/shared/bundle/ruby/2.2.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:768:in `build_app!'
    from /PATH/shared/bundle/ruby/2.2.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:632:in `init_worker_process'
    from PATH/shared/bundle/ruby/2.2.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:655:in `worker_loop'
    from /PATH/shared/bundle/ruby/2.2.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:529:in `spawn_missing_workers'
    from /PATH/shared/bundle/ruby/2.2.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:540:in `maintain_worker_count'
    from /PATH/shared/bundle/ruby/2.2.0/gems/unicorn-4.9.0/lib/unicorn/http_server.rb:294:in `join'
    from /PATH/shared/bundle/ruby/2.2.0/gems/unicorn-4.9.0/bin/unicorn:126:in `<top (required)>'
    from /PATH/shared/bundle/ruby/2.2.0/bin/unicorn:23:in `load'
    from /PATH/shared/bundle/ruby/2.2.0/bin/unicorn:23:in `<main>'

我有两台服务器

  1. promethus_server
  2. live_server + 普罗米修斯客户端)

live_server 和 promethus_client 在不同的路径中。

我在服务器上手动运行 promethus 客户端:

$ rails new client
$ bundle (adding promethus-client Gem)
$ vi config.ru (add promethus lib)
$ rail s --binding=IP

这是正确的吗?

这是我最近升级的应用程序 config.ru 的样子:

require ::File.expand_path('../config/environment', FILE)
require 'rack'
require 'prometheus/client/rack/collector'
require 'prometheus/client/rack/exporter'

use Prometheus::Client::Rack::Collector
use Prometheus::Client::Rack::Exporter

run Rails.application