class Datadog::Workers::RuntimeMetrics
Emits runtime metrics asynchronously on a timed loop
Attributes
metrics[R]
Public Class Methods
new(options = {})
click to toggle source
# File lib/ddtrace/workers/runtime_metrics.rb, line 18 def initialize(options = {}) @metrics = options.fetch(:metrics, Runtime::Metrics.new) # Workers::Async::Thread settings self.fork_policy = options.fetch(:fork_policy, Workers::Async::Thread::FORK_POLICY_STOP) # Workers::IntervalLoop settings self.interval = options[:interval] if options.key?(:interval) self.back_off_ratio = options[:back_off_ratio] if options.key?(:back_off_ratio) self.back_off_max = options[:back_off_max] if options.key?(:back_off_max) self.enabled = options.fetch(:enabled, false) end
Public Instance Methods
associate_with_span(*args)
click to toggle source
# 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()
click to toggle source
# File lib/ddtrace/workers/runtime_metrics.rb, line 32 def perform metrics.flush true end