require 'active_support/concern' module Roqua module Probes module BaseProbe extend ActiveSupport::Concern class_methods do def enable new.tap do |probe| probe_sym = probe.class.to_s.to_sym Appsignal::Minutely.probes.register(probe_sym, probe) unless Appsignal::Minutely.probes[probe_sym] end end end # do not override me, implement probes by implementing the #run method def call run Appsignal.increment_counter("probe.call.completed", 1, probe_name: self.class.name.demodulize.underscore) rescue => e Appsignal.send_error(e) { _1.set_namespace(Appsignal::Transaction::BACKGROUND_JOB) } raise end end end end