Method: OneApm::Agent::CrossAppTracing.metrics_for

Defined in:
lib/one_apm/agent/cross_app/cross_app_tracing.rb

.metrics_for(request, response) ⇒ Object

Return the set of metric names that correspond to the given request and response. response may be nil in the case that the request produced an error without ever receiving an HTTP response.



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/one_apm/agent/cross_app/cross_app_tracing.rb', line 211

def metrics_for( request, response )
  metrics = common_metrics( request )

  if response && response_is_crossapp?( response )
    begin
      metrics.delete_if{|m| m == "External/#{request.host}/all"}
      metrics.concat metrics_for_crossapp_response( request, response )
    rescue => err
      # Fall back to regular metrics if there's a problem with x-process metrics
      OneApm::Manager.logger.debug "%p while fetching x-process metrics: %s" %
        [ err.class, err.message ]
      metrics.concat metrics_for_regular_request( request )
    end
  else
    metrics.concat metrics_for_regular_request( request )
  end

  return metrics
end