lib/opentelemetry/instrumentation/trilogy/patches/client.rb in opentelemetry-instrumentation-trilogy-0.53.0 vs lib/opentelemetry/instrumentation/trilogy/patches/client.rb in opentelemetry-instrumentation-trilogy-0.54.0
- old
+ new
@@ -82,11 +82,12 @@
attributes
end
def obfuscate_sql(sql)
- if sql.size > 2000
- 'SQL query too large to remove sensitive data ...'
+ if sql.size > config[:obfuscation_limit]
+ truncated_sql = sql[..sql.index(FULL_SQL_REGEXP) - 1]
+ truncated_sql + "...\nSQL truncated (> #{config[:obfuscation_limit]} characters)"
else
obfuscated = OpenTelemetry::Common::Utilities.utf8_encode(sql, binary: true)
obfuscated = obfuscated.gsub(FULL_SQL_REGEXP, '?')
obfuscated = 'Failed to obfuscate SQL query - quote characters remained after obfuscation' if detect_unmatched_pairs(obfuscated)
obfuscated