module Smooth::Command::Instrumented
Public Class Methods
included(base)
click to toggle source
# File lib/smooth/command/instrumented.rb, line 4 def self.included(base) base.extend(ClassMethods) base.enable_event_tracking! # if Smooth.config.enable_event_tracking_by_default? end
Public Instance Methods
run_with_instrumentation(event_prefix = nil)
click to toggle source
# File lib/smooth/command/instrumented.rb, line 32 def run_with_instrumentation(event_prefix = nil) outcome = run_with_outcome event_prefix = "#{ event_prefix }." if event_prefix if outcome.success? result = outcome.result track_event("#{ event_prefix }#{ event_namespace }", result: result, inputs: inputs, current_user: current_user) outcome else track_event("errors/#{ event_prefix }#{ event_namespace }", errors: outcome.errors, inputs: inputs, current_user: current_user) outcome end end
run_with_outcome()
click to toggle source
# File lib/smooth/command/instrumented.rb, line 47 def run_with_outcome return validation_outcome if has_errors? validation_outcome(execute) end