Module: D13n::Metric::AppStateMetric::ExceptionProcessor

Includes:
Namespace
Defined in:
lib/d13n/metric/metrics/app_state_metric.rb

Instance Method Summary collapse

Methods included from Namespace

#exception_metric_tags, #gem_metric_tags

Instance Method Details

#collect_exception_count(exception, opts, count = 1, rate = 1.0) ⇒ Object



68
69
70
# File 'lib/d13n/metric/metrics/app_state_metric.rb', line 68

def collect_exception_count(exception, opts, count=1, rate=1.0)
  @collector.increment(metric_name('count'), count, sample_rate: rate, tags: exception_metric_tags(exception,opts))
end

#finish(exception) ⇒ Object



62
63
64
65
66
# File 'lib/d13n/metric/metrics/app_state_metric.rb', line 62

def finish(exception)
  metric_data = D13n::Metric::StreamState.default_metric_data
  @opts.merge!(metric_data)
  collect_exception_count(exception, @opts)
end

#processObject



51
52
53
54
55
56
57
58
59
60
# File 'lib/d13n/metric/metrics/app_state_metric.rb', line 51

def process
  return yield unless Helper.exception_tracable?

  begin
    exception = yield
  ensure
    finish(exception)
  end
  return exception
end