NAME

Bionanny::Report - Reporting (converting) Bionanny monitoring data


SYNOPSIS

  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);


DESCRIPTION

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).


SEE ALSO

http://www.bionanny.org


AUTHOR

Martin Senger (support@bionanny.org)


COPYRIGHT

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.


DISCLAIMER

This software is provided ``as is'' without warranty of any kind.


CONSTANTS

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);

BY_ELAPSED_TIME

The resulting report shows time spent in monitored services.

BY_REQUESTS

The resulting report shows how many requests reached monitored services.


METHODS

The methods described in this documentation represent a public interface to Bionanny reports.

new

  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:

-report => 'graphs'

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:

-data => '<Bionanny>...</Bionanny>'

It expects an XML string containing monitored data. Or:

-file => 'mybionanny.xml'

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):

-top => 5

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).

-snames => ('serviceA', 'serviceB')

It specifies what services (by name) will be included in the report. (TBD: allow here also service simplified name, not only their endpoints).

-by_type => $reporter->BY_ELAPSED_TIME

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).

report

  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).

get_content_type

It returns a content type of the object returned by the report method.