nbw-bt/Umsetzung/Perl/Kieker.tex

281 lines
12 KiB
TeX
Raw Normal View History

\section{Kieker\label{Kieker}\index{Kieker}}
Wraps Kieker Monitoring functions
\subsection*{SYNOPSIS\label{Kieker_SYNOPSIS}\index{Kieker!SYNOPSIS}}
\begin{verbatim}
use Kieker;
my $kieker = Kieker->new(); # Creates a new monitoring instance
\end{verbatim}
\begin{verbatim}
$kieker->EntryEvent('Foo','Bar'); # Produces a new EntryEvent
\end{verbatim}
\begin{verbatim}
$kieker->ExitEvent('Foo','Bar'); # Produces a new ExitEvent
\end{verbatim}
\subsection*{DESCRIPTION\label{Kieker_DESCRIPTION}\index{Kieker!DESCRIPTION}}
This module encapsulates the Kieker monitoring functions in one module. Upon
creation the controlling and writing parts are loaded and the singleton
instances are stored.
After that Events can be constructed and written to the active writer.
\subsection*{METHODS\label{Kieker_METHODS}\index{Kieker!METHODS}}
\subsubsection*{\$object = Kieker-$>$new()\label{Kieker__object_Kieker-_new_}\index{Kieker!\$object = Kieker-$>$new()}}
Creates a new Kieker object. Currently takes no parameters for configuration.
Returns the object.
\subsubsection*{\$object-$>$EntryEvent(\$functionName, \$packageName);\label{Kieker__object-_EntryEvent_functionName_packageName_}\index{Kieker!\$object-$>$EntryEvent(\$functionName, \$packageName);}}
Creates and sends out a EntryEvent for a specified functionName in a specified
package. Uses the current timestamp. Returns nothing.
\subsubsection*{\$object-$>$ExitEvent(\$functionName, \$packageName);\label{Kieker__object-_ExitEvent_functionName_packageName_}\index{Kieker!\$object-$>$ExitEvent(\$functionName, \$packageName);}}
Creates and sends out a ExitEvent for a specified functionName in a specified
package. Uses the current timestamp. Returns nothing.
\section{Kieker::Controlling\label{Kieker::Controlling}\index{Kieker::Controlling}}
Provides Controlling mechanisms to Kieker Modules
\subsection*{SYNOPSIS\label{Kieker::Controlling_SYNOPSIS}\index{Kieker::Controlling!SYNOPSIS}}
\begin{verbatim}
use Kieker::Controlling;
my $control = Kieker::Controlling->instance(); # Get controlling instance
\end{verbatim}
\begin{verbatim}
my $trace = $control->getTrace(); # Get current traceID
\end{verbatim}
\begin{verbatim}
my $orderId = $control->getOrderIndex($trace); # Get current orderIndex
\end{verbatim}
\subsection*{DESCRIPTION\label{Kieker::Controlling_DESCRIPTION}\index{Kieker::Controlling!DESCRIPTION}}
This module provides controlling methods for Kieker. The main functions are
providing consistent trace and orderIDs. When new traces are created the
corresponding traceEvents are created and written.
\subsection*{METHODS\label{Kieker::Controlling_METHODS}\index{Kieker::Controlling!METHODS}}
\subsubsection*{\$control = Kieker::Controlling-$>$instance();\label{Kieker::Controlling__control_Kieker::Controlling-_instance_}\index{Kieker::Controlling!\$control = Kieker::Controlling-$>$instance();}}
Returns the singleton instance of Kieker::Controlling. If no instance is defined
a new instance is created.
\subsubsection*{my \$orderId = \$control-$>$getOrderIndex(\$trace);\label{Kieker::Controlling_my_orderId_control-_getOrderIndex_trace_}\index{Kieker::Controlling!my \$orderId = \$control-$>$getOrderIndex(\$trace);}}
Returns the current orderIndex and increments the count. If this is the first
request a new traceEvent is created and written to the log.
\subsubsection*{my \$trace = \$control-$>$getTrace();\label{Kieker::Controlling_my_trace_control-_getTrace_}\index{Kieker::Controlling!my \$trace = \$control-$>$getTrace();}}
Returns the current traceID. In this version it uses the threadID and relies on
special Apache configuration.
\section{Kieker::Util\label{Kieker::Util}\index{Kieker::Util}}
Kieker utility functions
\subsection*{SYNOPSIS\label{Kieker::Util_SYNOPSIS}\index{Kieker::Util!SYNOPSIS}}
\begin{verbatim}
use Kieker::Util;
my $time = Kieker::Util->time(); # Get current time in (pseudo)-nanoseconds
\end{verbatim}
\subsection*{DESCRIPTION\label{Kieker::Util_DESCRIPTION}\index{Kieker::Util!DESCRIPTION}}
This module provides utility functions for other Kieker modules.
\subsection*{METHODS\label{Kieker::Util_METHODS}\index{Kieker::Util!METHODS}}
\subsubsection*{\$time = Kieker::Util-$>$time();\label{Kieker::Util__time_Kieker::Util-_time_}\index{Kieker::Util!\$time = Kieker::Util-$>$time();}}
Returns current time in pseudo nanoseconds. Perl doesn't provide a real
nanosecond timer but only microseconds. Output is formatted to match kieker
time format.
NO REAL NANOSECONDS, MICROSECOND PRECISION.
\section{Kieker::Record::OperationEntryEvent\label{Kieker::Record::OperationEntryEvent}\index{Kieker::Record::OperationEntryEvent}}
Kieker Event to be produced at the start
of a function call.
\subsection*{SYNOPSIS\label{Kieker::Record::OperationEntryEvent_SYNOPSIS}\index{Kieker::Record::OperationEntryEvent!SYNOPSIS}}
\begin{verbatim}
my $record = Kieker::Record::OperationEntryEvent->new(
Kieker::Util->time(),
$control->getTrace(),
$control->getOrderIndex($control->getTrace()),
$functionName,$packageName);
$writer->write($record->genoutput());
\end{verbatim}
\subsection*{DESCRIPTION\label{Kieker::Record::OperationEntryEvent_DESCRIPTION}\index{Kieker::Record::OperationEntryEvent!DESCRIPTION}}
Generates a OperationEntryEvent. This Event should be generated at the start of
each monitored function.
\subsection*{METHODS\label{Kieker::Record::OperationEntryEvent_METHODS}\index{Kieker::Record::OperationEntryEvent!METHODS}}
\subsubsection*{\$record = Kieker::Record::OperationEntryEvent-$>$new(tstamp, trace, orderIndex, function, package);\label{Kieker::Record::OperationEntryEvent__record_Kieker::Record::OperationEntryEvent-_new_tstamp_trace_orderIndex_function_package_}\index{Kieker::Record::OperationEntryEvent!\$record = Kieker::Record::OperationEntryEvent-$>$new(tstamp, trace, orderIndex, function, package);}}
Creates a new Record. It needs a timestamp, a trace with its corresponding
orderIndex, a function name and a package name.
\subsubsection*{\$string = \$record-$>$genoutput();\label{Kieker::Record::OperationEntryEvent__string_record-_genoutput_}\index{Kieker::Record::OperationEntryEvent!\$string = \$record-$>$genoutput();}}
Serializes the record for output. Returns the serialized form of the record.
Uses the identifier "1" for the event type.
\section{Kieker::Record::OperationExitEvent\label{Kieker::Record::OperationExitEvent}\index{Kieker::Record::OperationExitEvent}}
Kieker Event to be produced at the end
of a function call.
\subsection*{SYNOPSIS\label{Kieker::Record::OperationExitEvent_SYNOPSIS}\index{Kieker::Record::OperationExitEvent!SYNOPSIS}}
\begin{verbatim}
my $record = Kieker::Record::OperationExitEvent->new(
Kieker::Util->time(),
$control->getTrace(),
$control->getOrderIndex($control->getTrace()),
$functionName,$packageName);
$writer->write($record->genoutput());
\end{verbatim}
\subsection*{DESCRIPTION\label{Kieker::Record::OperationExitEvent_DESCRIPTION}\index{Kieker::Record::OperationExitEvent!DESCRIPTION}}
Generates a OperationExitEvent. This Event should be generated at the end of
each monitored function.
\subsection*{METHODS\label{Kieker::Record::OperationExitEvent_METHODS}\index{Kieker::Record::OperationExitEvent!METHODS}}
\subsubsection*{\$record = Kieker::Record::OperationExitEvent-$>$new(tstamp, trace, orderIndex, function, package);\label{Kieker::Record::OperationExitEvent__record_Kieker::Record::OperationExitEvent-_new_tstamp_trace_orderIndex_function_package_}\index{Kieker::Record::OperationExitEvent!\$record = Kieker::Record::OperationExitEvent-$>$new(tstamp, trace, orderIndex, function, package);}}
Creates a new Record. It needs a timestamp, a trace with its corresponding
orderIndex, a function name and a package name.
\subsubsection*{\$string = \$record-$>$genoutput();\label{Kieker::Record::OperationExitEvent__string_record-_genoutput_}\index{Kieker::Record::OperationExitEvent!\$string = \$record-$>$genoutput();}}
Serializes the record for output. Returns the serialized form of the record.
Uses the identifier "2" for the event type.
\section{Kieker::Record::Trace\label{Kieker::Record::Trace}\index{Kieker::Record::Trace}}
Kieker Event indicating one trace. Gets autocreated by
Kieker::Controlling.
\subsection*{SYNOPSIS\label{Kieker::Record::Trace_SYNOPSIS}\index{Kieker::Record::Trace!SYNOPSIS}}
\begin{verbatim}
my $record = Kieker::Record::Trace->new($traceID);
\end{verbatim}
\begin{verbatim}
$writer->write($record->genoutput());
\end{verbatim}
\subsection*{DESCRIPTION\label{Kieker::Record::Trace_DESCRIPTION}\index{Kieker::Record::Trace!DESCRIPTION}}
Generates a Trace. This Event is autocreated by Kieker::Controlling when a new
trace is started.
\subsection*{METHODS\label{Kieker::Record::Trace_METHODS}\index{Kieker::Record::Trace!METHODS}}
\subsubsection*{\$record = Kieker::Record::Trace-$>$new(\$traceID);\label{Kieker::Record::Trace__record_Kieker::Record::Trace-_new_traceID_}\index{Kieker::Record::Trace!\$record = Kieker::Record::Trace-$>$new(\$traceID);}}
Creates a new trace with the given trace ID.
\subsubsection*{\$string = \$record-$>$genoutput();\label{Kieker::Record::Trace__string_record-_genoutput_}\index{Kieker::Record::Trace!\$string = \$record-$>$genoutput();}}
Serializes the record for output. Returns the serialized form of the record.
Uses the identifier "3" for the event type.
\section{Kieker::Writer::FileWriter\label{Kieker::Writer::FileWriter}\index{Kieker::Writer::FileWriter}}
Provides a Kieker Writer for file output.
\subsection*{SYNOPSIS\label{Kieker::Writer::FileWriter_SYNOPSIS}\index{Kieker::Writer::FileWriter!SYNOPSIS}}
\begin{verbatim}
use Kieker::Writer::FileWriter;
my $writer = Kieker::Writer::FileWriter->instance();
# Get writer instance
\end{verbatim}
\begin{verbatim}
$writer->write($string); # writes string to the current file
\end{verbatim}
\subsection*{DESCRIPTION\label{Kieker::Writer::FileWriter_DESCRIPTION}\index{Kieker::Writer::FileWriter!DESCRIPTION}}
Writes Kieker records to a Logfile. Can also be used to write other strings to
log files.
\subsection*{METHODS\label{Kieker::Writer::FileWriter_METHODS}\index{Kieker::Writer::FileWriter!METHODS}}
\subsubsection*{\$writer = Kieker::Writer::FileWriter-$>$instance();\label{Kieker::Writer::FileWriter__writer_Kieker::Writer::FileWriter-_instance_}\index{Kieker::Writer::FileWriter!\$writer = Kieker::Writer::FileWriter-$>$instance();}}
Returns the writer singleton instance. Thsi object holds the filehandle
currently wrinting to. If no instance exists, it is created and a new logfile
is created using the current time for the filename.
\subsubsection*{\$writer-$>$write(STRING);\label{Kieker::Writer::FileWriter__writer-_write_STRING_}\index{Kieker::Writer::FileWriter!\$writer-$>$write(STRING);}}
Writes STRING to the filehandle.
\section{Kieker::Writer::JMSWriter\label{Kieker::Writer::JMSWriter}\index{Kieker::Writer::JMSWriter}}
Provides a Kieker Writer for JMS output.
\subsection*{SYNOPSIS\label{Kieker::Writer::JMSWriter_SYNOPSIS}\index{Kieker::Writer::JMSWriter!SYNOPSIS}}
\begin{verbatim}
use Kieker::Writer::JMSWriter;
my $writer = Kieker::Writer::JMSWriter->instance();
# Get writer instance
\end{verbatim}
\begin{verbatim}
$writer->write($string); # writes string to JMS
\end{verbatim}
\subsection*{DESCRIPTION\label{Kieker::Writer::JMSWriter_DESCRIPTION}\index{Kieker::Writer::JMSWriter!DESCRIPTION}}
Writes Kieker records to a JMS provider. Can also be used to write other
strings.
\subsection*{REQUIREMENTS\label{Kieker::Writer::JMSWriter_REQUIREMENTS}\index{Kieker::Writer::JMSWriter!REQUIREMENTS}}
Uses Net::Stomp for the JMS connection.
\subsection*{METHODS\label{Kieker::Writer::JMSWriter_METHODS}\index{Kieker::Writer::JMSWriter!METHODS}}
\subsubsection*{\$writer = Kieker::Writer::JMSWriter-$>$instance();\label{Kieker::Writer::JMSWriter__writer_Kieker::Writer::JMSWriter-_instance_}\index{Kieker::Writer::JMSWriter!\$writer = Kieker::Writer::JMSWriter-$>$instance();}}
Returns the writer singleton instance. Thsi object holds the handle currently
wrinting to. If no instance exists, it is created and a connection to the JMS
provider is opened. Currently no configuration options are provided and the
location of the provider is static in the source. (localhost:61613)
\subsubsection*{\$writer-$>$write(STRING);\label{Kieker::Writer::JMSWriter__writer-_write_STRING_}\index{Kieker::Writer::JMSWriter!\$writer-$>$write(STRING);}}
Writes STRING to JMS.