Skip to content

Commit

Permalink
Don't report table name on error
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahramadan committed Oct 30, 2024
1 parent 46616da commit 4af3e2c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 4af3e2c

Please sign in to comment.