Database sensor

inspectIT already comes with out-of-the-box support for most databases

The inspectIT default configuration already integrates database sensor configurations for most databases. Changes to the database sensor configuration are rarely needed.

Relevant sensor types

For database tracing inspectIT provides four sensor types:

Sensortype

Class

Description

Statement Sensor

info.novatec.inspectit.agent.sensor.method.jdbc.StatementSensor

Assigned to methods of classes that perform un-prepared SQL Statements

Connection Sensor

info.novatec.inspectit.agent.sensor.method.jdbc.ConnectionSensor

Assigned to the methods that create prepared Statements. Without the instrumenting of the Connection the concrete prepared Statements are not found by inspectIT

Prepared Statement Sensor

info.novatec.inspectit.agent.sensor.method.jdbc.PreparedStatementSensor

Assigned to the execute methods of prepared Statements

Prepared Statement Parameter Sensor

info.novatec.inspectit.agent.sensor.method.jdbc.PreparedStatementParameterSensor

Optional sensor that allows to trace the concrete values that a prepared statement had when it was executed. All methods that set the values in the prepared statement classes need to be assigned with this sensor type

Prepared Statement Parameter Replacement

Prepared statements are statements compiled against the database that include placeholders which are later set by the application. The benefit is (among other things) that the execution path of the statement is already available at the database and thus the statement is usually executed faster than unprepared statements. Prepared Statements thus have the format "SELECT * FROM table WHERE id = ?".

For a detailed analysis of slow prepared statements a replacement of the placeholder with the concrete value of the statement the application provided prior to execution is often helpful. Prepared statement parameter replacement provide exactly this feature. Returning to the example statement from above, activating prepared statement replacement would replace the placeholder with the value the application provided and lists the statement (for example) as "SELECT * FROM table WHERE id = 1".

Activating/Deactivating

Prepared statement parameter replacement is provided by the Prepared Statement Parameter Sensor. The default configuration file that inspectIT ships already provides the necessary settings that allow capturing of parameters of prepared statements.

Configuration basics

Using the UI configuration interface no configuration is required at all as method sensor types are activated automatically if a profile defines such sensor assignment. 

Performance impact

The performance impact of activating the prepared statement parameter replacement is medium-high and should not be used for productive monitoring without testing it on an integration platform before. The reason is, that the number of instrumented methods and called methods for each prepared statement invocation is increased by one for each parameter. If the application uses prepared statements having long IN clauses it can easily happen that instead of just one quick call (the query itself) 100 or more calls are necessary to trace the statement.

Other options

String length

from version 1.3

This sensor enables the limitations of the string values collected. The database sensor concretely can limit the maximum size of the SQL strings collected.

Configuration basics

The string length configuration for all sensors is available in the Environment configuration. You can read more about string length limitations on  Environment configuration page.

From version 1.5 the default string length limit for the database sensor is set to 1000 characters.