Skip to content

Commit

Permalink
feat!: change db.mysql.instance.address to db.instance.id (#758)
Browse files Browse the repository at this point in the history
* refactor(trilogy): change db.mysql.instance.address to db.instance.id

fixes #745

* feat!(trilogy): change db.mysql.instance.address to db.instance.id

fixes #745

---------

Co-authored-by: Ariel Valentin <arielvalentin@users.noreply.github.com>
Co-authored-by: Kayla Reopelle (she/her) <87386821+kaylareopelle@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 8, 2023
1 parent 7cbd167 commit 73fa809
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def client_attributes(sql = nil)
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)
attributes['db.instance.id'] = @connected_host if defined?(@connected_host)

if sql
case config[:db_statement]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
_(span.attributes[OpenTelemetry::SemanticConventions::Trace::DB_SYSTEM]).must_equal 'mysql'
_(span.attributes[OpenTelemetry::SemanticConventions::Trace::DB_STATEMENT]).must_equal 'SELECT ?'
_(span.attributes[OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME]).must_equal(host)
_(span.attributes['db.mysql.instance.address']).must_be_nil
_(span.attributes['db.instance.id']).must_be_nil
end

it 'extracts statement type' do
Expand Down Expand Up @@ -177,7 +177,7 @@
_(span.attributes[OpenTelemetry::SemanticConventions::Trace::DB_USER]).must_equal(username)
_(span.attributes[OpenTelemetry::SemanticConventions::Trace::DB_SYSTEM]).must_equal 'mysql'
_(span.attributes[OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME]).must_equal(host)
_(span.attributes['db.mysql.instance.address']).must_be_nil
_(span.attributes['db.instance.id']).must_be_nil
end
end

Expand Down Expand Up @@ -207,7 +207,7 @@
_(span.attributes[OpenTelemetry::SemanticConventions::Trace::DB_SYSTEM]).must_equal 'mysql'
_(span.attributes[OpenTelemetry::SemanticConventions::Trace::DB_STATEMENT]).must_equal 'select @@hostname'
_(span.attributes[OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME]).must_equal(host)
_(span.attributes['db.mysql.instance.address']).must_be_nil
_(span.attributes['db.instance.id']).must_be_nil

client.query('SELECT 1')

Expand All @@ -219,7 +219,7 @@
_(last_span.attributes[OpenTelemetry::SemanticConventions::Trace::DB_SYSTEM]).must_equal 'mysql'
_(last_span.attributes[OpenTelemetry::SemanticConventions::Trace::DB_STATEMENT]).must_equal 'SELECT ?'
_(last_span.attributes[OpenTelemetry::SemanticConventions::Trace::NET_PEER_NAME]).must_equal(host)
_(last_span.attributes['db.mysql.instance.address']).must_equal client.connected_host
_(last_span.attributes['db.instance.id']).must_equal client.connected_host
end
end

Expand Down

0 comments on commit 73fa809

Please sign in to comment.