Skip to content

Commit cae405b

Browse files
committed
better name and documentation
1 parent 4560bd5 commit cae405b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

newrelic-agent/src/main/java/com/newrelic/agent/tracers/DefaultSqlTracer.java

+6-2
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ protected void recordMetrics(TransactionStats transactionStats) {
270270
if (sqlObject != null) {
271271
slowQuerySql = new PreparedStatementSql(sql, params).toString();
272272
if (queryExceedsSlowQueryThreshold(appName)) {
273-
slowQuerySql = obfuscateRawSql(slowQuerySql, appName);
273+
slowQuerySql = getNoRawOrObfuscatedSql(slowQuerySql, appName);
274274
}
275275
}
276276

@@ -304,8 +304,12 @@ protected void recordMetrics(TransactionStats transactionStats) {
304304
super.recordMetrics(transactionStats);
305305
}
306306

307-
private String obfuscateRawSql(String rawSql, String appName) {
307+
private String getNoRawOrObfuscatedSql(String rawSql, String appName) {
308308
SqlQueryConverter converter = new SqlQueryConverter(appName, getDatabaseVendor());
309+
//This method is named this way because the docs on toObfuscatedQueryString imply obfuscation certainty.
310+
//The reality is the SqlQueryConverter implementation of this method has introduced conditional
311+
//logic that respects the agent configuration setting `record_sql`.
312+
//If OBFUSCATED, sql is obfuscated. If RAW, sql is returned, unchanged. If OFF, null is returned.
309313
return converter.toObfuscatedQueryString(rawSql);
310314
}
311315

0 commit comments

Comments
 (0)