Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record number of events dropped at the end for retry mechanims #63

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -62,6 +64,7 @@ extension EventRequest: DatabasePersistable {
t.column("data", .blob)
t.column("retriesMade", .text).notNull()
t.column("createdTimestamp", .datetime).notNull()
t.column("eventCount", .integer).notNull()
}
}
}
Expand All @@ -86,6 +89,13 @@ extension EventRequest: DatabasePersistable {
t.add(column: "eventType", .text)
}

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

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