File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
lib/datadog/tracing/contrib/karafka Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -48,6 +48,18 @@ def each(&block)
4848 end
4949 end
5050
51+ module AppPatch
52+ ONLY_ONCE_PER_APP = Hash . new { |h , key | h [ key ] = Core ::Utils ::OnlyOnce . new }
53+
54+ def initialized!
55+ ONLY_ONCE_PER_APP [ self ] . run do
56+ # Activate tracing on components related to Karafka (e.g. WaterDrop)
57+ Contrib ::Karafka ::Framework . setup
58+ end
59+ super
60+ end
61+ end
62+
5163 # Patcher enables patching of 'karafka' module.
5264 module Patcher
5365 include Contrib ::Patcher
@@ -60,12 +72,11 @@ def target_version
6072
6173 def patch
6274 require_relative 'monitor'
75+ require_relative 'framework'
6376
6477 ::Karafka ::Instrumentation ::Monitor . prepend ( Monitor )
6578 ::Karafka ::Messages ::Messages . prepend ( MessagesPatch )
66-
67- # Activate tracing on components related to Karafka (e.g. WaterDrop)
68- Framework . setup
79+ ::Karafka ::App . singleton_class . prepend ( AppPatch )
6980 end
7081 end
7182 end
You can’t perform that action at this time.
0 commit comments