Skip to content

Commit ea73a8b

Browse files
Merge pull request #332 from newrelic/staging
New Relic iOS agent 7.5.3 (Production)
2 parents c1da4a5 + da9b6dd commit ea73a8b

File tree

30 files changed

+944
-257
lines changed

30 files changed

+944
-257
lines changed

.github/workflows/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ jobs:
1616
name : TestIOS
1717
# runs-on: will be set to macos-latest when running on actual GHA.
1818
# *** runs-on: ubuntu-latest is used when running via act on mac os. ***
19-
runs-on: macos-13
19+
runs-on: macos-14
2020
steps:
2121
- uses: actions/checkout@master
2222
with:
2323
submodules: true
2424

2525
- uses: maxim-lobanov/setup-xcode@v1
2626
with:
27-
xcode-version: '14.3'
27+
xcode-version: '15.4'
2828

2929
- name: Install lcov
3030
run: |
@@ -52,7 +52,7 @@ jobs:
5252

5353
- uses: maxim-lobanov/setup-xcode@v1
5454
with:
55-
xcode-version: '14.3'
55+
xcode-version: '15.4'
5656

5757
- name: Install lcov
5858
run: brew install lcov
@@ -78,7 +78,7 @@ jobs:
7878

7979
- uses: maxim-lobanov/setup-xcode@v1
8080
with:
81-
xcode-version: '14.3'
81+
xcode-version: '15.4'
8282

8383
- name: Install lcov
8484
run: brew install lcov
@@ -96,7 +96,7 @@ jobs:
9696
name: DeployS3
9797
# runs-on: will be set to macos-latest when running on actual GHA.
9898
# *** runs-on: ubuntu-latest is used when running via act on mac os. ***
99-
runs-on: macos-13
99+
runs-on: macos-14
100100
needs: [testIOS, testTVOS, testWatchOS]
101101
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main'
102102
outputs:
@@ -108,7 +108,7 @@ jobs:
108108

109109
- uses: maxim-lobanov/setup-xcode@v1
110110
with:
111-
xcode-version: '14.3'
111+
xcode-version: '15.4'
112112

113113
- name: Install the Apple certificate and provisioning profile
114114
env:

Agent.xcodeproj/project.pbxproj

Lines changed: 66 additions & 38 deletions
Large diffs are not rendered by default.

Agent/Analytics/NRMAAnalytics.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,6 @@
7575

7676
+ (int64_t) currentTimeMillis;
7777
+ (NSArray<NSString*>*) reservedKeywords;
78+
+ (NSArray<NSString*>*) reservedPrefixes;
7879

7980
@end

Agent/Analytics/NRMAAnalytics.mm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,14 @@ - (id) initWithSessionStartTimeMS:(long long) sessionStartTime {
131131
NRLOG_AGENT_ERROR(@"invalid attribute: name prefix disallowed");
132132
return false;
133133
}
134+
}
135+
for (NSString* key in [NRMAAnalytics reservedPrefixes]) {
134136
if ([name hasPrefix:key]) {
135137
NRLOG_AGENT_ERROR(@"invalid attribute: name prefix disallowed");
136138
return false;
137139
}
138140
}
141+
139142
// check if attribute name exceeds max length.
140143
if ([name length] > kNRMA_Attrib_Max_Name_Length) {
141144
NRLOG_AGENT_ERROR(@"invalid attribute: name length exceeds limit");
@@ -275,6 +278,7 @@ - (BOOL) addInteractionEvent:(NSString*)name
275278
}
276279
}
277280

281+
// New Event System
278282
- (BOOL) addNetworkRequestEvent:(NRMANetworkRequestData *)requestData
279283
withResponse:(NRMANetworkResponseData *)responseData
280284
withNRMAPayload:(NRMAPayload *)payload {
@@ -514,6 +518,7 @@ - (BOOL) addHTTPErrorEvent:(NRMANetworkRequestData *)requestData
514518
}
515519
}
516520

521+
// Old Event System
517522
- (BOOL)addNetworkRequestEvent:(NRMANetworkRequestData *)requestData
518523
withResponse:(NRMANetworkResponseData *)responseData
519524
withPayload:(std::unique_ptr<const Connectivity::Payload>)payload {
@@ -525,6 +530,7 @@ - (BOOL)addNetworkRequestEvent:(NRMANetworkRequestData *)requestData
525530
return NO;
526531
}
527532

533+
// Old Event System
528534
- (BOOL)addNetworkErrorEvent:(NRMANetworkRequestData *)requestData
529535
withResponse:(NRMANetworkResponseData *)responseData
530536
withPayload:(std::unique_ptr<const NewRelic::Connectivity::Payload>)payload {
@@ -538,6 +544,7 @@ - (BOOL)addNetworkErrorEvent:(NRMANetworkRequestData *)requestData
538544
return NO;
539545
}
540546

547+
// Old Event System
541548
- (BOOL)addHTTPErrorEvent:(NRMANetworkRequestData *)requestData
542549
withResponse:(NRMANetworkResponseData *)responseData
543550
withPayload:(std::unique_ptr<const NewRelic::Connectivity::Payload>)payload {
@@ -1269,4 +1276,11 @@ + (int64_t) currentTimeMillis {
12691276
,nil];
12701277
}
12711278

1279+
+ (NSArray<NSString*>*) reservedPrefixes {
1280+
return [NSArray arrayWithObjects:
1281+
kNRMA_RP_newRelic,
1282+
kNRMA_RP_nr,
1283+
nil];
1284+
}
1285+
12721286
@end

