Sha256: ddbacd17c443033a12b513b024db6c133317e3923afb2ad5a1cdd11922d34411
Contents?: true
Size: 1.83 KB
Versions: 3
Compression:
Stored size: 1.83 KB
Contents
require_relative 'emitter' require_relative 'heartbeat' require_relative '../utils/forking' module Datadog module Core module Telemetry # Telemetry entrypoint, coordinates sending telemetry events at various points in app lifecycle. class Client attr_reader \ :emitter, :enabled, :unsupported, :worker include Core::Utils::Forking # @param enabled [Boolean] Determines whether telemetry events should be sent to the API def initialize(enabled: true) @enabled = enabled @emitter = Emitter.new @stopped = false @unsupported = false @worker = Telemetry::Heartbeat.new(enabled: @enabled) do heartbeat! end end def disable! @enabled = false @worker.enabled = false end def started! return if !@enabled || forked? res = @emitter.request(:'app-started') if res.not_found? # Telemetry is only supported by agent versions 7.34 and up Datadog.logger.debug('Agent does not support telemetry; disabling future telemetry events.') disable! @unsupported = true # Prevent telemetry from getting re-enabled end res end def emit_closing! return if !@enabled || forked? @emitter.request(:'app-closing') end def stop! return if @stopped @worker.stop(true, 0) @stopped = true end def integrations_change! return if !@enabled || forked? @emitter.request(:'app-integrations-change') end private def heartbeat! return if !@enabled || forked? @emitter.request(:'app-heartbeat') end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ddtrace-1.12.1 | lib/datadog/core/telemetry/client.rb |
ddtrace-1.12.0 | lib/datadog/core/telemetry/client.rb |
ddtrace-1.11.1 | lib/datadog/core/telemetry/client.rb |