Sha256: 5d263b119f0e0c8e2fec5f38ee33b8fcd753c02ccce7b60fa2e8b60a609ad53f
Contents?: true
Size: 1.45 KB
Versions: 2
Compression:
Stored size: 1.45 KB
Contents
require 'sqreen/graft/hook' require 'sqreen/ecosystem_integration/around_callbacks' module Sqreen class EcosystemIntegration module InstrumentationService class << self # @param [String] module_name # @param [String] method in form A::B#c or A::B.c # @param [Hash{Symbol=>Proc}] spec def instrument(module_name, method, spec) hook = Sqreen::Graft::Hook[method].add do if spec[:before] cb = AroundCallbacks.wrap_instrumentation_hook(module_name, 'pre', spec[:before]) tag = "weave,rule=ecosystem_#{module_name}" before(tag, flow: true, &cb) end if spec[:after] cb = AroundCallbacks.wrap_instrumentation_hook(module_name, 'post', spec[:after]) tag = "weave,rule=ecosystem_#{module_name}" after(tag, flow: true, &cb) end if spec[:raised] cb = AroundCallbacks.wrap_instrumentation_hook(module_name, 'failing', spec[:raised]) tag = "weave,rule=ecosystem_#{module_name}" raised(tag, flow: true, &cb) end if spec[:ensured] cb = AroundCallbacks.wrap_instrumentation_hook(module_name, 'finally', spec[:ensured]) tag = "weave,rule=ecosystem_#{module_name}" ensured(tag, flow: true, &cb) end end hook.install end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sqreen-1.21.0.beta3-java | lib/sqreen/ecosystem_integration/instrumentation_service.rb |
sqreen-1.21.0.beta3 | lib/sqreen/ecosystem_integration/instrumentation_service.rb |