Coder Social home page Coder Social logo

puma-metrics's People

Contributors

dependabot[bot] avatar grrrisu avatar harmjanblok avatar jasquat avatar julik avatar mdub avatar mikz avatar renovate-bot avatar renovate[bot] avatar severinkaelin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

puma-metrics's Issues

Puma 6 support

Hello
First of all, thanks for the great gem.

There seem to be compatibility issues with the latest version of the gem (1.2.5) and the latest version of puma (6.0.0).

Gemfile.lock:

puma (6.0.0)
  nio4r (~> 2.0)
puma-metrics (1.2.5)
  prometheus-client (>= 0.10)
  puma (>= 5.0)

config/puma.rb:

...
# Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart
plugin 'metrics'

Attempt to start the rails server / puma (rails s):

severin@ws:~/dev/HelloWorld$ rails s
=> Booting Puma
=> Rails 7.0.4 application starting in development 
=> Run `bin/rails server --help` for more startup options
Exiting
/home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-metrics-1.2.5/lib/puma/plugin/metrics.rb:16:in `start': undefined method `min_threads=' for #<Puma::Server:0x00007feb3ee15c40...
    metrics.min_threads = 0
           ^^^^^^^^^^^^^^
Did you mean?  min_threads
               max_threads
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/plugin.rb:24:in `block in fire_starts'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/plugin.rb:22:in `each'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/plugin.rb:22:in `fire_starts'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:179:in `run'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/rack/handler/puma.rb:72:in `run'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/server.rb:327:in `start'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:38:in `start'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:143:in `block in perform'
	from <internal:kernel>:90:in `tap'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:134:in `perform'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from /home/severin/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'
	from bin/rails:4:in `<main>'

See details about the Puma 6 upgrade: https://github.com/puma/puma/blob/master/6.0-Upgrade.md#upgrade

  1. We've removed the following public methods on Puma::Server: Puma::Server#min_threads, Puma::Server#max_threads. Instead, you can pass in configuration as an option to Puma::Server#new. This might make certain gems break (capybara for example).

Question - Why is request count a gauge?

Why is the request count metric a gauge? Shouldn't it be a counter? I don't understand how a sum of all the requests over time is useful?

Thanks for building this gem BTW! I found it frustrating that the prometheus-client couldn't listen on a different port, this gem hits that itch!

Incompatible with prometheus-client 1.x

I'm trying to use puma-metrics in an app where I'm already using prometheus-client 1.0.0, but it's currently not possible, due to the dependency:

spec.add_runtime_dependency 'prometheus-client', '~> 0.10'

Can that dependency be relaxed?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

bundler
Gemfile
  • bundler '>= 2.0.0'
  • minitest undefined
  • overcommit undefined
  • rake undefined
  • rubocop undefined
github-actions
.github/workflows/workflow.yml

  • Check this box to trigger a request for Renovate to run again on this repository

Support Puma 5

Puma 5 is our and a few changes are made relevant to this gem:

  • The default threads on MRI are now 5 not 16 hence a few tests depending on this default will fail (example). Should be better to configure the values explicitly so the tests are not coupled to the Puma version.
  • There is a new per worker server stat requests_count that would be nice to expose as a Prometheus metric.

NoMethodError: undefined method `stats' for nil:NilClass

Hey, thanks for this very useful plugin.

We are experiencing a bug during deployments. It appears that metrics endpoint is served earlier than the rest of the application. This leads to:

NoMethodError: undefined method `stats' for nil:NilClass` exception.

Software versions: puma (6.3.1), puma-metrics (1.3.0)

Stacktrace:

NoMethodError: undefined method `stats' for nil:NilClass (NoMethodError)

      }.merge(@server.stats).merge(super)
                     ^^^^^^
  from puma/single.rb:20:in `stats'
  from puma/launcher.rb:115:in `stats'
  from puma/metrics/app.rb:26:in `retrieve_and_parse_stats!'
  from puma/metrics/app.rb:17:in `call'
  from puma/request.rb:100:in `block in handle_request'
  from puma/thread_pool.rb:344:in `with_force_shutdown'
  from puma/request.rb:99:in `handle_request'
  from puma/server.rb:443:in `process_client'
  from puma/server.rb:245:in `block in run'
  from puma/thread_pool.rb:151:in `block in spawn_thread'

I am not exactly sure how this can be fixed, should Puma check if @server is nil before invoking merge:

  class Single < Runner
    # @!attribute [r] stats
    def stats
      {
        started_at: utc_iso8601(@started_at)
      }.merge(@server.stats).merge(super)
    end

or should the metrics plugin check some status on @launcher before invoking stats.

      def retrieve_and_parse_stats!
        puma_stats = @launcher.stats

Related code:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.