lib/opentelemetry/instrumentation/trilogy/patches/client.rb in opentelemetry-instrumentation-trilogy-0.56.1 vs lib/opentelemetry/instrumentation/trilogy/patches/client.rb in opentelemetry-instrumentation-trilogy-0.56.2
- old
+ new
@@ -65,10 +65,11 @@
::OpenTelemetry::SemanticConventions::Trace::DB_SYSTEM => 'mysql',
::OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME => connection_options.fetch(:host, 'unknown sock')
}
attributes[::OpenTelemetry::SemanticConventions::Trace::DB_NAME] = database_name if database_name
+ attributes[::OpenTelemetry::SemanticConventions::Trace::DB_USER] = database_user if database_user
attributes[::OpenTelemetry::SemanticConventions::Trace::PEER_SERVICE] = config[:peer_service] unless config[:peer_service].nil?
attributes['db.mysql.instance.address'] = @connected_host if defined?(@connected_host)
case config[:db_statement]
when :obfuscate
@@ -127,9 +128,13 @@
end || 'mysql'
end
def database_name
connection_options[:database]
+ end
+
+ def database_user
+ connection_options[:username]
end
def tracer
Trilogy::Instrumentation.instance.tracer
end