Class: StackifyRubyAPM::Spies::YellSpy Private
- Inherits:
-
Object
- Object
- StackifyRubyAPM::Spies::YellSpy
- Defined in:
- lib/stackify_apm/spies/yell.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- SEVERITIES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
['DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL', 'UNKNOWN'].freeze
Instance Method Summary collapse
- #install ⇒ Object private
Instance Method Details
#install ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/stackify_apm/spies/yell.rb', line 12 def install Yell::Logger.module_eval do alias_method 'add_without_apm', 'add' # Log messages def add(, *, &block) return add_without_apm(, *, &block) unless StackifyRubyAPM.current_transaction begin name = 'yell;' type = 'ext.yell' = [] exception = [] .each { |msg| case msg when ::String .push(msg) when ::Exception .push(msg.) exception.push("(#{ msg.class })\n#{ msg.backtrace.join("\n") if msg.backtrace }") else .push(msg.inspect) end } ctx = Span::Context.new( CATEGORY: 'Log', SUBCATEGORY: 'Yell', LEVEL: SEVERITIES[.severity], MESSAGE: .to_s, PREFIX: 'TRUE' ) if exception.length > 0 ctx.EXCEPTION = exception.to_s end rescue Exception => e StackifyRubyAPM.agent.error "[YellSpy] Error: creating span context." StackifyRubyAPM.agent.error "[YellSpy] #{e.inspect}" return add_without_apm(, *, &block) end StackifyRubyAPM.span name, type, context: ctx do add_without_apm(, *, &block) end end end end |