Skip to content

Commit

Permalink
Merge pull request #332 from newrelic/staging
Browse files Browse the repository at this point in the history
New Relic iOS agent 7.5.3 (Production)
  • Loading branch information
cdillard-NewRelic authored Dec 4, 2024
2 parents c1da4a5 + da9b6dd commit ea73a8b
Show file tree
Hide file tree
Showing 30 changed files with 944 additions and 257 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:
name : TestIOS
# runs-on: will be set to macos-latest when running on actual GHA.
# *** runs-on: ubuntu-latest is used when running via act on mac os. ***
runs-on: macos-13
runs-on: macos-14
steps:
- uses: actions/checkout@master
with:
submodules: true

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '14.3'
xcode-version: '15.4'

- name: Install lcov
run: |
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '14.3'
xcode-version: '15.4'

- name: Install lcov
run: brew install lcov
Expand All @@ -78,7 +78,7 @@ jobs:

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '14.3'
xcode-version: '15.4'

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

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '14.3'
xcode-version: '15.4'

- name: Install the Apple certificate and provisioning profile
env:
Expand Down
104 changes: 66 additions & 38 deletions Agent.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Agent/Analytics/NRMAAnalytics.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@

+ (int64_t) currentTimeMillis;
+ (NSArray<NSString*>*) reservedKeywords;
+ (NSArray<NSString*>*) reservedPrefixes;

@end
14 changes: 14 additions & 0 deletions Agent/Analytics/NRMAAnalytics.mm
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,14 @@ - (id) initWithSessionStartTimeMS:(long long) sessionStartTime {
NRLOG_AGENT_ERROR(@"invalid attribute: name prefix disallowed");
return false;
}
}
for (NSString* key in [NRMAAnalytics reservedPrefixes]) {
if ([name hasPrefix:key]) {
NRLOG_AGENT_ERROR(@"invalid attribute: name prefix disallowed");
return false;
}
}

// check if attribute name exceeds max length.
if ([name length] > kNRMA_Attrib_Max_Name_Length) {
NRLOG_AGENT_ERROR(@"invalid attribute: name length exceeds limit");
Expand Down Expand Up @@ -275,6 +278,7 @@ - (BOOL) addInteractionEvent:(NSString*)name
}
}

// New Event System
- (BOOL) addNetworkRequestEvent:(NRMANetworkRequestData *)requestData
withResponse:(NRMANetworkResponseData *)responseData
withNRMAPayload:(NRMAPayload *)payload {
Expand Down Expand Up @@ -514,6 +518,7 @@ - (BOOL) addHTTPErrorEvent:(NRMANetworkRequestData *)requestData
}
}

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

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

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

+ (NSArray<NSString*>*) reservedPrefixes {
return [NSArray arrayWithObjects:
kNRMA_RP_newRelic,
kNRMA_RP_nr,
nil];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -281,17 +281,7 @@ void NRMA__freeMetaData(void)
}

void NRMA_freeInteractionHistoryList(void) {
NRMAInteractionHistoryNode* root = NRMA__getInteractionHistoryList();
while (root != NULL) {
if (root->name != NULL) {
free((void *)root->name);
root->name = NULL;
}

NRMAInteractionHistoryNode* temp = root;
root = root->next;
free((void *)temp);
}
NRMA__deallocInteractionHistoryList();
}

void NRMA_freeExceptionData(void) {
Expand Down
60 changes: 33 additions & 27 deletions Agent/CrashHandler/ExceptionDataInterface/NRMAInteractionHistory.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,34 @@ void NRMA__insertNode(NRMAInteractionHistoryNode* interaction);

void NRMA__AddInteraction(const char* interactionName, long long timestampMillis)
{

if (interactionName == NULL || strlen(interactionName) == 0) {
return;
}

NRMAInteractionHistoryNode* node = (NRMAInteractionHistoryNode*)malloc(sizeof(NRMAInteractionHistoryNode));
if (node != NULL) {
size_t len = strlen(interactionName);
if (len < 1) {
free(node);
return;
}
char* temp = malloc(sizeof(char) * (len+1));
if (temp == NULL) {
free(node);
// Failure case hit here.
return;
}
strncpy(temp, interactionName,len);
temp[len] = '\0';
node->name = temp;
node->timestampMillis = timestampMillis;

NRMA__insertNode(node);

if (node == NULL) {
return;
}

node->name = strdup(interactionName);
if (node->name == NULL) {
free(node);
return;
}
node->timestampMillis = timestampMillis;
node->next = NULL;

NRMA__insertNode(node);
}

void NRMA__insertNode(NRMAInteractionHistoryNode* interaction)
{
if (interaction == NULL) {
return;
}

interaction->next = __list;
__list = interaction;
}
Expand All @@ -59,14 +63,16 @@ NRMAInteractionHistoryNode* NRMA__getInteractionHistoryList(void)

void NRMA__deallocInteractionHistoryList(void)
{
NRMAInteractionHistoryNode* head = __list;
__list = NULL;
while (head != NULL) {
free((void*)head->name);
head->name = NULL;
NRMAInteractionHistoryNode* tmp = head->next;
free((void*)head);
head = NULL;
head = tmp;
NRMAInteractionHistoryNode* current = __list;
NRMAInteractionHistoryNode *next;

while (current != NULL) {
next = current->next;

free((void*)current->name);
free((void*)current);
current = next;
}

__list = NULL;
}
2 changes: 1 addition & 1 deletion Agent/DistributedTracing/W3CTraceParent.mm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ + (NSString *) getVersion {
return @"00";
}
+ (NSString *) getFlags {
return @"00";
return @"01";
}
+ (NSString *) getParentId {
return @"";
Expand Down
2 changes: 2 additions & 0 deletions Agent/FeatureFlags/NRMAFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@

+ (BOOL) shouldEnableBackgroundReporting;

+ (BOOL) shouldEnableAutoCollectLogs;

+ (NSArray<NSString*>*) namesForFlags:(NRMAFeatureFlags)flags;

// Private Setting
Expand Down
7 changes: 7 additions & 0 deletions Agent/FeatureFlags/NRMAFlags.m
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ + (BOOL) shouldEnableBackgroundReporting {
return ([NRMAFlags featureFlags] & NRFeatureFlag_BackgroundReporting) != 0;
}

+ (BOOL) shouldEnableAutoCollectLogs {
return ([NRMAFlags featureFlags] & NRFeatureFlag_AutoCollectLogs) != 0;
}

+ (NSArray<NSString*>*) namesForFlags:(NRMAFeatureFlags)flags {
NSMutableArray *retArray = [NSMutableArray array];
if ((flags & NRFeatureFlag_InteractionTracing) == NRFeatureFlag_InteractionTracing) {
Expand Down Expand Up @@ -239,6 +243,9 @@ + (BOOL) shouldEnableBackgroundReporting {
if ((flags & NRFeatureFlag_BackgroundReporting) == NRFeatureFlag_BackgroundReporting) {
[retArray addObject:@"BackgroundReporting"];
}
if ((flags & NRFeatureFlag_AutoCollectLogs) == NRFeatureFlag_AutoCollectLogs) {
[retArray addObject:@"AutoCollectLogs"];
}

return retArray;
}
Expand Down
Loading

0 comments on commit ea73a8b

Please sign in to comment.