File tree 1 file changed +11
-2
lines changed
newrelic-agent/src/main/java/com/newrelic/agent/tracers
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -270,7 +270,7 @@ protected void recordMetrics(TransactionStats transactionStats) {
270
270
if (sqlObject != null ) {
271
271
slowQuerySql = new PreparedStatementSql (sql , params ).toString ();
272
272
if (queryExceedsSlowQueryThreshold (appName )) {
273
- slowQuerySql = obfuscateRawSql (slowQuerySql , appName );
273
+ slowQuerySql = getNoRawOrObfuscatedSql (slowQuerySql , appName );
274
274
}
275
275
}
276
276
@@ -304,7 +304,16 @@ protected void recordMetrics(TransactionStats transactionStats) {
304
304
super .recordMetrics (transactionStats );
305
305
}
306
306
307
- private String obfuscateRawSql (String rawSql , String appName ) {
307
+ /**
308
+ * This method is named this way because the docs on toObfuscatedQueryString imply obfuscation certainty.
309
+ * The reality is the SqlQueryConverter implementation of this method has introduced conditional
310
+ * logic that respects the agent configuration setting `record_sql`.
311
+ *
312
+ * If OBFUSCATED, sql is obfuscated.
313
+ * If RAW, sql is returned, unchanged.
314
+ * If OFF, null is returned.
315
+ */
316
+ private String getNoRawOrObfuscatedSql (String rawSql , String appName ) {
308
317
SqlQueryConverter converter = new SqlQueryConverter (appName , getDatabaseVendor ());
309
318
return converter .toObfuscatedQueryString (rawSql );
310
319
}
You can’t perform that action at this time.
0 commit comments