mirror of
https://github.com/bugsink/bugsink.git
synced 2025-12-21 13:00:13 -06:00
server-side timestamp fixes (untested)
This commit is contained in:
@@ -52,7 +52,7 @@ class PeriodCounterRegistry(object):
|
||||
gte_threshold=vbc.volume,
|
||||
when_becomes_true=create_unmute_issue_handler(issue.id),
|
||||
tup=now_tup,
|
||||
auto_remove=True, # (at least when it's 'first time'... but this may be the only thing we support)
|
||||
auto_remove=True, # unmuting is needed only once; hence auto_remove to avoid recurring unmute calls
|
||||
)
|
||||
|
||||
return by_project, by_issue
|
||||
|
||||
@@ -47,7 +47,7 @@ class Event(models.Model):
|
||||
# https://develop.sentry.dev/sdk/event-payloads/types/ (more up-to-date and complete)
|
||||
|
||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) # This ID is internal to bugsink
|
||||
server_side_timestamp = models.DateTimeField(db_index=True, blank=False, null=False) # TODO set this on-ingest
|
||||
server_side_timestamp = models.DateTimeField(db_index=True, blank=False, null=False)
|
||||
|
||||
# > Required. Hexadecimal string representing a uuid4 value. The length is exactly 32 characters. Dashes are not
|
||||
# > allowed. Has to be lowercase.
|
||||
@@ -147,11 +147,12 @@ class Event(models.Model):
|
||||
return "/events/event/%s/download/" % self.id
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, project, parsed_data, debug_info):
|
||||
def from_json(cls, project, parsed_data, server_side_timestamp, debug_info):
|
||||
event, created = cls.objects.get_or_create( # NOTE immediate creation... is this what we want?
|
||||
event_id=parsed_data["event_id"],
|
||||
project=project,
|
||||
defaults={
|
||||
'server_side_timestamp': server_side_timestamp,
|
||||
'data': json.dumps(parsed_data),
|
||||
|
||||
'timestamp': parse_timestamp(parsed_data["timestamp"]),
|
||||
|
||||
@@ -72,7 +72,7 @@ class BaseIngestAPIView(APIView):
|
||||
|
||||
debug_info = request.META.get("HTTP_X_BUGSINK_DEBUGINFO", "")
|
||||
|
||||
event, event_created = Event.from_json(project, event_data, debug_info)
|
||||
event, event_created = Event.from_json(project, event_data, now, debug_info)
|
||||
if not event_created:
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user