Skip to content

Commit

Permalink
feat: better ingestion timestamp warning
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Dec 22, 2024
1 parent 18198bb commit 2caaa94
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { KafkaProducerWrapper } from '../../../../utils/db/kafka-producer-wrappe
import { status } from '../../../../utils/status'
import { captureIngestionWarning } from '../../../../worker/ingestion/utils'
import { eventDroppedCounter } from '../../metrics'
import { createSessionReplayEvent } from '../process-event'
import { createSessionReplayEvent, RRWebEventType } from '../process-event'
import { IncomingRecordingMessage } from '../types'
import { OffsetHighWaterMarker } from './offset-high-water-marker'

Expand Down Expand Up @@ -138,6 +138,8 @@ export class ReplayEventsIngester {
if (replayRecord !== null) {
const asDate = DateTime.fromSQL(replayRecord.first_timestamp)
if (!asDate.isValid || Math.abs(asDate.diffNow('day').days) >= 7) {
const eventTypes = rrwebEvents.map((event) => event.type)
const customEvents = rrwebEvents.filter((event) => event.type === RRWebEventType.Custom)
await captureIngestionWarning(
new KafkaProducerWrapper(this.producer),
event.team_id,
Expand All @@ -148,6 +150,8 @@ export class ReplayEventsIngester {
isValid: asDate.isValid,
daysFromNow: Math.round(Math.abs(asDate.diffNow('day').days)),
processingTimestamp: DateTime.now().toISO(),
eventTypes,
customEvents,
},
{ key: event.session_id }
)
Expand Down

0 comments on commit 2caaa94

Please sign in to comment.