Class: Sqreen::EcosystemIntegration

Inherits:
Object
  • Object
show all
Includes:
Log::Loggable
Defined in:
lib/sqreen/ecosystem_integration.rb,
lib/sqreen/ecosystem_integration/around_callbacks.rb,
lib/sqreen/ecosystem_integration/signal_consumption.rb,
lib/sqreen/ecosystem_integration/instrumentation_service.rb,
lib/sqreen/ecosystem_integration/request_lifecycle_tracking.rb

Overview

This class is the interface through which the agent interacts with the ecosystem.

Other classes in the EcosystemIntegration module implement the functionality that the ecosystem requires in order to deliver data to the agent and to be informed by the agent of certain key events (see Sqreen::Ecosystem::DispatchTable).

Defined Under Namespace

Modules: AroundCallbacks, InstrumentationService Classes: RequestLifecycleTracking, SignalConsumption

Instance Method Summary collapse

Methods included from Log::Loggable

included, #logger

Constructor Details

#initialize(framework, queue) ⇒ EcosystemIntegration

Returns a new instance of EcosystemIntegration.

Parameters:

  • framework (Sqreen::Framework)


25
26
27
28
29
30
# File 'lib/sqreen/ecosystem_integration.rb', line 25

def initialize(framework, queue)
  @framework = framework
  @queue = queue
  @request_lifecycle = RequestLifecycleTracking.new
  @online = false
end

Instance Method Details

#disableObject

Raises:



45
46
47
# File 'lib/sqreen/ecosystem_integration.rb', line 45

def disable
  raise NotImplementedYet
end

#handle_tracing_command(trace_id_prefix, scopes_config) ⇒ Object



62
63
64
65
66
# File 'lib/sqreen/ecosystem_integration.rb', line 62

def handle_tracing_command(trace_id_prefix, scopes_config)
  return unless @online

  Ecosystem.configure_sampling(trace_id_prefix, scopes_config)
end

#initObject



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/sqreen/ecosystem_integration.rb', line 32

def init
  raise 'already initialized' if @online

  setup_dispatch_table
  Ecosystem.init
  logger.info 'Ecosystem successfully initialized'
  @online = true
rescue ::Exception => e # rubocop:disable Lint/RescueException
  logger.warn { "Error initializing Ecosystem: #{e.message}" }
  logger.debug { e.backtrace.map { |x| "  #{x}" }.join("\n") }
  Sqreen::RemoteException.record(e)
end

#request_endObject



56
57
58
59
60
# File 'lib/sqreen/ecosystem_integration.rb', line 56

def request_end
  return unless @online

  Ecosystem.end_transaction
end

#request_start(rack_request) ⇒ Object



49
50
51
52
53
54
# File 'lib/sqreen/ecosystem_integration.rb', line 49

def request_start(rack_request)
  return unless @online

  Ecosystem.start_transaction
  @request_lifecycle.notify_request_start(rack_request)
end