Skip to content

Commit

Permalink
fix: Use top level namespaces
Browse files Browse the repository at this point in the history
When used in conjunction with the `OpenTelemetry::Instrumenation::ActiveSupport`,
the classloader would mistakenly use the wrong namespace and raises a `NameError`.

This change updates references to ensure we use top level namespaces to load the appropriate classes.
  • Loading branch information
arielvalentin committed Nov 9, 2023
1 parent 8329bb5 commit 6d2fbf8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def subscribe
}

@subscriptions = handlers_by_pattern.map do |key, handler|
ActiveSupport::Notifications.subscribe("#{key}.active_job", handler)
::ActiveSupport::Notifications.subscribe("#{key}.active_job", handler)
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base
end

present do
defined?(::ActiveJob)
defined?(::ActiveJob) && defined?(::ActiveSupport)
end

compatible do
Expand Down

0 comments on commit 6d2fbf8

Please sign in to comment.