Class: CodeSunset::Instrumentation

Inherits:
Object
  • Object
show all
Defined in:
lib/code_sunset/instrumentation.rb

Constant Summary collapse

EVENT_NAME =
"code_sunset.hit".freeze

Class Method Summary collapse

Class Method Details

.hit(feature_key, **attrs) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/code_sunset/instrumentation.rb', line 6

def hit(feature_key, **attrs)
  payload = CodeSunset::EventPayload.build(feature_key, attrs)
  return unless payload

  ActiveSupport::Notifications.instrument(EVENT_NAME, payload)
rescue StandardError => error
  CodeSunset.log_error("instrumentation", error)
  nil
end