Skip to content

Commit 977d932

Browse files
authored
fix(uptime): Make sure timestamps are in actual timestamp format when returning from various EAP endpoints (#97515)
This makes them consistent with other span like data <!-- Describe your PR here. -->
1 parent 1d769f6 commit 977d932

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/sentry/snuba/trace.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,10 +412,8 @@ def get_value(attr_name: str, attr_value: AttributeValue):
412412
if resolved_val is not None:
413413
additional_attrs[resolved_column.public_alias] = resolved_val
414414

415-
span["start_timestamp"] = datetime.fromtimestamp(scheduled_check_time_us / 1_000_000)
416-
span["end_timestamp"] = datetime.fromtimestamp(
417-
(scheduled_check_time_us + check_duration_us) / 1_000_000
418-
)
415+
span["start_timestamp"] = scheduled_check_time_us / 1_000_000
416+
span["end_timestamp"] = (scheduled_check_time_us + check_duration_us) / 1_000_000
419417
span["duration"] = check_duration_us / 1_000.0
420418
description = f"Uptime Check [{check_status}] - {request_url}"
421419
if http_status_code:

tests/snuba/api/endpoints/test_organization_trace.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import logging
2-
from datetime import datetime
32
from unittest import mock
43
from uuid import uuid4
54

@@ -61,8 +60,8 @@ def test_basic_uptime_item_serialization(self):
6160
assert result["duration"] == 500.0
6261
assert result["name"] == "https://example.com"
6362
assert result["description"] == "Uptime Check [success] - https://example.com (200)"
64-
assert result["start_timestamp"] == datetime.fromtimestamp(1700000000)
65-
assert result["end_timestamp"] == datetime.fromtimestamp(1700000000.5)
63+
assert result["start_timestamp"] == 1700000000
64+
assert result["end_timestamp"] == 1700000000.5
6665
attrs = result["additional_attributes"]
6766
assert attrs["guid"] == "check-123"
6867
assert attrs["check_status"] == "success"

0 commit comments

Comments
 (0)