...
Tip | ||
---|---|---|
| ||
Read more about Sensor assignment Assignment with complex class/interface hierarchy to fully understand the assignment through interfaces and super-classes. |
...
Instrumentation | Description |
---|---|
sensor timer novatec.SubTest msg(java.lang.String) | A sensor of the type timer is defined on the method msg with the parameter java.lang.String of the class novatec.SubTest. |
sensor timer novatec.Sub* msg(int) | An timer 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 and novatec.Sub2 but also for novatec.Sub.some.other.package.SomeClass. |
sensor timer novatec.SubTest msg(*String) | An timer 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. |
sensor timer novatec.Sub* m*(java.lang.String,*String) | This example shows different usages of wild-card. |
sensor timer novatec.ITest * interface=true | 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. |
sensor timer nova*.Te* m*(*String) superclass=true | 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 :)) |
sensor isequence novatec.SubTest msg(int) minduration=10.0 | Invocation sensor 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. See the Invocation Sequence documentation on additional options. |
sensor timer novatec.ITest do* interface=true modifiers=pub | Instruments all public methods which name starts with 'do' in classes that implement the novatec.ITest interface |
sensor timer novatec.* * @novatec.annotation.ClassAnnotation modifiers=pub | Instruments all public methods in classes that have been annotated with novatec.annotation.ClassAnnotation and are in package novatec.* |
sensor timer novatec.SubTest <init> | This sensor instruments all constructors of the class novatec.SubTest |
sensor timer novatec.SubTest <init> (java.lang.String) | A specific constructor is instrumented here: The method signature has to contain one single parameter of type java.lang.String. |
sensor timer novatec.SubTest <init> @novatec.annotation.DefaultConstructor | Instruments all constructors in novatec.SubTest class that have been annotated with novatec.annotation.DefaultConstructor |
JMX Sensor Assignment
Anchor | ||||
---|---|---|---|---|
|
(since version 1.6.6)
To monitor a JMX MBean attribute it is necessary to define a JMX sensor-type (see Sensor type definition for more information). After defining this sensor-type, these sensor-types can be assigned with the MBean attributes to be monitored. The general syntax of the definition looks as follows
Code Block |
---|
jmx-sensor [sensor-type-name] mbeanname=[MBean-object-name] attributename=[attribute-name]
|
The configuration defines which attribute of whose MBean should be monitored. In order to select the desired MBean it is specified by its object name that consists of its domain and a key property list (see Oracle - Java Management Extensions (JMX) / Best Practices / ObjectName for more information).
Example
The following table contains examples of how sensors can be assigned to MBean attributes.
jmx-sensor jmx mbeanname=java.lang:type=Threading attributename=ThreadCount | This sensor is assigned to the attribute ThreadCount of the MBean java.lang:type=Threading. |
jmx-sensor jmx mbeanname=java.lang:type=GarbageCollector,name=PS MarkSweep attributename=Valid | This sensor is assigned to the attribute Valid of the MBean java.lang:type=GarbageCollector,name=PS MarkSweep. |