Skip to content

Commit

Permalink
better name and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
XiXiaPdx committed Nov 17, 2021
1 parent 4560bd5 commit e284e3d
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ protected void recordMetrics(TransactionStats transactionStats) {
if (sqlObject != null) {
slowQuerySql = new PreparedStatementSql(sql, params).toString();
if (queryExceedsSlowQueryThreshold(appName)) {
slowQuerySql = obfuscateRawSql(slowQuerySql, appName);
slowQuerySql = getNoRawOrObfuscatedSql(slowQuerySql, appName);
}
}

Expand Down Expand Up @@ -304,7 +304,16 @@ protected void recordMetrics(TransactionStats transactionStats) {
super.recordMetrics(transactionStats);
}

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

0 comments on commit e284e3d

Please sign in to comment.