Class: RailsErrorDashboard::Services::PagerdutyPayloadBuilder
- Inherits:
-
Object
- Object
- RailsErrorDashboard::Services::PagerdutyPayloadBuilder
- Defined in:
- lib/rails_error_dashboard/services/pagerduty_payload_builder.rb
Overview
Pure algorithm: Build PagerDuty Events API v2 payload
No HTTP calls — accepts error data and routing key, returns a Hash.
Class Method Summary collapse
-
.call(error_log, routing_key:) ⇒ Hash
PagerDuty Events API v2 payload.
Class Method Details
.call(error_log, routing_key:) ⇒ Hash
Returns PagerDuty Events API v2 payload.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rails_error_dashboard/services/pagerduty_payload_builder.rb', line 16 def self.call(error_log, routing_key:) { routing_key: routing_key, event_action: "trigger", payload: { summary: "Critical Error: #{error_log.error_type} in #{error_log.platform}", severity: "critical", source: NotificationHelpers.error_source(error_log), component: error_log.controller_name || "Unknown", group: error_log.error_type, class: error_log.error_type, custom_details: { message: error_log., controller: error_log.controller_name, action: error_log.action_name, platform: error_log.platform, occurrences: error_log.occurrence_count, first_seen_at: error_log.first_seen_at&.iso8601, last_seen_at: error_log.last_seen_at&.iso8601, request_url: error_log.request_url, backtrace: NotificationHelpers.extract_backtrace(error_log.backtrace, 10), error_id: error_log.id } }, links: [ { href: NotificationHelpers.dashboard_url(error_log), text: "View in Error Dashboard" } ], client: "Rails Error Dashboard", client_url: NotificationHelpers.dashboard_url(error_log) } end |