lib/smooth/command/instrumented.rb in smooth-2.0.1 vs lib/smooth/command/instrumented.rb in smooth-2.0.2
- old
+ new
@@ -27,18 +27,20 @@
def disable_event_tracking!
send(:include, Restored)
end
end
- def run_with_instrumentation
+ 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_namespace }", result: result, inputs: inputs)
- result
+ track_event("#{ event_prefix }#{ event_namespace }", result: result, inputs: inputs, current_user: current_user)
+ outcome
else
- track_event("errors/#{ event_namespace }", errors: outcome.errors, inputs: inputs)
+ track_event("errors/#{ event_prefix }#{ event_namespace }", errors: outcome.errors, inputs: inputs, current_user: current_user)
outcome
end
end
def run_with_outcome