Module: Fiveruns::Dash::Rails::ActionContext::ClassMethods

Defined in:
lib/fiveruns/dash/rails.rb

Instance Method Summary collapse

Instance Method Details

#process_with_fiveruns_dash_tracing(*args, &block) ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/fiveruns/dash/rails.rb', line 112

def process_with_fiveruns_dash_tracing(*args, &block)
  operation = lambda { process_without_fiveruns_dash_tracing(*args, &block) }
  params = args.first.parameters
  # TODO/FIXME: For now, we simply look for a 'trace' parameter to select requests to trace; in the
  #             future, we need a more advanced sampling mechanism (some operation in a recipe a
  #             request must pass, or selection criteria returned in a response from the service)
  trace_context = ['action', "#{params['controller'].camelize}Controller##{params['action']}"]
  if ::Fiveruns::Dash.trace_contexts.include?(trace_context)
    ::Fiveruns::Dash.session.trace(trace_context) do
      operation.call
    end
  else
    operation.call
  end
end