Tip | ||
---|---|---|
| ||
The inspectIT default configuration file already integrates database sensor configurations for most databases. Changes to the database sensor configuration are rarely needed. |
...
For database tracing inspectIT provides four sensor types:
Sensortype | Class (only relevant for the Configuration using configuration file(s)) | 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 |
Example sensor type definition (not necessary to change!)
...
Code Block | ||||
---|---|---|---|---|
| ||||
method-sensor-type jdbc-connection info.novatec.inspectit.agent.sensor.method.jdbc.ConnectionSensor MIN method-sensor-type jdbc-prepared-statement info.novatec.inspectit.agent.sensor.method.jdbc.PreparedStatementSensor MIN method-sensor-type jdbc-prepared-statement-parameter info.novatec.inspectit.agent.sensor.method.jdbc.PreparedStatementParameterSensor MIN method-sensor-type jdbc-statement info.novatec.inspectit.agent.sensor.method.jdbc.StatementSensor MIN |
...
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 using configuration file(s)
To enable parameter replacement the sensor assignment of the prepared statement parameter sensor type to the predefined methods must be enabled (simply remove the comments "#" from the lines in the configuration file). To disable parameter replacement, the sensor assignment needs to be removed (or commented). Enabling and disabling is only active after a restart of the application!
Code Block | ||||
---|---|---|---|---|
| ||||
# SQL Prepared Statement Parameter Replacement #sensor jdbc-prepared-statement-parameter java.sql.PreparedStatement setBigDecimal(int,java.math.BigDecimal) interface=true #sensor jdbc-prepared-statement-parameter java.sql.PreparedStatement setBoolean(int,boolean) interface=true #sensor jdbc-prepared-statement-parameter java.sql.PreparedStatement setByte(int,byte) interface=true #sensor jdbc-prepared-statement-parameter java.sql.PreparedStatement setDate(int,java.sql.Date) interface=true #sensor jdbc-prepared-statement-parameter java.sql.PreparedStatement setDouble(int,double) interface=true #sensor jdbc-prepared-statement-parameter java.sql.PreparedStatement setFloat(int,float) interface=true #sensor jdbc-prepared-statement-parameter java.sql.PreparedStatement setInt(int,int) interface=true #sensor jdbc-prepared-statement-parameter java.sql.PreparedStatement setLong(int,long) interface=true #sensor jdbc-prepared-statement-parameter java.sql.PreparedStatement setShort(int,short) interface=true #sensor jdbc-prepared-statement-parameter java.sql.PreparedStatement setString(int,java.lang.String) interface=true #sensor jdbc-prepared-statement-parameter java.sql.PreparedStatement setTime(int,java.sql.Time) interface=true #sensor jdbc-prepared-statement-parameter java.sql.PreparedStatement setTimestamp(int,java.sql.Timestamp) interface=true #sensor jdbc-prepared-statement-parameter java.sql.PreparedStatement setObject(int,java.lang.Object) interface=true #sensor jdbc-prepared-statement-parameter java.sql.PreparedStatement setArray(int,java.sql.Array) interface=true #sensor jdbc-prepared-statement-parameter java.sql.PreparedStatement clearParameters() interface=true |
Configuration using UI configuration interface
Using the UI configuration interface no configuration is required at all as method sensor types are actived 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.
...
String length
from version 1.3
Configuration using configuration file(s)
This sensor enables the limitations of the string values collected. The database sensor concretely can limit the maximum size of the SQL strings collected. The following definition will, for example, limit all the strings collected by the sensor to 500 characters:
...
You can read more about string length limitations on Sensor type definition page.
Configuration using UI configuration interface
The string length configuration for all sensors is available in the Environment configuration.
Info |
---|
From version 1.5 the default string length limit for the database sensor is set to 1000 characters. |