Skip to content

Commit

Permalink
refactor query parameter use
Browse files Browse the repository at this point in the history
  • Loading branch information
XiXiaPdx committed Dec 1, 2021
1 parent a1c4201 commit e620325
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public <T> void noticeTracer(Tracer tracer, SlowQueryDatastoreParameters<T> slow
// This allows transaction traces to show slow queries directly in the trace details
//todo: obfuscatedQueryString isn't correct, it could be Raw or Obfuscated. The queryConverter
// has conditional obfuscation, respecting recrod_sql setting.
tracer.setAgentAttribute(SqlTracer.SQL_OBFUSCATED_PARAMETER_NAME, obfuscatedQueryString);
tracer.setAgentAttribute(SqlTracer.SQL_OBFUSCATED_PARAMETER_NAME, query);

DatastoreConfig datastoreConfig = ServiceFactory.getConfigService().getDefaultAgentConfig().getDatastoreConfig();
boolean allUnknown = slowQueryDatastoreParameters.getHost() == null
Expand All @@ -77,16 +77,16 @@ public <T> void noticeTracer(Tracer tracer, SlowQueryDatastoreParameters<T> slow
slowQueryInfoCache = new BoundedConcurrentCache<>(MAX_SQL_TRACERS);
}

SlowQueryInfo existingInfo = slowQueryInfoCache.get(obfuscatedQueryString);
SlowQueryInfo existingInfo = slowQueryInfoCache.get(query);
if (existingInfo != null) {
// Aggregate tracers by SQL.
existingInfo.aggregate(tracer);
slowQueryInfoCache.putReplace(obfuscatedQueryString, existingInfo);
slowQueryInfoCache.putReplace(query, existingInfo);
} else {
SlowQueryInfo sqlInfo = new SlowQueryInfo(null, tracer, queryString, obfuscatedQueryString,
SlowQueryInfo sqlInfo = new SlowQueryInfo(null, tracer, query, query,
tracer.getTransactionActivity().getTransaction().getAgentConfig().getSqlTraceConfig());
sqlInfo.aggregate(tracer);
slowQueryInfoCache.putIfAbsent(obfuscatedQueryString, sqlInfo);
slowQueryInfoCache.putIfAbsent(query, sqlInfo);
}
}
}
Expand Down

0 comments on commit e620325

Please sign in to comment.