Module: Datadog::DI Private

Defined in:
lib/datadog/di.rb,
lib/datadog/di/error.rb,
lib/datadog/di/probe.rb,
lib/datadog/di/utils.rb,
lib/datadog/di/redactor.rb,
lib/datadog/di/component.rb,
lib/datadog/di/transport.rb,
lib/datadog/di/extensions.rb,
lib/datadog/di/serializer.rb,
lib/datadog/di/code_tracker.rb,
lib/datadog/di/instrumenter.rb,
lib/datadog/di/configuration.rb,
lib/datadog/di/probe_builder.rb,
lib/datadog/di/probe_manager.rb,
lib/datadog/di/probe_notifier_worker.rb,
lib/datadog/di/configuration/settings.rb,
lib/datadog/di/probe_notification_builder.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Namespace for Datadog dynamic instrumentation.

Defined Under Namespace

Modules: Configuration, Extensions, ProbeBuilder, Utils Classes: CodeTracker, Component, Error, Instrumenter, Probe, ProbeManager, ProbeNotificationBuilder, ProbeNotifierWorker, Redactor, Serializer, Transport

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.code_trackerObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



46
47
48
# File 'lib/datadog/di.rb', line 46

def code_tracker
  @code_tracker
end

Class Method Details

.activate_tracking!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Activates code tracking. Normally this method should be called when the application starts. If instrumenting third-party code, code tracking needs to be enabled before the third-party libraries are loaded. If you definitely will not be instrumenting third-party libraries, activating tracking after third-party libraries have been loaded may improve lookup performance.

TODO test that activating tracker multiple times preserves existing mappings in the registry



57
58
59
# File 'lib/datadog/di.rb', line 57

def activate_tracking!
  (@code_tracker ||= CodeTracker.new).start
end

.code_tracking_active?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns whether code tracking is available. This method should be used instead of querying #code_tracker because the latter one may be nil.

Returns:

  • (Boolean)


75
76
77
# File 'lib/datadog/di.rb', line 75

def code_tracking_active?
  code_tracker&.active? || false
end

.componentObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



79
80
81
82
# File 'lib/datadog/di.rb', line 79

def component
  # TODO uncomment when remote is merged
  #Datadog.send(:components).dynamic_instrumentation
end

.deactivate_tracking!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Deactivates code tracking. In normal usage of DI this method should never be called, however it is used by DI’s test suite to reset state for individual tests.

Note that deactivating tracking clears out the registry, losing the ability to look up files that have been loaded into the process already.



68
69
70
# File 'lib/datadog/di.rb', line 68

def deactivate_tracking!
  code_tracker&.stop
end

.enabled?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


37
38
39
# File 'lib/datadog/di.rb', line 37

def enabled?
  Datadog.configuration.dynamic_instrumentation.enabled
end