From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS14383 205.234.109.0/24 X-Spam-Status: No, score=-0.7 required=5.0 tests=AWL,MSGID_FROM_MTA_HEADER, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.unicorn.general Subject: Re: Metrics Date: Wed, 21 Oct 2009 22:13:13 -0700 Message-ID: <20091022051313.GA7022@dcvr.yhbt.net> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1256188811 21556 80.91.229.12 (22 Oct 2009 05:20:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 22 Oct 2009 05:20:11 +0000 (UTC) To: unicorn list Original-X-From: mongrel-unicorn-bounces@rubyforge.org Thu Oct 22 07:19:59 2009 Return-path: Envelope-to: gclrug-mongrel-unicorn@m.gmane.org X-Original-To: mongrel-unicorn@rubyforge.org Delivered-To: mongrel-unicorn@rubyforge.org Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-BeenThere: mongrel-unicorn@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: mongrel-unicorn-bounces@rubyforge.org Errors-To: mongrel-unicorn-bounces@rubyforge.org Xref: news.gmane.org gmane.comp.lang.ruby.unicorn.general:99 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.50) id 1N0q5f-0007VJ-1w for gclrug-mongrel-unicorn@m.gmane.org; Thu, 22 Oct 2009 07:19:59 +0200 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 20BEC1858293; Thu, 22 Oct 2009 01:19:58 -0400 (EDT) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id 3696C18582AC for ; Thu, 22 Oct 2009 01:13:17 -0400 (EDT) Received: from localhost (user-118bg0q.cable.mindspring.com [66.133.192.26]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPSA id CE7BC1F7A1; Thu, 22 Oct 2009 05:13:15 +0000 (UTC) John Wulff 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