Class: Datadog::Workers::RuntimeMetrics
- Inherits:
-
Datadog::Worker
- Object
- Datadog::Worker
- Datadog::Workers::RuntimeMetrics
- Extended by:
- Forwardable
- Includes:
- Polling
- Defined in:
- lib/ddtrace/workers/runtime_metrics.rb
Overview
Emits runtime metrics asynchronously on a timed loop
Constant Summary
Constants included from Polling
Instance Attribute Summary collapse
-
#metrics ⇒ Object
readonly
Returns the value of attribute metrics.
Attributes inherited from Datadog::Worker
Instance Method Summary collapse
- #associate_with_span(*args) ⇒ Object
-
#initialize(options = {}) ⇒ RuntimeMetrics
constructor
A new instance of RuntimeMetrics.
- #perform ⇒ Object
Methods included from Polling
#enabled=, #enabled?, included, #stop
Constructor Details
#initialize(options = {}) ⇒ RuntimeMetrics
Returns a new instance of RuntimeMetrics.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/ddtrace/workers/runtime_metrics.rb', line 18 def initialize( = {}) @metrics = .fetch(:metrics, Runtime::Metrics.new) # Workers::Async::Thread settings self.fork_policy = .fetch(:fork_policy, Workers::Async::Thread::FORK_POLICY_STOP) # Workers::IntervalLoop settings self.interval = [:interval] if .key?(:interval) self.back_off_ratio = [:back_off_ratio] if .key?(:back_off_ratio) self.back_off_max = [:back_off_max] if .key?(:back_off_max) self.enabled = .fetch(:enabled, false) end |
Instance Attribute Details
#metrics ⇒ Object (readonly)
Returns the value of attribute metrics.
15 16 17 |
# File 'lib/ddtrace/workers/runtime_metrics.rb', line 15 def metrics @metrics end |
Instance Method Details
#associate_with_span(*args) ⇒ Object
37 38 39 40 |
# File 'lib/ddtrace/workers/runtime_metrics.rb', line 37 def associate_with_span(*args) # Start the worker metrics.associate_with_span(*args).tap { perform } end |
#perform ⇒ Object
32 33 34 35 |
# File 'lib/ddtrace/workers/runtime_metrics.rb', line 32 def perform metrics.flush true end |