Class: Sentry::CheckInEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/sentry/check_in_event.rb

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

Attributes inherited from Event

#attachments, #dynamic_sampling_context, #request

Instance Method Summary collapse

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,
  **options
)
  super(**options)

  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_idString

uuid to identify this check-in.

Returns:

  • (String)


12
13
14
# File 'lib/sentry/check_in_event.rb', line 12

def check_in_id
  @check_in_id
end

#durationInteger?

Duration of this check since it has started in seconds.

Returns:

  • (Integer, nil)


20
21
22
# File 'lib/sentry/check_in_event.rb', line 20

def duration
  @duration
end

#monitor_configCron::MonitorConfig?

Monitor configuration to support upserts.

Returns:



24
25
26
# File 'lib/sentry/check_in_event.rb', line 24

def monitor_config
  @monitor_config
end

#monitor_slugString

Identifier of the monitor for this check-in.

Returns:

  • (String)


16
17
18
# File 'lib/sentry/check_in_event.rb', line 16

def monitor_slug
  @monitor_slug
end

#statusSymbol

Status of this check-in.

Returns:

  • (Symbol)


28
29
30
# File 'lib/sentry/check_in_event.rb', line 28

def status
  @status
end

Instance Method Details

#to_hashHash

Returns:

  • (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