Class: Datadog::Core::Cloudwise::DOCCAppRegistrationWorker
- Includes:
- Workers::Polling
- Defined in:
- lib/datadog/core/cloudwise/docc_app_registration_worker.rb
Overview
Worker that registers application in DOCC mode using DOOP prefix DOCC 模式下调用 DOOP 的应用注册逻辑 接口路径: /doop-agent-api/v2/app/create 应用注册失败不影响数据采集
Constant Summary collapse
- DEFAULT_INTERVAL =
3 minutes interval
180- CODE_SUCCESS =
成功的状态码
1000
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) ⇒ DOCCAppRegistrationWorker
constructor
A new instance of DOCCAppRegistrationWorker.
- #perform ⇒ Object
- #registered? ⇒ Boolean
-
#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) ⇒ DOCCAppRegistrationWorker
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/datadog/core/cloudwise/docc_app_registration_worker.rb', line 24 def initialize(client:, logger:, probe_state:, **) @client = client @logger = logger @probe_state = probe_state @registration_successful = false # 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.
22 23 24 |
# File 'lib/datadog/core/cloudwise/docc_app_registration_worker.rb', line 22 def client @client end |
Instance Method Details
#perform ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/datadog/core/cloudwise/docc_app_registration_worker.rb', line 39 def perform Cloudwise.log_debug { 'Cloudwise DOCC: Registering application (DOOP prefix)' } result = client.docc_register_application process_registration_result(result) true rescue => e Cloudwise.log_error { "Cloudwise DOCC: Application registration worker error: #{e.class.name} #{e.message}" } @probe_state.mark_app_unregistered! true # Continue running end |
#registered? ⇒ Boolean
53 54 55 |
# File 'lib/datadog/core/cloudwise/docc_app_registration_worker.rb', line 53 def registered? @registration_successful end |
#start ⇒ Object
Public method to start the worker
58 59 60 61 62 63 |
# File 'lib/datadog/core/cloudwise/docc_app_registration_worker.rb', line 58 def start return false if !enabled? || started? # Start the async worker thread perform end |