Listing 4. Example Code for Invoking
Gauger from Python
from gauger import GAUGER
GAUGER("CAT", "NAME", 42, "kb/s")
x-axis. The --id ID option is used to
supply the revision number in this case.
Some projects may want to use an
internal version number or a timestamp
instead of a revision number generated
by their VCS. The only restriction
imposed on the numbers used is that
Gauger’s regression monitoring
assumes a linear progression of development. For projects with multiple
branches under active development,
different Gauger servers should be set
up for each branch.
Language Bindings
Gauger ships with bindings for various
languages (see, for example, Listings
2, 3, 4 and 5) to make integration
easy. The resulting binaries do not
depend on a Gauger client installation
on the target system. The bindings
should be integrated with the main
project and, as mentioned before,
simply do nothing when invoked if
the Gauger client is not installed or
not configured properly.
The JavaScript binding is unusual.
Because JavaScript cannot access the
local filesystem to read the configura-
Listing 5. The browser must be registered with the Gauger Web site before
Gauger can be invoked from JavaScript.
Once the login cookie is set, the main
difference from other languages is that
the JavaScript code must supply its
revision number explicitly.
[...] <script type="text/javascript" src=" http://www.example.com/gauger.js"> </script> [...] var rev = $Revision$; /* or */ var rev = <?php echo get_revision() ?>; var performance = do_test(); GAUGER ('CAT', 'NAME', performance, 'kb/s', rev)" /> [...]
tion file, the login data must be
stored in a cookie in advance. The
login page on the Gauger Web site,
which usually is used to set up new
accounts for execution hosts, can be
used to set the respective login cookie
in the browser. Access to the source
code’s repository also is not possible
from JavaScript, so the revision number
must be supplied explicitly to the GAUGER call. Typically, the current
revision number is obtained on the
server side. For example, PHP code
can be used to obtain the number
from the VCS, or on-commit trigger
WWW.LINUXJOURNAL.COM SEPTEMBER 2011 | 73