Skip to content

Commit

Permalink
Record number of events dropped at the end for retry mechanims
Browse files Browse the repository at this point in the history
  • Loading branch information
rcrahul43 committed Apr 17, 2024
1 parent 599acae commit 9dc23bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ extension DefaultNetworkBuilder {
checkedSelf.trackHealthEvents(eventBatch: eventBatch,
eventBatchData: data)
}

eventRequest.eventCount = eventBatch.events.count
checkedSelf.retryMech.trackBatch(with: eventRequest)
#if EVENT_VISUALIZER_ENABLED
/// Update status of the event batch to sent to network
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ struct EventRequest: Codable, Equatable {
var createdTimestamp: Date?
var eventType: Constants.EventType?
var isInternal: Bool?
var eventCount: Int

init(guid: String,
data: Data? = nil) {
Expand All @@ -29,6 +30,7 @@ struct EventRequest: Codable, Equatable {
self.createdTimestamp = Date()
self.isInternal = false
self.eventType = .realTime
self.eventCount = 0
}

static func == (lhs: Self, rhs: Self) -> Bool {
Expand Down Expand Up @@ -86,6 +88,10 @@ extension EventRequest: DatabasePersistable {
t.add(column: "eventType", .text)
}

return [("addsIsInternalToEventRequest", addsIsInternal), ("addsEventTypeToEventRequest", addsEventType)]
let addsEventCount: (TableAlteration) -> Void = { t in
t.add(column: "eventCount", .integer)
}

return [("addsIsInternalToEventRequest", addsIsInternal), ("addsEventTypeToEventRequest", addsEventType), ("addsEventCountToEventRequest", addsEventCount)]
}
}

0 comments on commit 9dc23bc

Please sign in to comment.