Class: Datadog::Core::Telemetry::Component
- Inherits:
-
Object
- Object
- Datadog::Core::Telemetry::Component
- Includes:
- Utils::Forking
- Defined in:
- lib/datadog/core/telemetry/component.rb
Overview
Telemetry entrypoint, coordinates sending telemetry events at various points in app lifecycle.
Instance Attribute Summary collapse
-
#enabled ⇒ Object
readonly
Returns the value of attribute enabled.
Instance Method Summary collapse
-
#client_configuration_change!(changes) ⇒ Object
Report configuration changes caused by Remote Configuration.
- #disable! ⇒ Object
- #emit_closing! ⇒ Object
-
#initialize(heartbeat_interval_seconds:, dependency_collection:, enabled: true) ⇒ Component
constructor
A new instance of Component.
- #integrations_change! ⇒ Object
- #stop! ⇒ Object
Methods included from Utils::Forking
#after_fork!, extended, #fork_pid, #forked?, included, #update_fork_pid!
Constructor Details
#initialize(heartbeat_interval_seconds:, dependency_collection:, enabled: true) ⇒ Component
Returns a new instance of Component.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/datadog/core/telemetry/component.rb', line 20 def initialize(heartbeat_interval_seconds:, dependency_collection:, enabled: true) @enabled = enabled @stopped = false @worker = Telemetry::Worker.new( enabled: @enabled, heartbeat_interval_seconds: heartbeat_interval_seconds, emitter: Emitter.new, dependency_collection: dependency_collection ) @worker.start end |
Instance Attribute Details
#enabled ⇒ Object (readonly)
Returns the value of attribute enabled.
13 14 15 |
# File 'lib/datadog/core/telemetry/component.rb', line 13 def enabled @enabled end |
Instance Method Details
#client_configuration_change!(changes) ⇒ Object
Report configuration changes caused by Remote Configuration.
58 59 60 61 62 |
# File 'lib/datadog/core/telemetry/component.rb', line 58 def client_configuration_change!(changes) return if !@enabled || forked? @worker.enqueue(Event::AppClientConfigurationChange.new(changes, 'remote_config')) end |
#disable! ⇒ Object
33 34 35 36 |
# File 'lib/datadog/core/telemetry/component.rb', line 33 def disable! @enabled = false @worker.enabled = false end |
#emit_closing! ⇒ Object
45 46 47 48 49 |
# File 'lib/datadog/core/telemetry/component.rb', line 45 def emit_closing! return if !@enabled || forked? @worker.enqueue(Event::AppClosing.new) end |
#integrations_change! ⇒ Object
51 52 53 54 55 |
# File 'lib/datadog/core/telemetry/component.rb', line 51 def integrations_change! return if !@enabled || forked? @worker.enqueue(Event::AppIntegrationsChange.new) end |
#stop! ⇒ Object
38 39 40 41 42 43 |
# File 'lib/datadog/core/telemetry/component.rb', line 38 def stop! return if @stopped @worker.stop(true) @stopped = true end |