Sensor type definition

What is a sensor type

A sensor type is a component that attaches itself to an instrumentation hook and - based on this data - creates measurements. In other words a sensor type is the unit of work that provides measurements.

Sensor types

inspectIT differentiates between two fundamental sensors: method-based and platform-based. From version 1.3 there is a new special type of sensor, the exception-based sensor.

  • Method-based sensor types are always associated with a concrete method of a class. An example for a method-based sensor is the Timer sensor which records the time a method invocation took.
  • Platform-based sensor types are always associated with the system under diagnosis. An example for a platform-based sensor is the a sensor that measures the CPU of the system.
  • Exception-based sensor is associated with the exceptions in the monitored application. Currently there is only one type of exception-sensor available.

Platform-based sensor types only needs to be defined within the configuration. Method based sensor types needs to be defined and also assigned to the method.

Definition of Sensor Types

The agent configuration file also specifies the available sensor types (read: the type of measurement that can be used). The configuration element for this is sensor-type. There is no limit in how many sensor types can be specified.The general configuration schema is as follows:

General configuration schema for sensor types
method-sensor-type [name] [fqn] [priority] [options]

The following table describes the fields of the method-sensor-type definition

Field

Description

name

the name of this sensor type that can be used within the assignment of concrete methods to this sensor-type

fqn

the fully-qualified class name of the class realizing the sensor

priority

priority is used if more than one hook is instrumented on the same method. The priority defines the order in which sensors are executed which helps time relevant sensor to be processed earlier than others (thus allowing time critical sensors to measure the timings more precisely).
Five priorities are available: MAX, HIGH, NORMAL, LOW and MIN. Sensor types which are set to MAX are very time critical and the hooks are executed first after the original method was called. Bear in mind hooks that do not measure timings do not need high priorities

options

additional configuration for the sensor-type. For example the mode of a timer can be specified here.

Examples

Concrete examples can be found with the respective sensor type. Also note that all default configuration files already define all sensor types.

method-sensor-type average-timer info.novatec.inspectit.agent.sensor.averagetimer.AverageTimerSensor MAX
method-sensor-type average-memory info.novatec.inspectit.agent.sensor.averagememory.AverageMemorySensor HIGH
method-sensor-type timer info.novatec.inspectit.agent.sensor.timer.TimerSensor MAX mode=[aggregate|optimized|raw]
method-sensor-type isequence info.novatec.inspectit.agent.sensor.method.invocationsequence.InvocationSequenceSensor INVOC

Definition of Exception Sensor

from version 1.3

An exception-sensor-type has to be specified explicitly from the version 1.3. Furthermore, only one exception-sensor-type is available and allowed to be specified. Thus, the exception-sensor-type definition does not include the name of the sensor:

General configuration schema for exception sensor type
exception-sensor-type [fqn] [options]
Exception sensor type definition example
exception-sensor-type info.novatec.inspectit.agent.sensor.exception.ExceptionSensor mode=simple

More information about exception sensor can be read here.

Controlling String Length

from version 1.3

All the method-sensor-types and the exception-sensor-type allow specification of the stringLength option in their definition. With this option a user can specify maximum length of Strings values collected by these sensors. What the String values are depend on the concrete sensor used. For example, database related sensors will decrease the size of the SQL statement strings if the length is higher than the specified one. On the other hand, the exception sensor will, for example, decrease the size of the exception stack trace and/or message.

This can be valuable in different situations. The application that has too many created exceptions, can try to send large amount of data to the CMR, because the stack traces of the exception can be long. This can create a very high overhead, that can influence the general performance of the monitored application. inspectIT team already had an opportunity to face the problems where 20,000+ exceptions are created in several seconds, making the RMI transfer of the data impossible.

Usage
method-sensor-type average-timer info.novatec.inspectit.agent.sensor.averagetimer.AverageTimerSensor MAX stringLength=100
exception-sensor-type info.novatec.inspectit.agent.sensor.exception.ExceptionSensor stringLength=500
...

Note that this option does not to be specified, and in that case strings will be reported in original length.

Definition of JMX Sensor

from version 1.6.6

The configuration of a JMX sensor is based on the general configuration schema for sensor types.

jmx-sensor-type [name] [fqn]

The following table describes the fields of the jmx-sensor-type definition

Field

Description

name

the name of this sensor type that can be used within the assignment of concrete MBeans to this sensor-type

fqn

the fully-qualified class name of the class realizing the sensor

See Sensor assignment - JMX Sensor Assignment for more information about assigning a JMX sensor.

Example

jmx-sensor-type jmx info.novatec.inspectit.agent.sensor.jmx.JmxSensor