Sha256: 2297f6cd5297cd391432b633d804deb61b4b0bf9175f25446b201d4b0567eb30
Contents?: true
Size: 981 Bytes
Versions: 31
Compression:
Stored size: 981 Bytes
Contents
require 'active_support/core_ext/module/aliasing' require 'roqua/support/log_wrapper' module Roqua module Support module Instrumentation def with_instrumentation(message, options = {}) started_at = Time.now.to_f Roqua.logger.info("#{message}:started", options) value = yield finished_at = Time.now.to_f duration = finished_at - started_at Roqua.logger.info("#{message}:finished", {duration: duration}.merge(options)) Roqua.stats.submit("#{message}.finished", 1) Roqua.stats.submit("#{message}.duration", duration) value rescue => e Roqua.logger.error("#{message}:failed", {exception: e.class.name, message: e.message}.merge(options)) Roqua.stats.submit("#{message}.failed", 1) raise end def eventlog Roqua.logger end end end # Roqua::Logging is deprecated, this will keep it alive for now Logging = Support::Instrumentation end
Version data entries
31 entries across 31 versions & 1 rubygems