lib/opentelemetry/instrumentation/pg/patches/connection.rb in opentelemetry-instrumentation-pg-0.21.0 vs lib/opentelemetry/instrumentation/pg/patches/connection.rb in opentelemetry-instrumentation-pg-0.22.0
- old
+ new
@@ -64,11 +64,11 @@
# Rubocop is complaining about 19.31/18 for Metrics/AbcSize.
# But, getting that metric in line would force us over the
# module size limit! We can't win here unless we want to start
# abstracting things into a million pieces.
- def span_attrs(kind, *args) # rubocop:disable Metrics/AbcSize
+ def span_attrs(kind, *args)
if kind == :query
operation = extract_operation(args[0])
sql = obfuscate_sql(args[0]).to_s
else
statement_name = args[0]
@@ -83,9 +83,10 @@
end
end
attrs = { 'db.operation' => validated_operation(operation), 'db.postgresql.prepared_statement_name' => statement_name }
attrs['db.statement'] = sql unless config[:db_statement] == :omit
+ attrs.merge!(OpenTelemetry::Instrumentation::PG.attributes)
attrs.reject! { |_, v| v.nil? }
[span_name(operation), client_attributes.merge(attrs)]
end