lib/elastic_apm/agent.rb in elastic-apm-0.6.2 vs lib/elastic_apm/agent.rb in elastic-apm-0.7.0
- old
+ new
@@ -1,13 +1,14 @@
# frozen_string_literal: true
require 'elastic_apm/naively_hashable'
require 'elastic_apm/context_builder'
require 'elastic_apm/error_builder'
+require 'elastic_apm/stacktrace_builder'
require 'elastic_apm/error'
require 'elastic_apm/http'
-require 'elastic_apm/injectors'
+require 'elastic_apm/spies'
require 'elastic_apm/serializers'
require 'elastic_apm/timed_worker'
module ElasticAPM
# rubocop:disable Metrics/ClassLength
@@ -56,30 +57,32 @@
!!@instance
end
def initialize(config)
@config = config
+ @http = Http.new(config)
@messages = Queue.new
@pending_transactions = Queue.new
- @http = Http.new(config)
- @instrumenter = Instrumenter.new(config, self)
- @context_builder = ContextBuilder.new(config)
- @error_builder = ErrorBuilder.new(config)
+ @instrumenter = Instrumenter.new(self)
+
+ @context_builder = ContextBuilder.new(self)
+ @error_builder = ErrorBuilder.new(self)
+ @stacktrace_builder = StacktraceBuilder.new(self)
end
attr_reader :config, :messages, :pending_transactions, :instrumenter,
- :context_builder, :http
+ :context_builder, :stacktrace_builder, :http
def start
debug '[%s] Starting agent, reporting to %s', VERSION, config.server_url
@instrumenter.start
- config.enabled_injectors.each do |lib|
- require "elastic_apm/injectors/#{lib}"
+ config.enabled_spies.each do |lib|
+ require "elastic_apm/spies/#{lib}"
end
self
end
@@ -92,9 +95,11 @@
end
at_exit do
stop
end
+
+ # queues
def enqueue_transaction(transaction)
boot_worker unless worker_running?
pending_transactions.push(transaction)