What is sensor assignment
Sensor assignment specifies the process of mapping/assigning an already existing sensor type to a concrete method of a certain class. The sensor type itself is the definition of what needs to be measured. Sensor assignment thus defines what should be monitored.
The currently existing sensor types in inspectIT are:
- Timer sensor
- HTTP sensor
- Exception sensor
- JDBC Connection sensor
- JDBC Statement sensor
- JDBC Prepared Statement sensor
- JDBC JDBC Prepared Parameter sensor
- Logging sensor for log4j
- Invocation sequence Sequence sensor (although this senor sensor type exists it can not be assigned directly, please check the Advanced sensor options below for more information)
Configuration
Sensor assignment configuration is done on done in the Sensor Definitions page of the profileAssignment profile type. The sensor definition page offers the Add, Remove and Duplicate sensor assignment options. When adding new sensor assignment to the profile, first step is to select sensor type you want to use in the given assignment:
...
In addition exact parameters of the method can be specified, which can be helpful in filtering when the class has many method with the same name. If parameters are left out then all methods with the given name will be instrumented, regardless on number/type of parameters. Note that parameter oder order is taken into account.
The following example show a instrumentation configuration for the constructor of the class novatec.SubTest that has boolean and java.lang.String as parameters:
...
Annotation based instrumentation can be combined with all other instrumentation options. If the annotation option is used the Options column of the sensor assignment table will display this icon: .
Info | ||
---|---|---|
| ||
The annotation class that is used in the instrumentation does not need to be on the class-path in order for instrumentation to work. |
Sensor specific options
Examples
This chapter provides examples of how instrumentation can be done.
...
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.
...
...
A 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.
...
...
A 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.
...
...
Starts invocation
Applies to Timer sensor
As already mentioned the Invocation Sequence sensor can not be applied directly to sensor assignment. Instead of this you can mark any Timer sensor assignment to start the invocation as well as capturing the timing information. This is done by activating the Starts invocation option in the assignment sensor specific options. It's possible to optionally also set the minimum duration property. This property defines the minimum time an invocation has to consume in order to be saved and transmitted to the server. This helps in reducing the data load from the Agent to the CMR and is a good filter for not so important invocations.
If the starts invocation is active the Options column of the sensor assignment table will display this icon: .
Charting
Applies to Timer and HTTP sensor
With the charting option it is possible to define what data should be considered as the long-term data available for charting in inspectIT User interface. This data is additionally saved to the database, thus even when the CMR is shutdown or buffer is cleared the data will be available via charts. With this approach it is possible to define exactly what methods performance data should be considered as long-term.
The configuration of the charting option is defined in the sensor assignment for Timer and HTTP sensor:
If the charting option is active the Options column of the sensor assignment table will display this icon: .
Context capturing
Applies to Timer sensor
Please visit the Context capturing in sensor assignment for more information on context capturing option.
Examples
Don't forget to check the Examples page for concrete examples on sensor assignment configuration.