@@ -167,7 +167,7 @@ public struct CommandSucceededEvent: MongoSwiftEvent, CommandEventProtocol {
167
167
}
168
168
169
169
/// The execution time of the event, in microseconds.
170
- public let duration : Int64
170
+ public let duration : Int
171
171
172
172
/// The command reply.
173
173
public let reply : Document
@@ -186,7 +186,8 @@ public struct CommandSucceededEvent: MongoSwiftEvent, CommandEventProtocol {
186
186
public let serverAddress : Address
187
187
188
188
fileprivate init ( mongocEvent: MongocCommandSucceededEvent ) {
189
- self . duration = mongoc_apm_command_succeeded_get_duration ( mongocEvent. ptr)
189
+ // TODO: SWIFT-349 add logging to check and warn of unlikely int size issues
190
+ self . duration = Int ( mongoc_apm_command_succeeded_get_duration ( mongocEvent. ptr) )
190
191
// we have to copy because libmongoc owns the pointer.
191
192
self . reply = Document ( copying: mongoc_apm_command_succeeded_get_reply ( mongocEvent. ptr) )
192
193
self . commandName = String ( cString: mongoc_apm_command_succeeded_get_command_name ( mongocEvent. ptr) )
@@ -216,7 +217,7 @@ public struct CommandFailedEvent: MongoSwiftEvent, CommandEventProtocol {
216
217
}
217
218
218
219
/// The execution time of the event, in microseconds.
219
- public let duration : Int64
220
+ public let duration : Int
220
221
221
222
/// The command name.
222
223
public let commandName : String
@@ -235,7 +236,7 @@ public struct CommandFailedEvent: MongoSwiftEvent, CommandEventProtocol {
235
236
public let serverAddress : Address
236
237
237
238
fileprivate init ( mongocEvent: MongocCommandFailedEvent ) {
238
- self . duration = mongoc_apm_command_failed_get_duration ( mongocEvent. ptr)
239
+ self . duration = Int ( mongoc_apm_command_failed_get_duration ( mongocEvent. ptr) )
239
240
self . commandName = String ( cString: mongoc_apm_command_failed_get_command_name ( mongocEvent. ptr) )
240
241
var error = bson_error_t ( )
241
242
mongoc_apm_command_failed_get_error ( mongocEvent. ptr, & error)
@@ -548,7 +549,7 @@ public struct ServerHeartbeatSucceededEvent: MongoSwiftEvent {
548
549
}
549
550
550
551
/// The execution time of the event, in microseconds.
551
- public let duration : Int64
552
+ public let duration : Int
552
553
553
554
/// The command reply.
554
555
public let reply : Document
@@ -557,7 +558,7 @@ public struct ServerHeartbeatSucceededEvent: MongoSwiftEvent {
557
558
public let serverAddress : Address
558
559
559
560
fileprivate init ( mongocEvent: MongocServerHeartbeatSucceededEvent ) {
560
- self . duration = mongoc_apm_server_heartbeat_succeeded_get_duration ( mongocEvent. ptr)
561
+ self . duration = Int ( mongoc_apm_server_heartbeat_succeeded_get_duration ( mongocEvent. ptr) )
561
562
// we have to copy because libmongoc owns the pointer.
562
563
self . reply = Document ( copying: mongoc_apm_server_heartbeat_succeeded_get_reply ( mongocEvent. ptr) )
563
564
self . serverAddress = Address ( mongoc_apm_server_heartbeat_succeeded_get_host ( mongocEvent. ptr) )
@@ -584,7 +585,7 @@ public struct ServerHeartbeatFailedEvent: MongoSwiftEvent {
584
585
}
585
586
586
587
/// The execution time of the event, in microseconds.
587
- public let duration : Int64
588
+ public let duration : Int
588
589
589
590
/// The failure.
590
591
public let failure : MongoError
@@ -593,7 +594,7 @@ public struct ServerHeartbeatFailedEvent: MongoSwiftEvent {
593
594
public let serverAddress : Address
594
595
595
596
fileprivate init ( mongocEvent: MongocServerHeartbeatFailedEvent ) {
596
- self . duration = mongoc_apm_server_heartbeat_failed_get_duration ( mongocEvent. ptr)
597
+ self . duration = Int ( mongoc_apm_server_heartbeat_failed_get_duration ( mongocEvent. ptr) )
597
598
var error = bson_error_t ( )
598
599
mongoc_apm_server_heartbeat_failed_get_error ( mongocEvent. ptr, & error)
599
600
self . failure = extractMongoError ( error: error)
0 commit comments