unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* Metrics
@ 2009-10-22  1:31 John Wulff
  2009-10-22  5:13 ` Metrics Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: John Wulff @ 2009-10-22  1:31 UTC (permalink / raw)
  To: mongrel-unicorn

I'm a Munin-aholic (http://github.com/jwulff/munin_plugins) and I'd
like to write a plugin for Unicorn.  Does Unicorn keep any interesting
metrics?  Requests handled, etc.?  If so, where can I find/access
them?

Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Metrics
  2009-10-22  1:31 Metrics John Wulff
@ 2009-10-22  5:13 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2009-10-22  5:13 UTC (permalink / raw)
  To: unicorn list

John Wulff <johnwulff@gmail.com> wrote:
> I'm a Munin-aholic (http://github.com/jwulff/munin_plugins) and I'd
> like to write a plugin for Unicorn.  Does Unicorn keep any interesting
> metrics?  Requests handled, etc.?  If so, where can I find/access
> them?

Nope, Unicorn tries to avoid anything that can be better implemented as
a Rack handler.  You could probably start with something like this:

# this is totally untested of course :)
class RequestCounter < Struct.new(:app, :nr)

  def initialize(app)
    super(app, 0)
  end

  def call(env)
    if env["PATH_INFO"] == "/NR"
      [200, { "Content-Type" => "text/plain" }, [ "#{nr}\n" ] ]
    else
      self.nr += 1
      app.call(env)
    end
  end

end

-- 
Eric Wong

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-22  5:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-22  1:31 Metrics John Wulff
2009-10-22  5:13 ` Metrics Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).