<html lang="en"> <head> <title>Metric Events - BuildBot Manual - 0.8.4p1</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="BuildBot Manual - 0.8.4p1"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Metrics.html#Metrics" title="Metrics"> <link rel="next" href="Metric-Handlers.html#Metric-Handlers" title="Metric Handlers"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This is the BuildBot manual for Buildbot version 0.8.4p1. Copyright (C) 2005, 2006, 2009, 2010 Brian Warner Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.--> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Metric-Events"></a> <p> Next: <a rel="next" accesskey="n" href="Metric-Handlers.html#Metric-Handlers">Metric Handlers</a>, Up: <a rel="up" accesskey="u" href="Metrics.html#Metrics">Metrics</a> <hr> </div> <h4 class="subsection">8.12.1 Metric Events</h4> <p><code>MetricEvent</code> objects represent individual items to monitor. There are three sub-classes implemented: <dl> <dt><code>MetricCountEvent</code><dd>Records incremental increase or decrease of some value, or an absolute measure of some value. <pre class="example"> from buildbot.process.metrics import MetricCountEvent # We got a new widget! MetricCountEvent.log('num_widgets', 1) # We have exactly 10 widgets MetricCountEvent.log('num_widgets', 10, absolute=True) </pre> <br><dt><code>MetricTimeEvent</code><dd>Measures how long things take. By default the average of the last 10 times will be reported. <pre class="example"> from buildbot.process.metrics import MetricTimeEvent # function took 0.001s MetricTimeEvent.log('time_function', 0.001) </pre> <br><dt><code>MetricAlarmEvent</code><dd>Indicates the health of various metrics. <pre class="example"> from buildbot.process.metrics import MetricAlarmEvent, ALARM_OK # num_slaves looks ok MetricAlarmEvent.log('num_slaves', level=ALARM_OK) </pre> </dl> </body></html>