Module: SolidObjects::Instrumentation
- Included in:
- SolidObjects
- Defined in:
- lib/solid_objects/instrumentation.rb,
sig/generated/lib/solid_objects/instrumentation.rbs
Instance Method Summary collapse
- #instrument(event, **payload) {|arg0| ... } ⇒ Object
- #instrument_after_commit(event, **payload) ⇒ void
- #log_instrumentation_failure(event, error) ⇒ void
- #report_instrumentation_failure(event, error) ⇒ void
Instance Method Details
#instrument(event, **payload) {|arg0| ... } ⇒ Object
6 7 8 |
# File 'lib/solid_objects/instrumentation.rb', line 6 def instrument(event, **payload, &block) ActiveSupport::Notifications.instrument("solid_objects.#{event}", payload, &block) end |
#instrument_after_commit(event, **payload) ⇒ void
This method returns an undefined value.
11 12 13 14 15 |
# File 'lib/solid_objects/instrumentation.rb', line 11 def instrument_after_commit(event, **payload) instrument(event, **payload) rescue => error report_instrumentation_failure(event, error) end |
#log_instrumentation_failure(event, error) ⇒ void
This method returns an undefined value.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/solid_objects/instrumentation.rb', line 31 def log_instrumentation_failure(event, error) SolidObjects.configuration.logger.error( { event: "solid_objects.instrumentation.failed", instrumentation_event: "solid_objects.#{event}", error_class: error.class.name } ) rescue nil end |
#report_instrumentation_failure(event, error) ⇒ void
This method returns an undefined value.
20 21 22 23 24 25 26 27 28 |
# File 'lib/solid_objects/instrumentation.rb', line 20 def report_instrumentation_failure(event, error) instrument( :"instrumentation.failed", instrumentation_event: "solid_objects.#{event}", error_class: error.class.name ) rescue => failure log_instrumentation_failure(event, failure) end |