Skip to content

Commit 68f42ec

Browse files
committed
Only make one sql table method call
1 parent b8d5a96 commit 68f42ec

File tree

1 file changed

+2
-1
lines changed
  • instrumentation/mysql2/lib/opentelemetry/instrumentation/mysql2/patches

1 file changed

+2
-1
lines changed

instrumentation/mysql2/lib/opentelemetry/instrumentation/mysql2/patches/client.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ def _otel_span_attributes(sql)
5353
attributes = _otel_client_attributes(sql)
5454

5555
if sql
56-
attributes[SemanticConventions::Trace::DB_SQL_TABLE] = db_sql_table_name(sql) if db_sql_table_name(sql) && config[:db_sql_table] == :include
56+
sql_table_name = db_sql_table_name(sql)
57+
attributes[SemanticConventions::Trace::DB_SQL_TABLE] = sql_table_name if sql_table_name && config[:db_sql_table] == :include
5758

5859
case config[:db_statement]
5960
when :include

0 commit comments

Comments
 (0)