+ Adam and Will, who can both speak to the value of gadget stats.

Please use "Reply All" as this includes some people not subscribed to
shindig-dev.


On Jan 20, 2008 9:06 PM, Rodrigo Damazio <[EMAIL PROTECTED]> wrote:

>    Hi all. I have written a somewhat simple infrastructure for monitoring
> the java version of shindig. It assumes there's a monitoring client
> application which can read and parse the variable values and if necessary
> send out any alerts or extract relevant statistics - all variables are
> counters, which at first may sound limiting, but with fancier counters it
> allows gathering information like "how many times a certain gadget URL has
> been fetched", "what's the average time spent in substitutions" (by having a
> counter which stores both the total time sum and a count of increments),
> "how many times have we failed serving a gadget in the last 30 minutes" (by
> having that in time buckets), etc. Any other aggregation is left to
> monitoring clients.
>    I'm attaching the source code for your appreciation - let me know if
> you have any comments. (I think attachment is better than a diff since this
> doesn't touch any existing files - I'm leaving up to the files' owners to
> add their own calls to this code where they think it's more appropriate).
>    There are some TODOs for the future:
>    - a pretty HTML status page for manual examination
>    - some sort of eviction for certain variables, so that for instance we
> don't keep counters for gadget URLs that were used only once - I intend to
> use isEmpty() to determine deletable counters
>    - Implement XML output type (any suggestions for a schema that would be
> more plug-and-play with some popular monitoring system?)
>    - Add tests
>    - PHP version? Not sure if this is possible, perhaps only with SRM or
> memcached?
>
> Btw, I added the servlet as:
>
>   <!--  Monitoring -->
>
>   <servlet>
>     <servlet-name>monitoring</servlet-name>
>     <servlet-class>
>       org.apache.shindig.monitoring.MonitorReportingServlet
>     </servlet-class>
>   </servlet>
>
>   <servlet-mapping>
>     <servlet-name>monitoring</servlet-name>
>     <url-pattern>/monitor</url-pattern>
>   </servlet-mapping>
>
>
> Example usage:
>
>     MonitoringManager monitorManager =
> MonitoringManagerFactory.getInstance();
>     SectionMonitor monitor = monitorManager.getSectionMonitor("processGadget",
> CounterType.HISTORY);
>     monitor.start();
>     try {
>        // Do some stuff
>     } catch(Something e) {
>        monitor.abort();
>        return;
>     }
>     monitor.stop();
>
> Thanks
> Rodrigo
>
>

Reply via email to