Class: ErrorTracking::CollectErrorService
- Inherits:
-
BaseService
- Object
- BaseService
- ErrorTracking::CollectErrorService
- Includes:
- Gitlab::Utils::StrongMemoize
- Defined in:
- app/services/error_tracking/collect_error_service.rb
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
Methods included from Gitlab::Utils::StrongMemoize
#clear_memoization, #strong_memoize, #strong_memoized?
Methods inherited from BaseService
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
This class inherits a constructor from BaseService
Instance Method Details
#execute ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/services/error_tracking/collect_error_service.rb', line 7 def execute # Error is a way to group events based on common data like name or cause # of exception. We need to keep a sane balance here between taking too little # and too much data into group logic. error = project.error_tracking_errors.report_error( name: exception['type'], # Example: ActionView::MissingTemplate description: exception['value'], # Example: Missing template posts/show in... actor: actor, # Example: PostsController#show platform: event['platform'], # Example: ruby timestamp: ) # The payload field contains all the data on error including stacktrace in jsonb. # Together with occurred_at these are 2 main attributes that we need to save here. error.events.create!( environment: event['environment'], description: exception['value'], level: event['level'], occurred_at: , payload: event ) end |