Sha256: daa747884fc2c93e15f3db80026e327bc1022ae812b667326ff9e8e0edd7bccb
Contents?: true
Size: 1.13 KB
Versions: 24
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true module ElasticAPM # @api private module Spies # @api private class RakeSpy # rubocop:disable Metrics/AbcSize, Metrics/MethodLength def install ::Rake::Task.class_eval do alias execute_without_apm execute def execute(*args) agent = ElasticAPM.start unless agent && agent.config.instrumented_rake_tasks.include?(name) return execute_without_apm(*args) end transaction = ElasticAPM.start_transaction("Rake::Task[#{name}]", 'Rake') begin result = execute_without_apm(*args) transaction.result = 'success' if transaction rescue StandardError => e transaction.result = 'error' if transaction ElasticAPM.report(e) raise ensure ElasticAPM.end_transaction ElasticAPM.stop end result end end end # rubocop:enable Metrics/AbcSize, Metrics/MethodLength end register 'Rake::Task', 'rake', RakeSpy.new end end
Version data entries
24 entries across 24 versions & 1 rubygems