Skip to content

Commit

Permalink
Merge pull request #2608 from DataDog/zarir/presto-elasticsearch-qles…
Browse files Browse the repository at this point in the history
…s-spankind
  • Loading branch information
marcotc authored Feb 17, 2023
2 parents 81b338b + f70e20a commit cebb067
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/datadog/tracing/contrib/elasticsearch/patcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions lib/datadog/tracing/contrib/presto/ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions lib/datadog/tracing/contrib/presto/instrumentation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions lib/datadog/tracing/contrib/qless/qless_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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])
Expand Down
12 changes: 10 additions & 2 deletions spec/datadog/tracing/contrib/elasticsearch/patcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions spec/datadog/tracing/contrib/presto/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions spec/datadog/tracing/contrib/qless/instrumentation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cebb067

Please sign in to comment.