Class: Sentry::CheckInEvent
Constant Summary collapse
- TYPE =
"check_in"
- VALID_STATUSES =
%i[ok in_progress error]
Constants inherited from Event
Event::MAX_MESSAGE_SIZE_IN_BYTES, Event::SERIALIZEABLE_ATTRIBUTES, Event::SKIP_INSPECTION_ATTRIBUTES, Event::WRITER_ATTRIBUTES
Instance Attribute Summary collapse
-
#check_in_id ⇒ String
uuid to identify this check-in.
-
#duration ⇒ Integer?
Duration of this check since it has started in seconds.
-
#monitor_config ⇒ Cron::MonitorConfig?
Monitor configuration to support upserts.
-
#monitor_slug ⇒ String
Identifier of the monitor for this check-in.
-
#status ⇒ Symbol
Status of this check-in.
Attributes inherited from Event
#attachments, #dynamic_sampling_context, #request
Instance Method Summary collapse
-
#initialize(slug:, status:, duration: nil, monitor_config: nil, check_in_id: nil, **options) ⇒ CheckInEvent
constructor
A new instance of CheckInEvent.
- #to_hash ⇒ Hash
Methods inherited from Event
#configuration, #level=, #rack_env=, #timestamp=, #to_json_compatible
Constructor Details
#initialize(slug:, status:, duration: nil, monitor_config: nil, check_in_id: nil, **options) ⇒ CheckInEvent
Returns a new instance of CheckInEvent.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/sentry/check_in_event.rb', line 32 def initialize( slug:, status:, duration: nil, monitor_config: nil, check_in_id: nil, ** ) super(**) self.monitor_slug = slug self.status = status self.duration = duration self.monitor_config = monitor_config self.check_in_id = check_in_id || SecureRandom.uuid.delete("-") end |
Instance Attribute Details
#check_in_id ⇒ String
uuid to identify this check-in.
12 13 14 |
# File 'lib/sentry/check_in_event.rb', line 12 def check_in_id @check_in_id end |
#duration ⇒ Integer?
Duration of this check since it has started in seconds.
20 21 22 |
# File 'lib/sentry/check_in_event.rb', line 20 def duration @duration end |
#monitor_config ⇒ Cron::MonitorConfig?
Monitor configuration to support upserts.
24 25 26 |
# File 'lib/sentry/check_in_event.rb', line 24 def monitor_config @monitor_config end |
#monitor_slug ⇒ String
Identifier of the monitor for this check-in.
16 17 18 |
# File 'lib/sentry/check_in_event.rb', line 16 def monitor_slug @monitor_slug end |
#status ⇒ Symbol
Status of this check-in.
28 29 30 |
# File 'lib/sentry/check_in_event.rb', line 28 def status @status end |
Instance Method Details
#to_hash ⇒ Hash
50 51 52 53 54 55 56 57 58 |
# File 'lib/sentry/check_in_event.rb', line 50 def to_hash data = super data[:check_in_id] = check_in_id data[:monitor_slug] = monitor_slug data[:status] = status data[:duration] = duration if duration data[:monitor_config] = monitor_config.to_hash if monitor_config data end |