Examples

This chapter provides examples of sensor assignment configuration.

Instrumentation Configuration

Description

A sensor of the type Timer sensor is defined on the method msg with the parameter java.lang.String of the class novatec.SubTest.

Timer sensor is added to the method msg with the parameter type int for all classes that match the class expression novatec.Sub* which will hold true for novatec.Sub andnovatec.Sub2 but also for novatec.Sub.some.other.package.SomeClass.

Timer sensor is added to the method msg with a parameter type matching the expression *String of the class novatec.SubTest. So the method msg(java.lang.String) and the method msg(my.own.String) and msg(my.own.SuperString) will be instrumented.

This example shows different usages of wild-card.

This example shows how to instrument classes based on their status that they implement some interface. So this test will instrument all methods of all classes that implement the interface novatec.ITest.

A sensor is defined on methods that start with the character m and have exactly one parameter whose type match the expression *String of all classes that extend a class matching the classpattern nova*.Te*. (quite powerful isn't it :))

A Timer sensor that starts invocation is defined on novatec.SubTest class on msg(int) method. The interesting part here is the minduration definition, which is specified so that all invocations taking less than 10 ms will be discarded.

Instruments all public methods which name starts with 'do' in classes that implement the novatec.ITest interface

Instruments all public methods in classes that have been annotated with novatec.annotation.ClassAnnotation and are in package novatec.*

This sensor instruments all constructors of the class novatec.SubTest

A specific constructor is instrumented here: The method signature has to contain one single parameter of type java.lang.String.

Instruments all constructors in novatec.SubTest class that have been annotated with novatec.annotation.DefaultConstructor