@@ -228,13 +228,17 @@ def crons_task_success(sender, **kwargs):
228
228
229
229
monitor_config = headers .get ("sentry-monitor-config" , {})
230
230
231
- start_timestamp_s = float ( headers [ "sentry-monitor-start-timestamp-s" ] )
231
+ start_timestamp_s = headers . get ( "sentry-monitor-start-timestamp-s" )
232
232
233
233
capture_checkin (
234
234
monitor_slug = headers ["sentry-monitor-slug" ],
235
235
monitor_config = monitor_config ,
236
236
check_in_id = headers ["sentry-monitor-check-in-id" ],
237
- duration = _now_seconds_since_epoch () - start_timestamp_s ,
237
+ duration = (
238
+ _now_seconds_since_epoch () - float (start_timestamp_s )
239
+ if start_timestamp_s
240
+ else None
241
+ ),
238
242
status = MonitorStatus .OK ,
239
243
)
240
244
@@ -249,13 +253,17 @@ def crons_task_failure(sender, **kwargs):
249
253
250
254
monitor_config = headers .get ("sentry-monitor-config" , {})
251
255
252
- start_timestamp_s = float ( headers [ "sentry-monitor-start-timestamp-s" ] )
256
+ start_timestamp_s = headers . get ( "sentry-monitor-start-timestamp-s" )
253
257
254
258
capture_checkin (
255
259
monitor_slug = headers ["sentry-monitor-slug" ],
256
260
monitor_config = monitor_config ,
257
261
check_in_id = headers ["sentry-monitor-check-in-id" ],
258
- duration = _now_seconds_since_epoch () - start_timestamp_s ,
262
+ duration = (
263
+ _now_seconds_since_epoch () - float (start_timestamp_s )
264
+ if start_timestamp_s
265
+ else None
266
+ ),
259
267
status = MonitorStatus .ERROR ,
260
268
)
261
269
@@ -270,12 +278,16 @@ def crons_task_retry(sender, **kwargs):
270
278
271
279
monitor_config = headers .get ("sentry-monitor-config" , {})
272
280
273
- start_timestamp_s = float ( headers [ "sentry-monitor-start-timestamp-s" ] )
281
+ start_timestamp_s = headers . get ( "sentry-monitor-start-timestamp-s" )
274
282
275
283
capture_checkin (
276
284
monitor_slug = headers ["sentry-monitor-slug" ],
277
285
monitor_config = monitor_config ,
278
286
check_in_id = headers ["sentry-monitor-check-in-id" ],
279
- duration = _now_seconds_since_epoch () - start_timestamp_s ,
287
+ duration = (
288
+ _now_seconds_since_epoch () - float (start_timestamp_s )
289
+ if start_timestamp_s
290
+ else None
291
+ ),
280
292
status = MonitorStatus .ERROR ,
281
293
)
0 commit comments