Sha256: 263ad0d1953f6f416f13f21aec60e9ef9d4787f855e349b239b87c7bd6e79cc7
Contents?: true
Size: 897 Bytes
Versions: 2
Compression:
Stored size: 897 Bytes
Contents
# frozen_string_literal: true module ElasticAPM # @api private class Worker include Log # @api private class StopMessage; end # @api private Request = Struct.new(:path, :payload) do # require all params def initialize(path, payload) super end end def initialize(config, queue, http: Http) @config = config @adapter = http.new(config) @queue = queue end attr_reader :config def run_forever loop do while (item = @queue.pop) case item when Request process item when StopMessage Thread.exit end end end end def process(item) @adapter.post(item.path, item.payload) rescue ::Exception => e fatal 'Failed posting: %s', e.inspect debug e.backtrace.join("\n") nil end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
elastic-apm-0.2.0 | lib/elastic_apm/worker.rb |
elastic-apm-0.1.0 | lib/elastic_apm/worker.rb |