Skip to content

Commit

Permalink
addresses nit and reformatting of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zarirhamza committed Sep 13, 2023
1 parent a8c401f commit 622fe56
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 142 deletions.
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/propagation/sql_comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def self.prepend_comment(sql, span_op, trace_op, mode)
return sql unless mode.enabled?

tags = {
Ext::KEY_DATABASE_SERVICE => span_op.get_tag('peer.service') || span_op.service,
Ext::KEY_DATABASE_SERVICE => span_op.get_tag(Tracing::Metadata::Ext::TAG_PEER_SERVICE) || span_op.service,
Ext::KEY_ENVIRONMENT => datadog_configuration.env,
Ext::KEY_PARENT_SERVICE => datadog_configuration.service,
Ext::KEY_VERSION => datadog_configuration.version
Expand Down
13 changes: 3 additions & 10 deletions spec/datadog/tracing/contrib/mysql2/patcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@
expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_PEER_SERVICE)).to eq(database)
end

it_behaves_like 'with sql comment propagation',
span_op_name: 'mysql2.query',
peer_service: ENV.fetch('TEST_MYSQL_DB') { 'mysql' }
it_behaves_like 'with sql comment propagation', span_op_name: 'mysql2.query'
end

context 'when a successful query is made' do
Expand Down Expand Up @@ -111,9 +109,7 @@
before { query }
end

it_behaves_like 'with sql comment propagation',
span_op_name: 'mysql2.query',
peer_service: ENV.fetch('TEST_MYSQL_DB') { 'mysql' }
it_behaves_like 'with sql comment propagation', span_op_name: 'mysql2.query'

it_behaves_like 'environment service name', 'DD_TRACE_MYSQL2_SERVICE_NAME' do
let(:configuration_options) { {} }
Expand Down Expand Up @@ -144,10 +140,7 @@
.to eq("Unknown column 'INVALID' in 'field list'")
end

it_behaves_like 'with sql comment propagation',
span_op_name: 'mysql2.query',
peer_service: ENV.fetch('TEST_MYSQL_DB') { 'mysql' },
error: Mysql2::Error
it_behaves_like 'with sql comment propagation', span_op_name: 'mysql2.query', error: Mysql2::Error

it_behaves_like 'environment service name', 'DD_TRACE_MYSQL2_SERVICE_NAME', error: Mysql2::Error do
let(:configuration_options) { {} }
Expand Down
Loading

0 comments on commit 622fe56

Please sign in to comment.