diff --git a/rdb/config/config-informix.yaml b/rdb/config/config-informix.yaml index 760c282..5cb6d65 100644 --- a/rdb/config/config-informix.yaml +++ b/rdb/config/config-informix.yaml @@ -33,7 +33,7 @@ instances: #Time Frame for which you want to get the expensive query. Default value 900 Sec db.sql.elapsed.timeframe: 900 # Values should be in Seconds db.sequential.scan.count: 0 - + db.sql.trace.enabled: false #Default is false. Make it true only if `SqlTrace` is enabled for the DB. ### Uncomment the below section in case you are using Vault to retrieve the password. #vault: # connection_url: #Vault Address URL diff --git a/rdb/src/main/java/com/instana/dc/rdb/impl/Constants.java b/rdb/src/main/java/com/instana/dc/rdb/impl/Constants.java index 061909b..d5b9446 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/impl/Constants.java +++ b/rdb/src/main/java/com/instana/dc/rdb/impl/Constants.java @@ -31,7 +31,7 @@ public class Constants { public static final String CACHE_WRITE_RATIO_SCRIPT = "cache_write_ratio.sh"; public static final String LOCK_WAITS_SCRIPT = "lock_waits.sh"; public static final String LRU_WRITES_SCRIPT = "lru_writes.sh"; - + public static final String DB_SQL_TRACE_ENABLED = "db.sql.trace.enabled"; private Constants() { //Private constructor } diff --git a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java index 5c2199a..176d763 100644 --- a/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java +++ b/rdb/src/main/java/com/instana/dc/rdb/impl/informix/InformixDc.java @@ -46,6 +46,7 @@ import static com.instana.dc.rdb.impl.Constants.CACHE_WRITE_RATIO_SCRIPT; import static com.instana.dc.rdb.impl.Constants.LOCK_WAITS_SCRIPT; import static com.instana.dc.rdb.impl.Constants.LRU_WRITES_SCRIPT; +import static com.instana.dc.rdb.impl.Constants.DB_SQL_TRACE_ENABLED; import static com.instana.dc.rdb.impl.informix.InformixUtil.DB_HOST_AND_VERSION_SQL; @@ -65,6 +66,8 @@ public class InformixDc extends AbstractDbDc { private final MetricsCollector metricCollector; + private Boolean sqlTraceEnabled; + public InformixDc(Map properties, String dbSystem, String dbDriver) throws SQLException { super(properties, dbSystem, dbDriver); parseCustomAttributes(properties); @@ -230,6 +233,7 @@ private void scheduleCustomPollRate(int pollInterval, IntervalType intervalType) @SuppressWarnings("unchecked") private void parseCustomAttributes(Map properties) { Map customInput = (Map) properties.get("custom.input"); + sqlTraceEnabled = (Boolean)customInput.getOrDefault(DB_SQL_TRACE_ENABLED, false); int sequentialScanCount = (Integer)customInput.getOrDefault("db.sequential.scan.count", 0); long elapsedTimeFrame = Long.parseLong((customInput.getOrDefault("db.sql.elapsed.timeframe", DEFAULT_ELAPSED_TIME)).toString()); StringBuilder databaseName = new StringBuilder(Constants.SINGLE_QUOTES + getDbName() + Constants.SINGLE_QUOTES); @@ -289,11 +293,13 @@ private void getallMetrics() { @SuppressWarnings("unchecked") private void mediumPollingInterval() { - getRawMetric(DB_SQL_COUNT_NAME).setValue((Number) metricCollector.collectMetrics(DB_SQL_COUNT_NAME)); + if(sqlTraceEnabled) { + getRawMetric(DB_SQL_COUNT_NAME).setValue((Number) metricCollector.collectMetrics(DB_SQL_COUNT_NAME)); + getRawMetric(DB_SQL_ELAPSED_TIME_NAME).setValue((List) metricCollector.collectMetrics(DB_SQL_ELAPSED_TIME_NAME)); + } getRawMetric(DB_SQL_RATE_NAME).setValue((Number) metricCollector.collectMetrics(DB_SQL_RATE_NAME)); getRawMetric(DB_TRANSACTION_COUNT_NAME).setValue((Number) metricCollector.collectMetrics(DB_TRANSACTION_COUNT_NAME)); getRawMetric(DB_TRANSACTION_RATE_NAME).setValue((Number) metricCollector.collectMetrics(DB_TRANSACTION_COUNT_NAME)); - getRawMetric(DB_SQL_ELAPSED_TIME_NAME).setValue((List) metricCollector.collectMetrics(DB_SQL_ELAPSED_TIME_NAME)); } private void shortPollingInterval() {