Repository navigation
Expand file tree
/
Copy pathCountlyConnectionTest.m
More file actions
498 lines (426 loc) · 21.3 KB
/
Copy pathCountlyConnectionTest.m
File metadata and controls
498 lines (426 loc) · 21.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
// CountlyConnectionTest.m
//
// This code is provided under the MIT License.
//
// Please visit www.count.ly for more information.
#import "CountlyCommon.h"
#import <stdatomic.h>
NSString* const kCountlyCTErrorTimeout = @"timeout";
NSString* const kCountlyCTErrorTransport = @"transport error";
NSString* const kCountlyCTErrorRedirected = @"redirected";
NSString* const kCountlyCTErrorNotRun = @"not run: battery cap";
// success qualifier of opaque (browser) probes, never produced here, but by cross SDK rule it survives the size cap
NSString* const kCountlyCTErrorOpaque = @"opaque";
// report keys
NSString* const kCountlyCTKeyTimestamp = @"ts";
NSString* const kCountlyCTKeySDK = @"sdk";
NSString* const kCountlyCTKeySDKName = @"name";
NSString* const kCountlyCTKeySDKVersion = @"version";
NSString* const kCountlyCTKeyResults = @"results";
NSString* const kCountlyCTKeyFeature = @"f";
NSString* const kCountlyCTKeyOk = @"ok";
NSString* const kCountlyCTKeyStatus = @"st";
NSString* const kCountlyCTKeyLatency = @"ms";
NSString* const kCountlyCTKeyError = @"e";
NSString* const kCountlyCTKeyPathCount = @"n";
// row definition keys, internal
static NSString* const kRowFeature = @"feature";
static NSString* const kRowPaths = @"paths";
static NSString* const kRowRequiresSuccess = @"requiresSuccess";
static const NSTimeInterval kCountlyCTDefaultPerRequestTimeout = 10;
static const NSTimeInterval kCountlyCTDefaultBatteryCapExtra = 30;
static const NSUInteger kCountlyCTMaxRows = 32;
static const NSUInteger kCountlyCTMaxReportBytes = 8 * 1024;
static const NSUInteger kCountlyCTMaxErrorLength = 256;
@interface CountlyConnectionTest ()
{
atomic_bool batteryRunning;
atomic_uint suspendCount;
}
// atomic: set by the halting thread, read by the battery on the utility queue
@property (atomic) BOOL halted;
@property (atomic) BOOL appSuspended;
// the battery to run again once the app is active, for the same user and 'sc' latency, or nil
@property (atomic, copy) dispatch_block_t deferredBattery;
@end
/// Seconds on a clock the system time can not move and that stands still while the device sleeps.
static NSTimeInterval CountlyCTUptime(void)
{
return (NSTimeInterval)clock_gettime_nsec_np(CLOCK_UPTIME_RAW) / NSEC_PER_SEC;
}
@implementation CountlyConnectionTest
static CountlyConnectionTest *s_sharedInstance = nil;
static dispatch_once_t onceToken;
+ (instancetype)sharedInstance
{
dispatch_once(&onceToken, ^{
s_sharedInstance = self.new;
});
return s_sharedInstance;
}
- (instancetype)init
{
if (self = [super init])
{
_perRequestTimeout = kCountlyCTDefaultPerRequestTimeout;
_batteryCapExtra = kCountlyCTDefaultBatteryCapExtra;
atomic_store(&batteryRunning, false);
atomic_store(&suspendCount, 0);
}
return self;
}
- (void)resetInstance
{
CLY_LOG_I(@"%s", __FUNCTION__);
// a battery still in flight keeps the old instance alive and drops its report on seeing this
self.halted = YES;
onceToken = 0;
s_sharedInstance = nil;
}
- (BOOL)isBatteryRunning
{
return atomic_load(&batteryRunning);
}
/// Feature rows in report order. A row with no paths is the 'sc' row, measured from the fetch that armed the test.
/// Rows 'core' and 'feedback-assets' have no legitimate 4xx answer, so anything but a 2xx is a fault there.
+ (NSArray<NSDictionary *> *)rows
{
static NSArray<NSDictionary *> *rows = nil;
static dispatch_once_t rowsOnce;
dispatch_once(&rowsOnce, ^{
rows = @[
@{kRowFeature: @"core", kRowRequiresSuccess: @YES, kRowPaths: @[@"/o/ping"]},
@{kRowFeature: @"core-write", kRowRequiresSuccess: @NO, kRowPaths: @[@"/i"]},
@{kRowFeature: @"sc", kRowRequiresSuccess: @NO, kRowPaths: @[]},
@{kRowFeature: @"rc", kRowRequiresSuccess: @NO, kRowPaths: @[@"/o/sdk?method=rc"]},
@{kRowFeature: @"ab", kRowRequiresSuccess: @NO, kRowPaths: @[@"/o/sdk?method=ab_fetch_variants"]},
@{kRowFeature: @"feedback", kRowRequiresSuccess: @NO, kRowPaths: @[@"/o/sdk?method=feedback"]},
@{kRowFeature: @"feedback-widget", kRowRequiresSuccess: @NO, kRowPaths: @[@"/o/surveys/nps/widget", @"/o/surveys/survey/widget", @"/o/feedback/widget"]},
@{kRowFeature: @"feedback-submit", kRowRequiresSuccess: @NO, kRowPaths: @[@"/i/feedback/inputs"]},
@{kRowFeature: @"content", kRowRequiresSuccess: @NO, kRowPaths: @[@"/o/sdk/content"]},
@{kRowFeature: @"feedback-page", kRowRequiresSuccess: @NO, kRowPaths: @[@"/feedback/nps", @"/feedback/survey", @"/feedback/rating"]},
@{kRowFeature: @"feedback-assets", kRowRequiresSuccess: @YES, kRowPaths: @[@"/surveys/images/ct-probe.png", @"/star-rating/images/ct-probe.png"]},
@{kRowFeature: @"content-page", kRowRequiresSuccess: @NO, kRowPaths: @[@"/_external/content/"]},
];
});
return rows;
}
/// One graded row of the report, without the optional reason and path count.
static NSMutableDictionary *CountlyCTResultRow(NSString *feature, BOOL ok, NSInteger status, long long latencyMs)
{
return [@{kCountlyCTKeyFeature: feature, kCountlyCTKeyOk: @(ok), kCountlyCTKeyStatus: @(status), kCountlyCTKeyLatency: @(latencyMs)} mutableCopy];
}
#pragma mark - Battery
- (void)startBatteryWithServerConfigLatency:(long long)scLatencyMs
{
[self startBatteryWithServerConfigLatency:scLatencyMs
deviceID:CountlyDeviceInfo.sharedInstance.deviceID
deviceIDType:CountlyDeviceInfo.sharedInstance.deviceIDTypeValue
deviceIDMergeCount:CountlyCommon.sharedInstance.deviceIDMergeCount];
}
- (void)startBatteryWithServerConfigLatency:(long long)scLatencyMs deviceID:(NSString *)deviceID deviceIDType:(NSUInteger)deviceIDType deviceIDMergeCount:(NSUInteger)deviceIDMergeCount
{
if (self.halted)
{
CLY_LOG_D(@"%s, module halted, ignoring", __FUNCTION__);
return;
}
if (!CountlyServerConfig.sharedInstance.networkingEnabled)
{
// the spec does not cover it, honouring the operator's own kill switch was judged safer than probe traffic
CLY_LOG_D(@"%s, networking is disabled by server config, ignoring", __FUNCTION__);
return;
}
if (!CountlyServerConfig.sharedInstance.trackingEnabled)
{
// the request queue refuses every request while tracking is off, so the report could never go out
CLY_LOG_D(@"%s, tracking is disabled by server config, ignoring", __FUNCTION__);
return;
}
if (deviceIDMergeCount != CountlyCommon.sharedInstance.deviceIDMergeCount)
{
CLY_LOG_D(@"%s, the user it was armed for was merged into another since, the server cancelled the run, ignoring", __FUNCTION__);
return;
}
// read before the background check, which noteAppSuspended sets before counting, so no suspension goes unseen
unsigned int suspendCountAtStart = atomic_load(&suspendCount);
if (self.appSuspended)
{
CLY_LOG_D(@"%s, the app is in the background where probes stall, the battery runs once it is active again", __FUNCTION__);
[self deferBatteryWithServerConfigLatency:scLatencyMs deviceID:deviceID deviceIDType:deviceIDType deviceIDMergeCount:deviceIDMergeCount];
return;
}
bool expected = false;
if (!atomic_compare_exchange_strong(&batteryRunning, &expected, true))
{
CLY_LOG_D(@"%s, a battery is already running, ignoring this delivery", __FUNCTION__);
return;
}
CLY_LOG_I(@"%s, connection test armed by the server, running the probe battery", __FUNCTION__);
dispatch_async(dispatch_get_global_queue(QOS_CLASS_UTILITY, 0), ^{
[self runBatteryAndReport:scLatencyMs deviceID:deviceID deviceIDType:deviceIDType deviceIDMergeCount:deviceIDMergeCount suspendCountAtStart:suspendCountAtStart];
atomic_store(&self->batteryRunning, false);
[self rerunInterruptedBattery];
});
}
/// Keeps the battery to run again once the app is active, for the same user and with the same 'sc' latency.
- (void)deferBatteryWithServerConfigLatency:(long long)scLatencyMs deviceID:(NSString *)deviceID deviceIDType:(NSUInteger)deviceIDType deviceIDMergeCount:(NSUInteger)deviceIDMergeCount
{
__weak CountlyConnectionTest *weakSelf = self;
self.deferredBattery = ^{
[weakSelf startBatteryWithServerConfigLatency:scLatencyMs deviceID:deviceID deviceIDType:deviceIDType deviceIDMergeCount:deviceIDMergeCount];
};
}
- (void)noteAppSuspended
{
self.appSuspended = YES;
atomic_fetch_add(&suspendCount, 1);
}
- (void)noteAppResumed
{
self.appSuspended = NO;
[self rerunInterruptedBattery];
}
/// Starts the battery the background interrupted or held back, once the app is back in the foreground and no battery runs.
- (void)rerunInterruptedBattery
{
dispatch_block_t deferredBattery = self.deferredBattery;
if (!deferredBattery || self.appSuspended || self.halted || self.isBatteryRunning)
return;
self.deferredBattery = nil;
CLY_LOG_D(@"%s, the battery the app going to the background interrupted runs again", __FUNCTION__);
deferredBattery();
}
/// Runs every row and queues the report under the armed user, unless halt, the background or a merge got in the way.
- (void)runBatteryAndReport:(long long)scLatencyMs deviceID:(NSString *)deviceID deviceIDType:(NSUInteger)deviceIDType deviceIDMergeCount:(NSUInteger)deviceIDMergeCount suspendCountAtStart:(unsigned int)suspendCountAtStart
{
NSArray<NSDictionary *> *rows = [self runBattery:scLatencyMs suspendCountAtStart:suspendCountAtStart];
if (self.halted)
{
CLY_LOG_D(@"%s, halted during the battery, dropping the report", __FUNCTION__);
return;
}
if (atomic_load(&suspendCount) != suspendCountAtStart)
{
CLY_LOG_D(@"%s, the app went to the background during the battery, its probes stalled, dropping the report and running it again in the foreground", __FUNCTION__);
[self deferBatteryWithServerConfigLatency:scLatencyMs deviceID:deviceID deviceIDType:deviceIDType deviceIDMergeCount:deviceIDMergeCount];
return;
}
if (deviceIDMergeCount != CountlyCommon.sharedInstance.deviceIDMergeCount)
{
// under the merged ID the server rejects it, and under the old ID it would create that user again
CLY_LOG_D(@"%s, the user the battery was armed for was merged during the battery, the server cancelled the run, dropping the report", __FUNCTION__);
return;
}
NSString *report = [self buildReport:rows];
CLY_LOG_D(@"%s, queueing report [ %@ ]", __FUNCTION__, report);
[CountlyConnectionManager.sharedInstance sendConnectionTestResults:report deviceID:deviceID deviceIDType:deviceIDType];
}
/// Probes every row sequentially against the configured host. Rows not reached before the battery cap report 'not run'.
/// Stops early when the app goes to the background, the report is dropped then anyway.
- (NSArray<NSDictionary *> *)runBattery:(long long)scLatencyMs suspendCountAtStart:(unsigned int)suspendCountAtStart
{
NSString *serverURL = CountlyConnectionManager.sharedInstance.host;
NSURLSession *session = [self probeSession];
NSUInteger requestCount = 0;
for (NSDictionary *row in CountlyConnectionTest.rows)
requestCount += ((NSArray *)row[kRowPaths]).count;
NSTimeInterval cap = requestCount * self.perRequestTimeout + self.batteryCapExtra;
NSTimeInterval batteryStart = CountlyCTUptime();
NSMutableArray<NSDictionary *> *results = NSMutableArray.new;
for (NSDictionary *row in CountlyConnectionTest.rows)
{
if (self.halted || atomic_load(&suspendCount) != suspendCountAtStart)
break;
NSArray<NSString *> *paths = row[kRowPaths];
if (paths.count == 0)
{
if (scLatencyMs >= 0)
[results addObject:CountlyCTResultRow(row[kRowFeature], YES, 200, scLatencyMs)];
continue;
}
if (CountlyCTUptime() - batteryStart > cap)
{
NSMutableDictionary *notRun = CountlyCTResultRow(row[kRowFeature], NO, 0, 0);
notRun[kCountlyCTKeyError] = kCountlyCTErrorNotRun;
[results addObject:notRun];
continue;
}
[results addObject:[self probeRow:row serverURL:serverURL session:session]];
}
[session finishTasksAndInvalidate];
return results.copy;
}
/// Probes every path of one row and combines them: ok only if all passed, first failing status and reason, summed latency.
- (NSDictionary *)probeRow:(NSDictionary *)row serverURL:(NSString *)serverURL session:(NSURLSession *)session
{
NSArray<NSString *> *paths = row[kRowPaths];
BOOL requiresSuccess = ((NSNumber *)row[kRowRequiresSuccess]).boolValue;
NSInteger status = 0;
long long latency = 0;
NSString *error = nil;
for (NSUInteger i = 0; i < paths.count; i++)
{
// a halted instance stops probing at the next path, the report is dropped anyway
if (self.halted)
break;
NSString *url = [CountlyConnectionTest probeURLForPath:paths[i] serverURL:serverURL];
NSDictionary *outcome = [self probe:url session:session];
NSInteger outcomeStatus = ((NSNumber *)outcome[kCountlyCTKeyStatus]).integerValue;
latency += ((NSNumber *)outcome[kCountlyCTKeyLatency]).longLongValue;
NSString *failure = [CountlyConnectionTest gradeStatus:outcomeStatus failure:outcome[kCountlyCTKeyError] requiresSuccessStatus:requiresSuccess];
CLY_LOG_V(@"%s, [ %@ ] %@ -> status[ %ld ] ms[ %@ ] failure[ %@ ]", __FUNCTION__, row[kRowFeature], url, (long)outcomeStatus, outcome[kCountlyCTKeyLatency], failure);
// the first failing path decides the row's status and reason, otherwise the first status observed is reported
if (failure && !error)
{
status = outcomeStatus;
error = failure;
}
else if (i == 0)
status = outcomeStatus;
}
NSMutableDictionary *result = CountlyCTResultRow(row[kRowFeature], error == nil, status, latency);
if (error)
result[kCountlyCTKeyError] = error;
if (paths.count > 1)
result[kCountlyCTKeyPathCount] = @(paths.count);
return result.copy;
}
/// One bare GET, waited for synchronously. Returns the status (0 when none could be read), the wall clock latency
/// and, for a status of 0, whether it was a timeout or another transport error.
- (NSDictionary *)probe:(NSString *)url session:(NSURLSession *)session
{
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
request.HTTPMethod = @"GET";
request.cachePolicy = NSURLRequestReloadIgnoringLocalAndRemoteCacheData;
request.timeoutInterval = self.perRequestTimeout;
__block NSInteger status = 0;
__block NSString *failure = nil;
dispatch_semaphore_t done = dispatch_semaphore_create(0);
NSTimeInterval start = CountlyCTUptime();
NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
{
if (error)
failure = error.code == NSURLErrorTimedOut ? kCountlyCTErrorTimeout : kCountlyCTErrorTransport;
else if ([response isKindOfClass:NSHTTPURLResponse.class])
status = ((NSHTTPURLResponse *)response).statusCode;
else
failure = kCountlyCTErrorTransport;
dispatch_semaphore_signal(done);
}];
[task resume];
// the request's own deadline should fire first, this only guards against a completion that never comes
if (dispatch_semaphore_wait(done, dispatch_time(DISPATCH_TIME_NOW, (int64_t)((self.perRequestTimeout + 5) * NSEC_PER_SEC))) != 0)
{
// cancelling makes the completion run, wait for it so its write cannot race the verdict below
[task cancel];
dispatch_semaphore_wait(done, DISPATCH_TIME_FOREVER);
status = 0;
failure = kCountlyCTErrorTimeout;
}
long long latency = (long long)((CountlyCTUptime() - start) * 1000);
NSMutableDictionary *outcome = [@{kCountlyCTKeyStatus: @(status), kCountlyCTKeyLatency: @(latency)} mutableCopy];
if (failure)
outcome[kCountlyCTKeyError] = failure;
return outcome.copy;
}
/// A session on the SDK's own configuration, so probes ride the same custom headers and, through the delegate,
/// the same pinning. Caching is off and redirects are not followed.
- (NSURLSession *)probeSession
{
NSURLSessionConfiguration *userConfig = CountlyConnectionManager.sharedInstance.URLSessionConfiguration;
NSURLSessionConfiguration *configuration = userConfig ? [userConfig copy] : NSURLSessionConfiguration.defaultSessionConfiguration;
configuration.timeoutIntervalForRequest = self.perRequestTimeout;
configuration.timeoutIntervalForResource = self.perRequestTimeout;
configuration.requestCachePolicy = NSURLRequestReloadIgnoringLocalAndRemoteCacheData;
configuration.URLCache = nil;
configuration.HTTPShouldSetCookies = NO;
return [NSURLSession sessionWithConfiguration:configuration delegate:self delegateQueue:nil];
}
#pragma mark - NSURLSessionTaskDelegate
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest * _Nullable))completionHandler
{
// a redirect must not be mistaken for a healthy answer, the 3xx itself becomes the task's response
completionHandler(nil);
}
- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition, NSURLCredential * _Nullable))completionHandler
{
if (CountlyConnectionManager.sharedInstance.pinnedCertificates.count > 0)
{
// without this a pinned host would report 'transport error' while the SDK itself works
[CountlyConnectionManager.sharedInstance URLSession:session didReceiveChallenge:challenge completionHandler:completionHandler];
return;
}
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil);
}
#pragma mark - Grading and report
+ (NSString *)probeURLForPath:(NSString *)path serverURL:(NSString *)serverURL
{
NSString *base = serverURL ?: @"";
while ([base hasSuffix:@"/"])
base = [base substringToIndex:base.length - 1];
NSString *joined = [path hasPrefix:@"/"] ? [base stringByAppendingString:path] : [NSString stringWithFormat:@"%@/%@", base, path];
NSString *separator = [joined containsString:@"?"] ? @"&" : @"?";
return [NSString stringWithFormat:@"%@%@ct=1&_=%lld", joined, separator, (long long)(NSDate.date.timeIntervalSince1970 * 1000)];
}
+ (nullable NSString *)gradeStatus:(NSInteger)status failure:(nullable NSString *)failure requiresSuccessStatus:(BOOL)requiresSuccessStatus
{
if (status <= 0)
return failure ?: kCountlyCTErrorTransport;
if (status >= 200 && status < 300)
return nil;
if (status >= 300 && status < 400)
return kCountlyCTErrorRedirected;
// a 4xx other than 403 is the Countly application answering, unless this row has no legitimate 4xx answer
if (!requiresSuccessStatus && status >= 400 && status < 500 && status != 403)
return nil;
return [NSString stringWithFormat:@"HTTP %ld", (long)status];
}
- (NSString *)buildReport:(NSArray<NSDictionary *> *)rows
{
NSMutableArray<NSMutableDictionary *> *results = NSMutableArray.new;
for (NSDictionary *row in rows)
{
if (results.count >= kCountlyCTMaxRows)
break;
NSMutableDictionary *result = row.mutableCopy;
NSString *error = result[kCountlyCTKeyError];
if (error.length > kCountlyCTMaxErrorLength)
result[kCountlyCTKeyError] = [error substringToIndex:kCountlyCTMaxErrorLength];
[results addObject:result];
}
NSString *report = [self serializedReportWithResults:results];
if ([self utf8Length:report] > kCountlyCTMaxReportBytes)
{
CLY_LOG_W(@"%s, report is over the size cap, dropping error details", __FUNCTION__);
for (NSMutableDictionary *result in results)
{
// the qualifier of an opaque success is not detail, dropping it would upgrade the row's apparent certainty
if (![result[kCountlyCTKeyError] isEqualToString:kCountlyCTErrorOpaque])
[result removeObjectForKey:kCountlyCTKeyError];
}
report = [self serializedReportWithResults:results];
}
while ([self utf8Length:report] > kCountlyCTMaxReportBytes && results.count > 0)
{
CLY_LOG_W(@"%s, report is still over the size cap, dropping the last row", __FUNCTION__);
[results removeLastObject];
report = [self serializedReportWithResults:results];
}
return report;
}
/// The report JSON for the given rows: device clock, SDK identity and the rows.
- (NSString *)serializedReportWithResults:(NSArray<NSDictionary *> *)results
{
return CountlyJSONFromObject(@{
kCountlyCTKeyTimestamp: @((long long)(NSDate.date.timeIntervalSince1970 * 1000)),
kCountlyCTKeySDK: @{kCountlyCTKeySDKName: CountlyCommon.sharedInstance.SDKName, kCountlyCTKeySDKVersion: CountlyCommon.sharedInstance.SDKVersion},
kCountlyCTKeyResults: results,
});
}
/// Size of the report on the wire before URL escaping, which is what the server's cap is measured against.
- (NSUInteger)utf8Length:(NSString *)report
{
return [report lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
}
@end