Skip to content

Commit 566ffc3

Browse files
committed
DEBUG-3457 hack probe notifier worker starting
1 parent 9404631 commit 566ffc3

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

lib/datadog/di/component.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,18 @@ def initialize(settings, agent_settings, logger, code_tracker: nil, telemetry: n
8484
@probe_notifier_worker = ProbeNotifierWorker.new(settings, transport, logger, telemetry: telemetry)
8585
@probe_notification_builder = ProbeNotificationBuilder.new(settings, serializer)
8686
@probe_manager = ProbeManager.new(settings, instrumenter, probe_notification_builder, probe_notifier_worker, logger, telemetry: telemetry)
87-
probe_notifier_worker.start
87+
88+
# If the worker is started here, it will be in the parent process
89+
# of forking web servers like puma rather than in the worker processes
90+
# that actually process HTTP requests, and thus DI will end up not
91+
# sending any events to the agent.
92+
#
93+
# There is currently no "nice" way to handle this situation correctly -
94+
# remote config has the same issue and the tracing Rack middleware
95+
# presently starts the remote config worker.
96+
#
97+
# DI is hacked into that middleware the same way.
98+
#probe_notifier_worker.start
8899
end
89100

90101
attr_reader :settings

lib/datadog/tracing/contrib/rack/middlewares.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ def call(env)
3939

4040
boot = Datadog::Core::Remote::Tie.boot
4141

42+
if defined?(Datadog::DI)
43+
Datadog::DI.current_component&.probe_notifier_worker&.start
44+
end
45+
4246
# Extract distributed tracing context before creating any spans,
4347
# so that all spans will be added to the distributed trace.
4448
if configuration[:distributed_tracing]

0 commit comments

Comments
 (0)