Class: Instana::Backend::HostAgentReportingObserver

Inherits:
Object
  • Object
show all
Defined in:
lib/instana/backend/host_agent_reporting_observer.rb

Overview

Process which is responsible for reporting metrics and tracing to the local agent

Since:

  • 1.197.0

Constant Summary collapse

ENTITY_DATA_URL =

Since:

  • 1.197.0

'/com.instana.plugin.ruby.%i'.freeze
RESPONSE_DATA_URL =

Since:

  • 1.197.0

'/com.instana.plugin.ruby/response.%i?messageId=%s'.freeze
TRACES_DATA_URL =

Since:

  • 1.197.0

"/com.instana.plugin.ruby/traces.%i".freeze
TRACE_METRICS_URL =

Since:

  • 1.197.0

"/tracermetrics".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, discovery, logger: ::Instana.logger, timer_class: Concurrent::TimerTask, processor: ::Instana.processor) ⇒ HostAgentReportingObserver

Returns a new instance of HostAgentReportingObserver.

Parameters:

  • client (RequestClient)

    used to make requests to the backend

  • discovery (Concurrent::Atom)

    object used to store discovery response in

Since:

  • 1.197.0



18
19
20
21
22
23
24
25
# File 'lib/instana/backend/host_agent_reporting_observer.rb', line 18

def initialize(client, discovery, logger: ::Instana.logger, timer_class: Concurrent::TimerTask, processor: ::Instana.processor)
  @client = client
  @discovery = discovery
  @logger = logger
  @report_timer = timer_class.new(execution_interval: 1, run_now: true) { report_to_backend }
  @nonce = Time.now
  @processor = processor
end

Instance Attribute Details

#report_timerObject (readonly)

Since:

  • 1.197.0



14
15
16
# File 'lib/instana/backend/host_agent_reporting_observer.rb', line 14

def report_timer
  @report_timer
end

Instance Method Details

#update(time, _old_version, new_version) ⇒ Object

Since:

  • 1.197.0



27
28
29
30
31
32
# File 'lib/instana/backend/host_agent_reporting_observer.rb', line 27

def update(time, _old_version, new_version)
  return unless time > @nonce

  @nonce = time
  new_version.nil? ? @report_timer.shutdown : @report_timer.execute
end