Bionanny::Report - Reporting (converting) Bionanny monitoring data
use Bionanny::Listener; use Bionanny::Report; my $xmldata = new Bionnany::Listener->get (...);
# convert monitoring data into Bionanny::Data objects my $bionanny = new Bionnany::Report->report (-data => $xmldata);
# OR make a graph from Bionany data
my $reporter = new Bionnany::Report->report (-report => 'graphs',
-data => $xmldata);
my $graph = $reporter->report (...graph attributes...);
my $type = $reporter->get_content_type;
# OR convert them into HTML pages (TBD)
my $html = new Bionnany::Report->report (-report => 'html',
-data => $xmldata);
This is a class whose instances can convert XML data returned from a
Bionanny service to something else. What format it converts to, it
depends on the real implementation module. What module is loaded, it
depends on the parameter given to the new method. For example:
-report => 'graphs'
loads class the Bionanny::Report::graphs manpage that is able to produce graphs (assuming that you have other necessary Perl installed, such as GD and GD::Graph).
Martin Senger (support@bionanny.org)
This file is a component of the Bionanny project. Copyright Michael Niemi & Martin Senger. For details contact support@bionanny.org, or see http://www.bionanny.org/.
Parts were re-factored from modules available in Bioperl project. See copyright notices there.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This software is provided ``as is'' without warranty of any kind.
There are several predefined constants specifying selection of data
for a report. Use them in the arguments for the report method). For
example:
$reporter->report (-by_type->$reporter->BY_ELAPSED_TIME);
The resulting report shows time spent in monitored services.
The resulting report shows how many requests reached monitored services.
The methods described in this documentation represent a public interface to Bionanny reports.
my $reporter = new Bionanny::Report (@args);
It builds, populates and returns a new Bionanny::Report
object. This is how it is seen from the outside. But in fact, it
builds, populates and returns a more specific lower-level reporting
object, for example Bionanny::Report::graphs object. Which one, it
depends on the parameter -report:
It indicates what lower-level (reporting) module to load. Default is
data. Other values (this list may not be full because people can
write their own reporting modules) are: graphs. Other soon expected
are html and xslt.
Input data that will be reported (meaning: converting into a different
format - a report) are given in XML, in the same format as returned by
the get method of the Bionanny::Listener manpage, in the parameter -data:
It expects an XML string containing monitored data. Or:
It expects a filename containing monitored data in XML.
Other recognized names in arguments @args are (be aware, however,
that some of them may not be granted/used by the lower-level module):
How many top services to include in the report (which service is in top depends either on number of request or on the elapsed time).
It specifies what services (by name) will be included in the report. (TBD: allow here also service simplified name, not only their endpoints).
A constant defining how is the report arranged: either by elapsed time or by number of requests.
Other arguments can be given here but they are recognized and interpreted by the lower-level (reporting) module. See their own documentation (e.g. Bionanny::Report::graphs).
my $reporter = new Bionanny::Report (-report => 'graphs',
-data => $xmldata);
my $obj = $reporter->report (-top => 5);
It returns an object on success, or undef on failure. The type of
returned object is very polymorphic (in other words it can be
anything). Use method get_content_type to find what is returned.
Some lower-level modules recognize here almost (except -report) the
same set of arguments as method new. But not all modules do that
(TBD: this should be fixed).
It returns a content type of the object returned by the report
method.