Agent/CrashHandler/ExceptionDataInterface/NRMAExceptionMetaDataStore.m

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -281,17 +281,7 @@ void NRMA__freeMetaData(void)
281281
}
282282

283283
void NRMA_freeInteractionHistoryList(void) {
284-
NRMAInteractionHistoryNode* root = NRMA__getInteractionHistoryList();
285-
while (root != NULL) {
286-
if (root->name != NULL) {
287-
free((void *)root->name);
288-
root->name = NULL;
289-
}
290-
291-
NRMAInteractionHistoryNode* temp = root;
292-
root = root->next;
293-
free((void *)temp);
294-
}
284+
NRMA__deallocInteractionHistoryList();
295285
}
296286

297287
void NRMA_freeExceptionData(void) {

Agent/CrashHandler/ExceptionDataInterface/NRMAInteractionHistory.c

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,34 @@ void NRMA__insertNode(NRMAInteractionHistoryNode* interaction);
1919

2020
void NRMA__AddInteraction(const char* interactionName, long long timestampMillis)
2121
{
22+
23+
if (interactionName == NULL || strlen(interactionName) == 0) {
24+
return;
25+
}
26+
2227
NRMAInteractionHistoryNode* node = (NRMAInteractionHistoryNode*)malloc(sizeof(NRMAInteractionHistoryNode));
23-
if (node != NULL) {
24-
size_t len = strlen(interactionName);
25-
if (len < 1) {
26-
free(node);
27-
return;
28-
}
29-
char* temp = malloc(sizeof(char) * (len+1));
30-
if (temp == NULL) {
31-
free(node);
32-
// Failure case hit here.
33-
return;
34-
}
35-
strncpy(temp, interactionName,len);
36-
temp[len] = '\0';
37-
node->name = temp;
38-
node->timestampMillis = timestampMillis;
39-
40-
NRMA__insertNode(node);
28+
29+
if (node == NULL) {
30+
return;
4131
}
32+
33+
node->name = strdup(interactionName);
34+
if (node->name == NULL) {
35+
free(node);
36+
return;
37+
}
38+
node->timestampMillis = timestampMillis;
39+
node->next = NULL;
40+
41+
NRMA__insertNode(node);
4242
}
4343

4444
void NRMA__insertNode(NRMAInteractionHistoryNode* interaction)
4545
{
46+
if (interaction == NULL) {
47+
return;
48+
}
49+
4650
interaction->next = __list;
4751
__list = interaction;
4852
}
@@ -59,14 +63,16 @@ NRMAInteractionHistoryNode* NRMA__getInteractionHistoryList(void)
5963

6064
void NRMA__deallocInteractionHistoryList(void)
6165
{
62-
NRMAInteractionHistoryNode* head = __list;
63-
__list = NULL;
64-
while (head != NULL) {
65-
free((void*)head->name);
66-
head->name = NULL;
67-
NRMAInteractionHistoryNode* tmp = head->next;
68-
free((void*)head);
69-
head = NULL;
70-
head = tmp;
66+
NRMAInteractionHistoryNode* current = __list;
67+
NRMAInteractionHistoryNode *next;
68+
69+
while (current != NULL) {
70+
next = current->next;
71+
72+
free((void*)current->name);
73+
free((void*)current);
74+
current = next;
7175
}
76+
77+
__list = NULL;
7278
}

Agent/DistributedTracing/W3CTraceParent.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ + (NSString *) getVersion {
1414
return @"00";
1515
}
1616
+ (NSString *) getFlags {
17-
return @"00";
17+
return @"01";
1818
}
1919
+ (NSString *) getParentId {
2020
return @"";

Agent/FeatureFlags/NRMAFlags.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555

5656
+ (BOOL) shouldEnableBackgroundReporting;
5757

58+
+ (BOOL) shouldEnableAutoCollectLogs;
59+
5860
+ (NSArray<NSString*>*) namesForFlags:(NRMAFeatureFlags)flags;
5961

6062
// Private Setting

Agent/FeatureFlags/NRMAFlags.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ + (BOOL) shouldEnableBackgroundReporting {
177177
return ([NRMAFlags featureFlags] & NRFeatureFlag_BackgroundReporting) != 0;
178178
}
179179

180+
+ (BOOL) shouldEnableAutoCollectLogs {
181+
return ([NRMAFlags featureFlags] & NRFeatureFlag_AutoCollectLogs) != 0;
182+
}
183+
180184
+ (NSArray<NSString*>*) namesForFlags:(NRMAFeatureFlags)flags {
181185
NSMutableArray *retArray = [NSMutableArray array];
182186
if ((flags & NRFeatureFlag_InteractionTracing) == NRFeatureFlag_InteractionTracing) {
@@ -239,6 +243,9 @@ + (BOOL) shouldEnableBackgroundReporting {
239243
if ((flags & NRFeatureFlag_BackgroundReporting) == NRFeatureFlag_BackgroundReporting) {
240244
[retArray addObject:@"BackgroundReporting"];
241245
}
246+
if ((flags & NRFeatureFlag_AutoCollectLogs) == NRFeatureFlag_AutoCollectLogs) {
247+
[retArray addObject:@"AutoCollectLogs"];
248+
}
242249

243250
return retArray;
244251
}

0 commit comments

Comments
 (0)