diff --git a/lib/datadog/tracing/contrib/elasticsearch/patcher.rb b/lib/datadog/tracing/contrib/elasticsearch/patcher.rb index 2b2cf874e6..c15e1d4fab 100644 --- a/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +++ b/lib/datadog/tracing/contrib/elasticsearch/patcher.rb @@ -81,10 +81,11 @@ def perform_request(*args) span.span_type = Datadog::Tracing::Contrib::Elasticsearch::Ext::SPAN_TYPE_QUERY - span.set_tag(Contrib::Ext::DB::TAG_SYSTEM, Ext::TAG_SYSTEM) - span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT) span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_QUERY) + span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT) + + span.set_tag(Contrib::Ext::DB::TAG_SYSTEM, Ext::TAG_SYSTEM) # load JSON for the following fields unless they're already strings params = JSON.generate(params) if params && !params.is_a?(String) diff --git a/lib/datadog/tracing/contrib/presto/ext.rb b/lib/datadog/tracing/contrib/presto/ext.rb index a3dc8f65ba..5d873a2334 100644 --- a/lib/datadog/tracing/contrib/presto/ext.rb +++ b/lib/datadog/tracing/contrib/presto/ext.rb @@ -26,6 +26,7 @@ module Ext TAG_COMPONENT = 'presto'.freeze TAG_OPERATION_QUERY = 'query'.freeze TAG_OPERATION_KILL = 'kill'.freeze + TAG_SYSTEM = 'presto'.freeze end end end diff --git a/lib/datadog/tracing/contrib/presto/instrumentation.rb b/lib/datadog/tracing/contrib/presto/instrumentation.rb index 9014feec7b..580cb040d9 100644 --- a/lib/datadog/tracing/contrib/presto/instrumentation.rb +++ b/lib/datadog/tracing/contrib/presto/instrumentation.rb @@ -81,6 +81,9 @@ def datadog_configuration def decorate!(span, operation) span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT) span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, operation) + span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT) + + span.set_tag(Contrib::Ext::DB::TAG_SYSTEM, Ext::TAG_SYSTEM) if (host_port = @options[:server]) host, port = Core::Utils.extract_host_port(host_port) diff --git a/lib/datadog/tracing/contrib/qless/qless_job.rb b/lib/datadog/tracing/contrib/qless/qless_job.rb index d4bd845677..47e1ce1114 100644 --- a/lib/datadog/tracing/contrib/qless/qless_job.rb +++ b/lib/datadog/tracing/contrib/qless/qless_job.rb @@ -15,8 +15,6 @@ def around_perform(job) return super unless datadog_configuration && Tracing.enabled? Tracing.trace(Ext::SPAN_JOB, **span_options) do |span| - span.set_tag(Contrib::Ext::Messaging::TAG_SYSTEM, Ext::TAG_COMPONENT) - span.resource = job.klass_name span.span_type = Tracing::Metadata::Ext::AppTypes::TYPE_WORKER span.set_tag(Ext::TAG_JOB_ID, job.jid) @@ -37,6 +35,9 @@ def around_perform(job) span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT) span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_JOB) + span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CONSUMER) + + span.set_tag(Contrib::Ext::Messaging::TAG_SYSTEM, Ext::TAG_COMPONENT) # Set analytics sample rate if Contrib::Analytics.enabled?(datadog_configuration[:analytics_enabled]) diff --git a/spec/datadog/tracing/contrib/elasticsearch/patcher_spec.rb b/spec/datadog/tracing/contrib/elasticsearch/patcher_spec.rb index 34f95da715..74a747120d 100644 --- a/spec/datadog/tracing/contrib/elasticsearch/patcher_spec.rb +++ b/spec/datadog/tracing/contrib/elasticsearch/patcher_spec.rb @@ -77,7 +77,11 @@ } it { - expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_COMPONENT)).to eq('elasticsearch') + expect(span.get_tag('component')).to eq('elasticsearch') + } + + it { + expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_KIND)).to eq('client') } it { @@ -139,7 +143,11 @@ } it { - expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_COMPONENT)).to eq('elasticsearch') + expect(span.get_tag('component')).to eq('elasticsearch') + } + + it { + expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_KIND)).to eq('client') } it { diff --git a/spec/datadog/tracing/contrib/presto/client_spec.rb b/spec/datadog/tracing/contrib/presto/client_spec.rb index 1a3c7af4ce..9f79c07e98 100644 --- a/spec/datadog/tracing/contrib/presto/client_spec.rb +++ b/spec/datadog/tracing/contrib/presto/client_spec.rb @@ -103,6 +103,8 @@ def presto_online? expect(span.get_tag('out.port')).to eq(port) expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_COMPONENT)).to eq('presto') expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_OPERATION)).to eq(operation) + expect(span.get_tag('span.kind')).to eq('client') + expect(span.get_tag('db.system')).to eq('presto') end end diff --git a/spec/datadog/tracing/contrib/qless/instrumentation_spec.rb b/spec/datadog/tracing/contrib/qless/instrumentation_spec.rb index 97c0427030..8e419847cd 100644 --- a/spec/datadog/tracing/contrib/qless/instrumentation_spec.rb +++ b/spec/datadog/tracing/contrib/qless/instrumentation_spec.rb @@ -44,6 +44,7 @@ expect(span).to_not have_error expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_COMPONENT)).to eq('qless') expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_OPERATION)).to eq('job') + expect(span.get_tag('span.kind')).to eq('consumer') expect(span.get_tag('messaging.system')).to eq('qless') end @@ -83,6 +84,7 @@ expect(span).to have_error_type(error_class_name) expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_COMPONENT)).to eq('qless') expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_OPERATION)).to eq('job') + expect(span.get_tag('span.kind')).to eq('consumer') expect(span.get_tag('messaging.system')).to eq('qless') end end