lib/opentelemetry/instrumentation/pg/patches/connection.rb in opentelemetry-instrumentation-pg-0.18.1 vs lib/opentelemetry/instrumentation/pg/patches/connection.rb in opentelemetry-instrumentation-pg-0.19.0
- old
+ new
@@ -82,11 +82,11 @@
operation = 'EXECUTE'
end
end
attrs = { 'db.operation' => validated_operation(operation), 'db.postgresql.prepared_statement_name' => statement_name }
- attrs['db.statement'] = sql if config[:enable_statement_attribute]
+ attrs['db.statement'] = sql unless config[:db_statement] == :omit
attrs.reject! { |_, v| v.nil? }
[span_name(operation), client_attributes.merge(attrs)]
end
@@ -102,10 +102,10 @@
def validated_operation(operation)
operation if PG::Constants::SQL_COMMANDS.include?(operation)
end
def obfuscate_sql(sql)
- return sql unless config[:enable_sql_obfuscation]
+ return sql unless config[:db_statement] == :obfuscate
# Borrowed from opentelemetry-instrumentation-mysql2
return 'SQL query too large to remove sensitive data ...' if sql.size > 2000
# From: