Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds span.kind tag for racecar #2413

Merged
merged 4 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ elsif ruby_version?('3.0') || ruby_version?('3.1')
gem 'mongo', '>= 2.8.0', '< 2.15.0' # TODO: FIX TEST BREAKAGES ON >= 2.15 https://github.com/DataDog/dd-trace-rb/issues/1596
gem 'mysql2', '>= 0.5.3', platform: :ruby
gem 'pg', '>= 1.1', platform: :ruby
# gem 'racecar', '>= 0.3.5' # Pending release of our fix: https://github.com/appsignal/rdkafka-ruby/pull/144
gem 'racecar', '>= 0.3.5'
zarirhamza marked this conversation as resolved.
Show resolved Hide resolved
gem 'rack'
gem 'rack-contrib'
gem 'rack-test'
Expand Down Expand Up @@ -1572,7 +1572,7 @@ elsif ruby_version?('3.2')
gem 'mongo', '>= 2.8.0', '< 2.15.0' # TODO: FIX TEST BREAKAGES ON >= 2.15 https://github.com/DataDog/dd-trace-rb/issues/1596
# gem 'mysql2', '>= 0.5.3', platform: :ruby # broken on Ruby 3.2.0-preview1
gem 'pg', '>= 1.1', platform: :ruby
# gem 'racecar', '>= 0.3.5' # Pending release of our fix: https://github.com/appsignal/rdkafka-ruby/pull/144
gem 'racecar', '>= 0.3.5'
gem 'rack'
gem 'rack-contrib'
gem 'rack-test'
Expand Down
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ task :ci do
declare '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ❌ jruby' => 'bundle exec appraisal contrib rake spec:pg'
declare '✅ 2.1 / ✅ 2.2 / ❌ 2.3 / ❌ 2.4 / ❌ 2.5 / ❌ 2.6 / ❌ 2.7 / ❌ 3.0 / ❌ 3.1 / ❌ 3.2 / ❌ jruby' => 'bundle exec appraisal contrib rake spec:presto'
declare '❌ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ jruby' => 'bundle exec appraisal contrib rake spec:que'
declare '❌ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / 3.0 / 3.1 / 3.2 / ✅ jruby' => 'bundle exec appraisal contrib rake spec:racecar' # disabled on 3.0 pending release of our fix: https://github.com/appsignal/rdkafka-ruby/pull/144
declare '❌ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / 3.0 / 3.1 / 3.2 / ✅ jruby' => 'bundle exec appraisal contrib rake spec:racecar' # disabled on 3.0 pending release of our fix: https://github.com/appsignal/rdkafka-ruby/pull/144
declare '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ jruby' => 'bundle exec appraisal contrib rake spec:rack'
declare '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ jruby' => 'bundle exec appraisal contrib rake spec:rake'
declare '✅ 2.1 / ✅ 2.2 / ✅ 2.3 / ✅ 2.4 / ✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ jruby' => 'bundle exec appraisal contrib rake spec:redis'
Expand Down
10 changes: 10 additions & 0 deletions gemfiles/ruby_3.0.4_contrib.gemfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion lib/datadog/tracing/contrib/racecar/events/batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ def span_name
end

def span_options
super.merge(tags: { Tracing::Metadata::Ext::TAG_OPERATION => Ext::TAG_OPERATION_BATCH })
super.merge(
tags: { Tracing::Metadata::Ext::TAG_OPERATION => Ext::TAG_OPERATION_BATCH,
Tracing::Metadata::Ext::TAG_KIND => Tracing::Metadata::Ext::SpanKind::TAG_CONSUMER }
)
end
end
end
Expand Down
5 changes: 4 additions & 1 deletion lib/datadog/tracing/contrib/racecar/events/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ def span_name
end

def span_options
super.merge(tags: { Tracing::Metadata::Ext::TAG_OPERATION => Ext::TAG_OPERATION_MESSAGE })
super.merge(
tags: { Tracing::Metadata::Ext::TAG_OPERATION => Ext::TAG_OPERATION_MESSAGE,
Tracing::Metadata::Ext::TAG_KIND => Tracing::Metadata::Ext::SpanKind::TAG_CONSUMER }
)
end
end
end
Expand Down
6 changes: 6 additions & 0 deletions spec/datadog/tracing/contrib/racecar/patcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
expect(span).to_not have_error
expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_COMPONENT)).to eq('racecar')
expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_OPERATION)).to eq('consume')
expect(span.get_tag('span.kind')).not_to eq('consumer')
end
end
end
Expand All @@ -74,6 +75,7 @@
expect(span.resource).to eq(consumer)
expect(span.get_tag('kafka.consumer')).to eq(consumer)
expect(span).to have_error
expect(span.get_tag('span.kind')).not_to eq('consumer')
end
end
end
Expand Down Expand Up @@ -125,6 +127,7 @@
expect(span).to_not have_error
expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_COMPONENT)).to eq('racecar')
expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_OPERATION)).to eq('message')
expect(span.get_tag('span.kind')).to eq('consumer')
end
end
end
Expand Down Expand Up @@ -153,6 +156,7 @@
expect(span.get_tag('kafka.offset')).to eq(offset)
expect(span.get_tag('kafka.first_offset')).to be nil
expect(span).to have_error
expect(span.get_tag('span.kind')).to eq('consumer')
end
end
end
Expand Down Expand Up @@ -207,6 +211,7 @@
expect(span).to_not have_error
expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_COMPONENT)).to eq('racecar')
expect(span.get_tag(Datadog::Tracing::Metadata::Ext::TAG_OPERATION)).to eq('batch')
expect(span.get_tag('span.kind')).to eq('consumer')
end
end
end
Expand Down Expand Up @@ -235,6 +240,7 @@
expect(span.get_tag('kafka.first_offset')).to eq(offset)
expect(span.get_tag('kafka.message_count')).to eq(message_count)
expect(span).to have_error
expect(span.get_tag('span.kind')).to eq('consumer')
end
end
end
Expand Down