Module: TingYun::Agent::Collector::ErrorCollector::Tag
- Included in:
- TingYun::Agent::Collector::ErrorCollector
- Defined in:
- lib/ting_yun/agent/collector/error_collector.rb
Overview
tag the exception,avoid the same exception record multiple times in the middlwars and other point
Constant Summary collapse
- EXCEPTION_TAG_IVAR =
:'@__ty_seen_exception'
Instance Method Summary collapse
Instance Method Details
#exception_tagged?(exception) ⇒ Boolean
36 37 38 |
# File 'lib/ting_yun/agent/collector/error_collector.rb', line 36 def exception_tagged?(exception) exception.instance_variable_defined?(EXCEPTION_TAG_IVAR) end |
#tag_exception(exception) ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/ting_yun/agent/collector/error_collector.rb', line 28 def tag_exception(exception) begin exception.instance_variable_set(EXCEPTION_TAG_IVAR, true) rescue => e TingYun::Agent.logger.warn("Failed to tag exception: #{exception}: ", e) end end |