File tree Expand file tree Collapse file tree 11 files changed +56
-11
lines changed
Tests/Unit-Tests/NewRelicAgentTests
Harvester-Tests/Harvestable-Data-Tests Expand file tree Collapse file tree 11 files changed +56
-11
lines changed Original file line number Diff line number Diff line change 16
16
17
17
@interface NRMAAnalytics : NSObject <NRMAHarvestAware>
18
18
- (void ) setMaxEventBufferTime : (unsigned int ) seconds ;
19
-
19
+ - ( NSUInteger ) getMaxEventBufferSize ;
20
20
- (void ) setMaxEventBufferSize : (unsigned int ) size ;
21
+ - (NSUInteger ) getMaxEventBufferTime ;
21
22
22
23
- (id ) initWithSessionStartTimeMS : (long long ) sessionStartTime ;
23
24
Original file line number Diff line number Diff line change @@ -79,22 +79,30 @@ @implementation NRMAAnalytics
79
79
}
80
80
81
81
- (void ) setMaxEventBufferSize : (unsigned int ) size {
82
+ [NRMAAgentConfiguration setMaxEventBufferSize: size];
82
83
if ([NRMAFlags shouldEnableNewEventSystem ]){
83
84
[_eventManager setMaxEventBufferSize: size];
84
85
}
85
86
else {
86
87
_analyticsController->setMaxEventBufferSize (size);
87
88
}
88
89
}
90
+ - (NSUInteger ) getMaxEventBufferSize {
91
+ return [_eventManager getMaxEventBufferSize ];
92
+ }
89
93
- (void ) setMaxEventBufferTime : (unsigned int )seconds
90
94
{
95
+ [NRMAAgentConfiguration setMaxEventBufferTime: seconds];
91
96
if ([NRMAFlags shouldEnableNewEventSystem ]){
92
97
[_eventManager setMaxEventBufferTimeInSeconds: seconds];
93
98
}
94
99
else {
95
100
_analyticsController->setMaxEventBufferTime (seconds);
96
101
}
97
102
}
103
+ - (NSUInteger ) getMaxEventBufferTime {
104
+ return [_eventManager getMaxEventBufferTimeInSeconds ];
105
+ }
98
106
99
107
- (id ) initWithSessionStartTimeMS : (long long ) sessionStartTime {
100
108
self = [super init ];
Original file line number Diff line number Diff line change @@ -19,7 +19,9 @@ NS_ASSUME_NONNULL_BEGIN
19
19
@interface NRMAEventManager : NSObject
20
20
21
21
- (void )setMaxEventBufferSize : (NSUInteger )size ;
22
+ - (NSUInteger )getMaxEventBufferSize ;
22
23
- (void )setMaxEventBufferTimeInSeconds : (NSUInteger )seconds ;
24
+ - (NSUInteger )getMaxEventBufferTimeInSeconds ;
23
25
- (BOOL )didReachMaxQueueTime : (NSTimeInterval )currentTimeMilliseconds ;
24
26
- (BOOL )addEvent : (id <NRMAAnalyticEventProtocol>)event ;
25
27
- (void )empty ;
Original file line number Diff line number Diff line change @@ -71,6 +71,10 @@ - (void)setMaxEventBufferSize:(NSUInteger)size {
71
71
maxBufferSize = size;
72
72
}
73
73
74
+ - (NSUInteger )getMaxEventBufferSize {
75
+ return maxBufferSize;
76
+ }
77
+
74
78
- (void )setMaxEventBufferTimeInSeconds : (NSUInteger )seconds {
75
79
if (seconds < kMinBufferTimeSeconds ) {
76
80
NRLOG_ERROR (@" Buffer Time cannot be less than %lu Seconds" , (unsigned long )kMinBufferTimeSeconds );
@@ -83,6 +87,10 @@ - (void)setMaxEventBufferTimeInSeconds:(NSUInteger)seconds {
83
87
maxBufferTimeSeconds = seconds;
84
88
}
85
89
90
+ - (NSUInteger )getMaxEventBufferTimeInSeconds {
91
+ return maxBufferTimeSeconds;
92
+ }
93
+
86
94
- (BOOL )didReachMaxQueueTime : (NSTimeInterval )currentTimeMilliseconds {
87
95
if (oldestEventTimestamp == 0 ) {
88
96
return false ;
Original file line number Diff line number Diff line change 44
44
+ (void ) setMaxEventBufferTime : (NSUInteger )seconds ;
45
45
+ (NSUInteger ) getMaxEventBufferTime ;
46
46
47
- + (void ) setMaxEventBufferSize : (NSUInteger )seconds ;
47
+ + (void ) setMaxEventBufferSize : (NSUInteger )size ;
48
48
+ (NSUInteger ) getMaxEventBufferSize ;
49
-
50
49
@end
Original file line number Diff line number Diff line change @@ -50,9 +50,8 @@ + (NSUInteger) getMaxEventBufferTime {
50
50
return __NRMA__maxEventBufferTime;
51
51
}
52
52
53
-
54
- + (void ) setMaxEventBufferSize : (NSUInteger )seconds {
55
- __NRMA__maxEventBufferSize = seconds;
53
+ + (void ) setMaxEventBufferSize : (NSUInteger )size {
54
+ __NRMA__maxEventBufferSize = size;
56
55
}
57
56
+ (NSUInteger ) getMaxEventBufferSize {
58
57
return __NRMA__maxEventBufferSize;
Original file line number Diff line number Diff line change @@ -32,7 +32,8 @@ extern "C" {
32
32
NRMAPlatform_ReactNative,
33
33
NRMAPlatform_Flutter,
34
34
NRMAPlatform_Capacitor,
35
- NRMAPlatform_MAUI
35
+ NRMAPlatform_MAUI,
36
+ NRMAPlatform_Unreal
36
37
};
37
38
38
39
// these constants are paired with enum values of NRMAApplicationPlatform
@@ -49,6 +50,7 @@ extern "C" {
49
50
#define kNRMAPlatformString_Flutter @" Flutter"
50
51
#define kNRMAPlatformString_Capacitor @" Capacitor"
51
52
#define kNRMAPlatformString_MAUI @" MAUI"
53
+ #define kNRMAPlatformString_Unreal @" Unreal"
52
54
53
55
54
56
// Custom Trace Types
Original file line number Diff line number Diff line change @@ -613,8 +613,6 @@ + (BOOL) recordBreadcrumb:(NSString* __nonnull)name
613
613
* harvest cycle.
614
614
*/
615
615
+ (void ) setMaxEventBufferTime:(unsigned int )seconds {
616
- [NRMAAgentConfiguration setMaxEventBufferTime: seconds];
617
-
618
616
[[NewRelicAgentInternal sharedInstance ].analyticsController setMaxEventBufferTime: seconds];
619
617
}
620
618
/*
Original file line number Diff line number Diff line change @@ -171,6 +171,8 @@ + (NSString*) stringFromNRMAApplicationPlatform:(NRMAApplicationPlatform)applica
171
171
return kNRMAPlatformString_Capacitor ;
172
172
case NRMAPlatform_MAUI:
173
173
return kNRMAPlatformString_MAUI ;
174
+ case NRMAPlatform_Unreal:
175
+ return kNRMAPlatformString_Unreal ;
174
176
}
175
177
}
176
178
Original file line number Diff line number Diff line change @@ -420,8 +420,6 @@ - (void) testJSONEscapeCharacters {
420
420
421
421
}
422
422
423
-
424
-
425
423
- (void ) testDuplicateStore {
426
424
// todo: reenable test (disabled for beta 1, no persistent store)
427
425
// NRMAAnalytics* analytics = [[NRMAAnalytics alloc] initWithSessionStartTimeMS:0];
@@ -1097,6 +1095,28 @@ - (void) testMidSessionHarvest {
1097
1095
// XCTAssertTrue(array.count == 0, @"dup events should have been cleared out on harvest before.");
1098
1096
}
1099
1097
1098
+ -(void )testSetMaxEventBufferSize {
1099
+ NRMAAnalytics* analytics = [[NRMAAnalytics alloc ] initWithSessionStartTimeMS: 0 ];
1100
+
1101
+ [analytics setMaxEventBufferSize: 2000 ];
1102
+
1103
+ XCTAssertEqual ([analytics getMaxEventBufferSize ], 2000 );
1104
+
1105
+ analytics = [[NRMAAnalytics alloc ] initWithSessionStartTimeMS: 0 ];
1106
+ XCTAssertEqual ([analytics getMaxEventBufferSize ], 2000 );
1107
+ }
1108
+
1109
+ -(void )testSetMaxEventBufferTime {
1110
+ NRMAAnalytics* analytics = [[NRMAAnalytics alloc ] initWithSessionStartTimeMS: 0 ];
1111
+
1112
+ [analytics setMaxEventBufferTime: 2000 ];
1113
+
1114
+ XCTAssertEqual ([analytics getMaxEventBufferTime ], 2000 );
1115
+
1116
+ analytics = [[NRMAAnalytics alloc ] initWithSessionStartTimeMS: 0 ];
1117
+ XCTAssertEqual ([analytics getMaxEventBufferTime ], 2000 );
1118
+ }
1119
+
1100
1120
- (void ) testBadInput {
1101
1121
BOOL result;
1102
1122
// - (BOOL) addInteractionEvent:(NSString*)name interactionDuration:(double)duration_secs;
You can’t perform that action at this time.
0 commit comments