Skip to content

Commit

Permalink
squash: use proxy tracer to upgrade later
Browse files Browse the repository at this point in the history
  • Loading branch information
arielvalentin committed Oct 10, 2023
1 parent ddb8906 commit f996004
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion instrumentation/active_job/example/active_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def perform

class DoItNowJob < ::ActiveJob::Base
def perform
puts <<~EOS
$stderr.puts <<~EOS
--------------------------------------------------
Called with perform_now!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module Handlers
def subscribe
return unless Array(@subscriptions).empty?

tracer = Instrumentation.instance.tracer
tracer = OpenTelemetry.tracer_provider.tracer(ActiveJob.name, ActiveJob::VERSION)
mapper = Mappers::Attribute.new
config = ActiveJob::Instrumentation.instance.config
parent_span_provider = OpenTelemetry::Instrumentation::ActiveJob
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ def finish(_name, _id, payload)
def finish_span(span, tokens)
# closes the span after all attributes have been finalized
begin
span&.status = OpenTelemetry::Trace::Status.ok if span&.status&.code == OpenTelemetry::Trace::Status::UNSET
span&.finish
if span&.recording?
span&.status = OpenTelemetry::Trace::Status.ok if span&.status&.code == OpenTelemetry::Trace::Status::UNSET
span&.finish
end
rescue StandardError => e
OpenTelemetry.handle_error(exception: e)
end
Expand Down

0 comments on commit f996004

Please sign in to comment.