Skip to content

imp(workers): move timestamp out of event payload#425

Merged
e11sy merged 27 commits intomasterfrom
move-timestamp-to-event-level
Aug 4, 2025
Merged

imp(workers): move timestamp out of event payload#425
e11sy merged 27 commits intomasterfrom
move-timestamp-to-event-level

Conversation

@e11sy
Copy link
Copy Markdown
Member

@e11sy e11sy commented Jul 11, 2025

Problems

  • Logic mismatch of type names
  • timestamp is inside of the payload of the events and repetitions
  • worker tasks bad fields naming

Solution

  • Update @hawk.so/types version and use new types (CatcherMessageType etc)
  • Move timestamp out of event and repetitions payload
  • Add data convertor (as migration) that adds timestamp to all events and repetitions, which don't have one
  • Improve sentry worker types since we moved to new Types format in @hawk.so/types: 0.1.32, removed type 'external/sentry' and now sentry worker returns events with type 'errors/javascript' | 'errors/default'

Note

This is part of the work on moving timestamp out of payload check other prs:
garage api collector types

Comment thread lib/event-worker.ts Outdated
Comment thread lib/event-worker.ts Outdated
Comment thread migrations/20250707160120-move-timestamp-to-event-level.js Outdated
Comment thread lib/utils/unsafeFields.ts
* Repetition includes delta field, grouped event includes payload
*/
if ('delta' in event) {
if (event.delta === undefined) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment pls

Comment thread workers/archiver/tests/index.test.ts Outdated
Comment thread workers/archiver/tests/index.test.ts Outdated
Comment thread workers/default/src/index.ts
Comment thread workers/grouper/src/index.ts Outdated
Comment thread workers/grouper/tests/index.test.ts Outdated
Comment thread workers/grouper/tests/index.test.ts Outdated
Comment thread workers/javascript/types/javascript-event-worker-task.d.ts Outdated
Comment thread workers/sentry/src/index.ts Outdated
Comment thread workers/sentry/tests/converter.test.ts
const docsToUpdate = collection.find(
{ timestamp: { $exists: false } },
{ projection: { _id: 1, 'payload.timestamp': 1 } }
).limit(10000);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to constant


// Convert events
let i = 1;
let total = 1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improve naming

@e11sy e11sy merged commit 393d00a into master Aug 4, 2025
4 checks passed
@e11sy e11sy deleted the move-timestamp-to-event-level branch August 4, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants