Skip to content

Commit

Permalink
Merge pull request #219 from newrelic/staging
Browse files Browse the repository at this point in the history
iOS 7.4.10 release staging -> main
  • Loading branch information
smalsam-newr authored Mar 21, 2024
2 parents 99ea206 + 55d4429 commit ec65b5a
Show file tree
Hide file tree
Showing 26 changed files with 373 additions and 130 deletions.
56 changes: 28 additions & 28 deletions Agent.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -4990,9 +4990,9 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7.4.9;
CURRENT_PROJECT_VERSION = 7.4.10;
DEVELOPMENT_TEAM = RQZ9D969HD;
DYLIB_CURRENT_VERSION = 7.4.9;
DYLIB_CURRENT_VERSION = 7.4.10;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
Expand Down Expand Up @@ -5043,9 +5043,9 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7.4.9;
CURRENT_PROJECT_VERSION = 7.4.10;
DEVELOPMENT_TEAM = SU7SUNGZJP;
DYLIB_CURRENT_VERSION = 7.4.9;
DYLIB_CURRENT_VERSION = 7.4.10;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_C_LANGUAGE_STANDARD = "compiler-default";
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
Expand Down Expand Up @@ -5118,10 +5118,10 @@
CODE_SIGN_IDENTITY = "Apple Development: [email protected] (3ZGR4484Y2)";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 7.4.9;
CURRENT_PROJECT_VERSION = 7.4.10;
DEBUG_INFORMATION_FORMAT = dwarf;
DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING = YES;
DYLIB_CURRENT_VERSION = 7.4.9;
DYLIB_CURRENT_VERSION = 7.4.10;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = c99;
Expand Down Expand Up @@ -5193,10 +5193,10 @@
CODE_SIGN_IDENTITY = "Apple Development: [email protected] (3ZGR4484Y2)";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 7.4.9;
CURRENT_PROJECT_VERSION = 7.4.10;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DISABLE_MANUAL_TARGET_ORDER_BUILD_WARNING = YES;
DYLIB_CURRENT_VERSION = 7.4.9;
DYLIB_CURRENT_VERSION = 7.4.10;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = c99;
Expand Down Expand Up @@ -5237,12 +5237,12 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 7.4.9;
CURRENT_PROJECT_VERSION = 7.4.10;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = SU7SUNGZJP;
"DEVELOPMENT_TEAM[sdk=macosx*]" = SU7SUNGZJP;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 7.4.9;
DYLIB_CURRENT_VERSION = 7.4.10;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -5266,7 +5266,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 7.4.9;
MARKETING_VERSION = 7.4.10;
MODULEMAP_FILE = agent.modulemap;
OTHER_CFLAGS = "$(inherited";
OTHER_LDFLAGS = "";
Expand Down Expand Up @@ -5297,11 +5297,11 @@
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Distribution: New Relic Inc (SU7SUNGZJP)";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 7.4.9;
CURRENT_PROJECT_VERSION = 7.4.10;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = SU7SUNGZJP;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 7.4.9;
DYLIB_CURRENT_VERSION = 7.4.10;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -5323,7 +5323,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 7.4.9;
MARKETING_VERSION = 7.4.10;
MODULEMAP_FILE = agent.modulemap;
OTHER_CFLAGS = "$(inherited";
OTHER_LDFLAGS = "";
Expand All @@ -5348,9 +5348,9 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7.4.9;
CURRENT_PROJECT_VERSION = 7.4.10;
DEVELOPMENT_TEAM = RQZ9D969HD;
DYLIB_CURRENT_VERSION = 7.4.9;
DYLIB_CURRENT_VERSION = 7.4.10;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Frameworks",
Expand Down Expand Up @@ -5405,9 +5405,9 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7.4.9;
CURRENT_PROJECT_VERSION = 7.4.10;
DEVELOPMENT_TEAM = SU7SUNGZJP;
DYLIB_CURRENT_VERSION = 7.4.9;
DYLIB_CURRENT_VERSION = 7.4.10;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Frameworks",
Expand Down Expand Up @@ -5454,9 +5454,9 @@
CLANG_ENABLE_CODE_COVERAGE = YES;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7.4.9;
CURRENT_PROJECT_VERSION = 7.4.10;
DEVELOPMENT_TEAM = SU7SUNGZJP;
DYLIB_CURRENT_VERSION = 7.4.9;
DYLIB_CURRENT_VERSION = 7.4.10;
HEADER_SEARCH_PATHS = (
"${PROJECT_DIR}/UnitTests/",
"${SRCROOT}/**",
Expand Down Expand Up @@ -5493,9 +5493,9 @@
CLANG_ENABLE_CODE_COVERAGE = YES;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "-";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 7.4.9;
CURRENT_PROJECT_VERSION = 7.4.10;
DEVELOPMENT_TEAM = SU7SUNGZJP;
DYLIB_CURRENT_VERSION = 7.4.9;
DYLIB_CURRENT_VERSION = 7.4.10;
HEADER_SEARCH_PATHS = (
"${PROJECT_DIR}/UnitTests/",
"${SRCROOT}/**",
Expand Down Expand Up @@ -5533,12 +5533,12 @@
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "Apple Development";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 7.4.9;
CURRENT_PROJECT_VERSION = 7.4.10;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = SU7SUNGZJP;
"DEVELOPMENT_TEAM[sdk=appletvos*]" = SU7SUNGZJP;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 7.4.9;
DYLIB_CURRENT_VERSION = 7.4.10;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -5560,7 +5560,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 7.4.9;
MARKETING_VERSION = 7.4.10;
MODULEMAP_FILE = agent.modulemap;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.newrelic.Agent;
Expand All @@ -5586,11 +5586,11 @@
CODE_SIGN_IDENTITY = "Apple Distribution: New Relic Inc (SU7SUNGZJP)";
CODE_SIGN_STYLE = Manual;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 7.4.9;
CURRENT_PROJECT_VERSION = 7.4.10;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = SU7SUNGZJP;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 7.4.9;
DYLIB_CURRENT_VERSION = 7.4.10;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -5611,7 +5611,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 7.4.9;
MARKETING_VERSION = 7.4.10;
MODULEMAP_FILE = agent.modulemap;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = com.newrelic.Agent;
Expand Down
1 change: 1 addition & 0 deletions Agent/Analytics/NRMAAnalytics.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
+ (NSString*) getLastSessionsEvents;
- (void) clearLastSessionsAnalytics;

- (BOOL) checkOfflineStatus;

//this utilizes setSessionAttribute:value: which validates the user input 'name'.
- (BOOL) setLastInteraction:(NSString*)name;
Expand Down
30 changes: 25 additions & 5 deletions Agent/Analytics/NRMAAnalytics.mm
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ - (BOOL) addInteractionEvent:(NSString*)name

return [_eventManager addEvent:[event autorelease]];
} else {
return _analyticsController->addInteractionEvent([name UTF8String], duration_secs);
return _analyticsController->addInteractionEvent([name UTF8String], duration_secs, [self checkOfflineStatus]);
}
}

Expand Down Expand Up @@ -506,7 +506,7 @@ - (BOOL)addNetworkRequestEvent:(NRMANetworkRequestData *)requestData
if ([NRMAFlags shouldEnableNetworkRequestEvents]) {
NewRelic::NetworkRequestData* networkRequestData = [requestData getNetworkRequestData];
NewRelic::NetworkResponseData* networkResponseData = [responseData getNetworkResponseData];
return _analyticsController->addRequestEvent(*networkRequestData, *networkResponseData, std::move(payload));
return _analyticsController->addRequestEvent(*networkRequestData, *networkResponseData, std::move(payload), [self checkOfflineStatus]);
}
return NO;
}
Expand All @@ -518,7 +518,7 @@ - (BOOL)addNetworkErrorEvent:(NRMANetworkRequestData *)requestData
NewRelic::NetworkRequestData* networkRequestData = [requestData getNetworkRequestData];
NewRelic::NetworkResponseData* networkResponseData = [responseData getNetworkResponseData];

return _analyticsController->addNetworkErrorEvent(*networkRequestData, *networkResponseData,std::move(payload));
return _analyticsController->addNetworkErrorEvent(*networkRequestData, *networkResponseData,std::move(payload), [self checkOfflineStatus]);
}

return NO;
Expand All @@ -531,7 +531,7 @@ - (BOOL)addHTTPErrorEvent:(NRMANetworkRequestData *)requestData
NewRelic::NetworkRequestData* networkRequestData = [requestData getNetworkRequestData];
NewRelic::NetworkResponseData* networkResponseData = [responseData getNetworkResponseData];

return _analyticsController->addHTTPErrorEvent(*networkRequestData, *networkResponseData, std::move(payload));
return _analyticsController->addHTTPErrorEvent(*networkRequestData, *networkResponseData, std::move(payload), [self checkOfflineStatus]);
}
return NO;
}
Expand Down Expand Up @@ -749,6 +749,9 @@ - (BOOL) addEventNamed:(NSString*)name withAttributes:(NSDictionary*)attributes
}

if ([self event:event withAttributes:attributes]) {
if([self checkOfflineStatus]){
event->addAttribute(kNRMA_Attrib_offline.UTF8String, @YES.boolValue);
}
return _analyticsController->addEvent(event);
}
} catch (std::exception& e){
Expand Down Expand Up @@ -801,6 +804,9 @@ - (BOOL) addBreadcrumb:(NSString*)name

if ([self event:event withAttributes:attributes]) {
event->addAttribute("name",name.UTF8String);
if([self checkOfflineStatus]){
event->addAttribute(kNRMA_Attrib_offline.UTF8String, @YES.boolValue);
}
return _analyticsController->addEvent(event);
}
} catch (std::exception& e){
Expand Down Expand Up @@ -855,8 +861,11 @@ - (BOOL) addCustomEvent:(NSString*)eventType
NRLOG_ERROR(@"Unable to create event with name: \"%@\"",eventType);
return NO;
}

if([self event:event withAttributes:attributes]) {
if([self checkOfflineStatus]){
event->addAttribute(kNRMA_Attrib_offline.UTF8String, @YES.boolValue);
}
return _analyticsController->addEvent(event);
}
}
Expand Down Expand Up @@ -895,6 +904,17 @@ - (BOOL) event:(std::shared_ptr<AnalyticEvent>)event withAttributes:(NSDictionar
return YES;
}

- (BOOL) checkOfflineStatus {
if([NRMAFlags shouldEnableOfflineStorage]) {
NRMAReachability* r = [NewRelicInternalUtils reachability];
@synchronized(r) {
NRMANetworkStatus status = [r currentReachabilityStatus];
return (status == NotReachable);
}
}
return false;
}

- (BOOL)recordUserAction:(NRMAUserAction *)userAction {
if (userAction == nil) { return NO; };

Expand Down
3 changes: 1 addition & 2 deletions Agent/FeatureFlags/NRMAFlags.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ + (NRMAFeatureFlags) featureFlags
NRFeatureFlag_NetworkRequestEvents |
NRFeatureFlag_RequestErrorEvents |
NRFeatureFlag_DistributedTracing |
NRFeatureFlag_AppStartMetrics |
NRFeatureFlag_OfflineStorage;
NRFeatureFlag_AppStartMetrics;
});
return __flags;
}
Expand Down
13 changes: 7 additions & 6 deletions Agent/HandledException/NRMAHexUploader.m
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ - (void) URLSession:(NSURLSession*)session
dataTask:(NSURLSessionDataTask*)dataTask
didReceiveResponse:(NSURLResponse*)response
completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler {
NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)response;

NSInteger statusCode = httpResponse.statusCode;
// NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)response;
//
// NSInteger statusCode = httpResponse.statusCode;

NRLOG_VERBOSE(@"NEWRELIC HEX UPLOADER - Hex Upload response: %@", httpResponse);
NRLOG_VERBOSE(@"NEWRELIC HEX UPLOADER - Hex Upload response: %@", response);

if (statusCode >= 400) {
NRLOG_ERROR(@"NEWRELIC HEX UPLOADER - failed to upload handled exception report: %@", httpResponse.description);
if ([response isKindOfClass:[NSHTTPURLResponse class]] &&
((NSHTTPURLResponse*)response).statusCode >= 400) {
NRLOG_ERROR(@"NEWRELIC HEX UPLOADER - failed to upload handled exception report: %@", response.description);
[self handledErroredRequest:dataTask.originalRequest];
}
else {
Expand Down
2 changes: 1 addition & 1 deletion Agent/Harvester/DataStore/NRMAAgentConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@
+ (void) setMaxEventBufferSize:(NSUInteger)size;
+ (NSUInteger) getMaxEventBufferSize;

+ (void) setMaxOfflineStorageSize:(NSUInteger)megaBytes;
+ (void) setMaxOfflineStorageSize:(NSUInteger)megabytes;
+ (NSUInteger) getMaxOfflineStorageSize;
@end
4 changes: 2 additions & 2 deletions Agent/Harvester/DataStore/NRMAAgentConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ + (NSUInteger) getMaxEventBufferSize {
return __NRMA__maxEventBufferSize;
}

+ (void) setMaxOfflineStorageSize:(NSUInteger)megaBytes {
__NRMA__maxOfflineStorageSize = megaBytes;
+ (void) setMaxOfflineStorageSize:(NSUInteger)megabytes {
__NRMA__maxOfflineStorageSize = megabytes;
}

+ (NSUInteger) getMaxOfflineStorageSize {
Expand Down
1 change: 1 addition & 0 deletions Agent/Harvester/NRMAHarvesterConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ - (id) init

-(void) sendOfflineStorage {
if (![NRMAFlags shouldEnableOfflineStorage]) {
[NRMAOfflineStorage clearAllOfflineDirectories];
return;
}
NSArray<NSData *> * offlineData = [self.offlineStorage getAllOfflineData:YES];
Expand Down
Loading

0 comments on commit ec65b5a

Please sign in to comment.