From 4af3e2c333e378f9fc352bfac4933e2b26d3d586 Mon Sep 17 00:00:00 2001 From: Hannah Ramadan Date: Wed, 30 Oct 2024 14:19:41 -0700 Subject: [PATCH] Don't report table name on error --- .../lib/opentelemetry/instrumentation/mysql2/patches/client.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/instrumentation/mysql2/lib/opentelemetry/instrumentation/mysql2/patches/client.rb b/instrumentation/mysql2/lib/opentelemetry/instrumentation/mysql2/patches/client.rb index d1094f4cd..0b50b8d99 100644 --- a/instrumentation/mysql2/lib/opentelemetry/instrumentation/mysql2/patches/client.rb +++ b/instrumentation/mysql2/lib/opentelemetry/instrumentation/mysql2/patches/client.rb @@ -53,7 +53,7 @@ def _otel_span_attributes(sql) attributes = _otel_client_attributes(sql) if sql - attributes[SemanticConventions::Trace::DB_SQL_TABLE] = db_sql_table_name(sql) if config[:db_sql_table] == :include + attributes[SemanticConventions::Trace::DB_SQL_TABLE] = db_sql_table_name(sql) if db_sql_table_name(sql) && config[:db_sql_table] == :include case config[:db_statement] when :include @@ -98,6 +98,7 @@ def _otel_client_attributes(sql) def db_sql_table_name(sql) Regexp.last_match(1) if sql =~ TABLE_NAME rescue StandardError + OpenTelemetry.handle_error(message: 'Error extracting collection name', exception: e) nil end