Skip to content

Commit

Permalink
Merge branch 'main' into obfuscation_by_default
Browse files Browse the repository at this point in the history
  • Loading branch information
arielvalentin authored Oct 11, 2023
2 parents 364e270 + 93dcf35 commit 86706ef
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 16 deletions.
4 changes: 4 additions & 0 deletions instrumentation/action_pack/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ end
appraise 'rails-7.0' do
gem 'rails', '~> 7.0.0'
end

appraise 'rails-7.1' do
gem 'rails', '~> 7.1.0'
end
4 changes: 4 additions & 0 deletions instrumentation/action_view/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ end
appraise 'rails-7.0' do
gem 'rails', '~> 7.0.0'
end

appraise 'rails-7.1' do
gem 'rails', '~> 7.1.0'
end
14 changes: 4 additions & 10 deletions instrumentation/active_job/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@
#
# SPDX-License-Identifier: Apache-2.0

appraise 'activejob-6.0' do
gem 'activejob', '~> 6.0.0'
end

appraise 'activejob-6.1' do
gem 'activejob', '~> 6.1.0'
end

appraise 'activejob-7.0' do
gem 'activejob', '~> 7.0.0'
%w[6.0.0 6.1.0 7.0.0 7.1.0].each do |version|
appraise "activejob-#{version}" do
gem 'activejob', "~> #{version}"
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def job_attributes(job)
'messaging.destination' => job.queue_name,
'messaging.message_id' => job.job_id,
'messaging.active_job.provider_job_id' => job.provider_job_id,
'messaging.active_job.scheduled_at' => job.scheduled_at,
'messaging.active_job.scheduled_at' => job.scheduled_at&.to_f,
'messaging.active_job.priority' => job.priority
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,21 @@
end
end

it 'is set correctly for jobs that do wait' do
it 'records the scheduled at time for apps running Rails 7.1 and newer' do
skip 'scheduled jobs behave differently in Rails 7.1+' if ActiveJob.version < Gem::Version.new('7.1')

job = TestJob.set(wait: 0.second).perform_later

# Only the sending span is a 'scheduled' thing
_(publish_span.attributes['messaging.active_job.scheduled_at']).must_equal(job.scheduled_at)
assert(publish_span.attributes['messaging.active_job.scheduled_at'])
_(publish_span.attributes['messaging.active_job.scheduled_at']).must_equal(job.scheduled_at.to_f)
_(process_span.attributes['messaging.active_job.scheduled_at']).must_equal(job.scheduled_at.to_f)
end

it 'records the scheduled at time for apps running Rails 7.0 or older' do
skip 'scheduled jobs behave differently in Rails 7.1+' if ActiveJob.version >= Gem::Version.new('7.1')

job = TestJob.set(wait: 0.second).perform_later

# The processing span isn't a 'scheduled' thing
_(publish_span.attributes['messaging.active_job.scheduled_at']).must_equal(job.scheduled_at.to_f)
_(process_span.attributes['messaging.active_job.scheduled_at']).must_be_nil
end
end
Expand Down
4 changes: 4 additions & 0 deletions instrumentation/active_record/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ end
appraise 'activerecord-7.0' do
gem 'activerecord', '~> 7.0.0'
end

appraise 'activerecord-7.1' do
gem 'activerecord', '~> 7.1.0'
end
4 changes: 4 additions & 0 deletions instrumentation/active_support/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ end
appraise 'activesupport-7.0' do
gem 'activesupport', '~> 7.0.0'
end

appraise 'activesupport-7.1' do
gem 'activesupport', '~> 7.1.0'
end
4 changes: 4 additions & 0 deletions instrumentation/rails/Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ end
appraise 'rails-7.0' do
gem 'rails', '~> 7.0.0'
end

appraise 'rails-7.1' do
gem 'rails', '~> 7.1.0'
end

0 comments on commit 86706ef

Please sign in to comment.