Module: D13n::Metric::AppHttpMetric::In

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

Instance Method Summary collapse

Methods included from Namespace

#endpoint_metric, #endpoint_status_metric, #get_service_endpoint, #http_basic_tags, #http_error_tags, #http_status_tags, #service_error_metric, #service_metric

Instance Method Details

#finish(state, t0, node, request, response) ⇒ Object



96
97
98
# File 'lib/d13n/metric/metrics/app_http_metric.rb', line 96

def finish(state, t0, node, request, response)
  'finish'
end

#process(*args, &block) ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/d13n/metric/metrics/app_http_metric.rb', line 72

def process(*args, &block)
  return yield unless Helper.http_in_tracable?

  state = D13n::Metric::StreamState.st_get
  state.request = metric_request(args)
  
  trace_options = args.last.is_a?(Hash) ? args.last : {}
  category = trace_options[:category] || :action
  stream_options = create_stream_options(trace_options, category, state)

  t0 = Time.now
  begin
    node = start(state, t0, request)
    response = yield
  ensure
    finish(state, t0, node, request, response)
  end
  return response
end

#start(state, t0, request) ⇒ Object



92
93
94
# File 'lib/d13n/metric/metrics/app_http_metric.rb', line 92

def start(state, t0, request)
  'start'
end