Class: Datadog::Core::Cloudwise::DOCCRegistrationWorker
- Includes:
- Workers::Polling
- Defined in:
- lib/datadog/core/cloudwise/docc_registration_worker.rb
Overview
Worker that registers extension to DOCC every 10 minutes DOCC 注册纳管 Worker
Constant Summary collapse
- DEFAULT_INTERVAL =
10 minutes interval (600 seconds)
600- DOCC_CODE_SUCCESS =
成功的状态码
100000
Constants included from Workers::Polling
Workers::Polling::DEFAULT_SHUTDOWN_TIMEOUT
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Attributes inherited from Worker
Instance Method Summary collapse
-
#initialize(client:, logger:, probe_state:, **options) ⇒ DOCCRegistrationWorker
constructor
A new instance of DOCCRegistrationWorker.
- #perform ⇒ Object
-
#start ⇒ Object
Public method to start the worker.
Methods included from Workers::Polling
#enabled=, #enabled?, included, #stop
Constructor Details
#initialize(client:, logger:, probe_state:, **options) ⇒ DOCCRegistrationWorker
Returns a new instance of DOCCRegistrationWorker.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/datadog/core/cloudwise/docc_registration_worker.rb', line 22 def initialize(client:, logger:, probe_state:, **) @client = client @logger = logger @probe_state = probe_state # Workers::Async::Thread settings self.fork_policy = .fetch(:fork_policy, Workers::Async::Thread::FORK_POLICY_STOP) # Workers::IntervalLoop settings self.loop_base_interval = .fetch(:interval, DEFAULT_INTERVAL) self.enabled = .fetch(:enabled, true) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
20 21 22 |
# File 'lib/datadog/core/cloudwise/docc_registration_worker.rb', line 20 def client @client end |
Instance Method Details
#perform ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/datadog/core/cloudwise/docc_registration_worker.rb', line 36 def perform Cloudwise.log_debug { 'Cloudwise DOCC: Registering extension' } result = client.docc_register_ext process_registration_result(result) true rescue => e Cloudwise.log_error { "Cloudwise DOCC: Registration worker error: #{e.class.name} #{e.message}" } true # Continue running end |
#start ⇒ Object
Public method to start the worker
50 51 52 53 54 55 |
# File 'lib/datadog/core/cloudwise/docc_registration_worker.rb', line 50 def start return false if !enabled? || started? # Start the async worker thread perform end |