Skip to content

Commit

Permalink
Update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyCTHsu committed Sep 13, 2024
1 parent 19c88eb commit f64ae44
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/datadog/core/telemetry/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@ def error(description)
private

def instance
# `allow_initialization: false` would avoid referencing the components via `safely_synchronize` (mutex)
# which could cause deadlock during components initialization.
# Component initialization uses a mutex to avoid having concurrent initialization.
# Trying to access the telemetry component during initialization (specifically:
# from the thread that's actually doing the initialization) would cause a deadlock,
# since accessing the components would try to recursively lock the mutex.
#
# To work around this, we use allow_initialization: false to avoid triggering this issue.
#
# The downside is: this leaves us unable to report telemetry during component initialization.
components = Datadog.send(:components, allow_initialization: false)

if components && components.telemetry
Expand Down

0 comments on commit f64ae44

Please sign in to comment.