-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github.com:newrelic/newrelic-ios-agent into…
… examples-merge
- Loading branch information
Showing
249 changed files
with
10,891 additions
and
72,258 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// AttributeValidatorProtocol.h | ||
// Agent | ||
// | ||
// Created by Steve Malsam on 6/15/23. | ||
// Copyright © 2023 New Relic. All rights reserved. | ||
// | ||
|
||
#ifndef AttributeValidatorProtocol_h | ||
#define AttributeValidatorProtocol_h | ||
|
||
typedef BOOL (^NameValidator)(NSString*); | ||
typedef BOOL (^ValueValidator)(id); | ||
typedef BOOL (^EventTypeValidator)(NSString*); | ||
|
||
@protocol AttributeValidatorProtocol <NSObject> | ||
|
||
- (BOOL)nameValidator:(NSString *)name; | ||
- (BOOL)valueValidator:(id)value; | ||
- (BOOL)eventTypeValidator:(NSString *)eventType; | ||
|
||
@end | ||
|
||
#endif /* AttributeValidatorProtocol_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// BlockAttributeValidator.h | ||
// Agent | ||
// | ||
// Created by Steve Malsam on 6/15/23. | ||
// Copyright © 2023 New Relic. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#import "AttributeValidatorProtocol.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface BlockAttributeValidator : NSObject <AttributeValidatorProtocol> | ||
|
||
@property (copy, readonly) NameValidator nameValidator; | ||
@property (copy, readonly) ValueValidator valueValidator; | ||
@property (copy, readonly) EventTypeValidator eventTypeValidator; | ||
|
||
- (instancetype)initWithNameValidator:(NameValidator)nameValidator | ||
valueValidator:(ValueValidator)valueValidator | ||
andEventTypeValidator:(EventTypeValidator)eventTypeValidator; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// BlockAttributeValidator.m | ||
// Agent | ||
// | ||
// Created by Steve Malsam on 6/15/23. | ||
// Copyright © 2023 New Relic. All rights reserved. | ||
// | ||
|
||
#import "BlockAttributeValidator.h" | ||
|
||
@implementation BlockAttributeValidator | ||
|
||
- (nonnull instancetype)initWithNameValidator:(nonnull NameValidator)nameValidator | ||
valueValidator:(nonnull ValueValidator)valueValidator | ||
andEventTypeValidator:(nonnull EventTypeValidator)eventTypeValidator { | ||
self = [super init]; | ||
if(self) { | ||
_nameValidator = nameValidator; | ||
_valueValidator = valueValidator; | ||
_eventTypeValidator = eventTypeValidator; | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (BOOL)eventTypeValidator:(NSString *)eventType { | ||
return self.eventTypeValidator(eventType); | ||
} | ||
|
||
- (BOOL)nameValidator:(NSString *)name { | ||
return self.nameValidator(name); | ||
} | ||
|
||
- (BOOL)valueValidator:(id)value { | ||
return self.valueValidator(value); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// | ||
// Constants.h | ||
// Agent | ||
// | ||
// Created by Mike Bruin on 8/9/23. | ||
// Copyright © 2023 New Relic. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
extern NSString *const kNRMA_RA_eventType; | ||
extern NSString *const kNRMA_RA_type; | ||
extern NSString *const kNRMA_RA_timestamp; | ||
extern NSString *const kNRMA_RA_category; | ||
extern NSString *const kNRMA_RA_accountId; | ||
extern NSString *const kNRMA_RA_appId; | ||
extern NSString *const kNRMA_RA_appName; | ||
extern NSString *const kNRMA_RA_uuid; | ||
extern NSString *const kNRMA_RA_sessionDuration; | ||
extern NSString *const kNRMA_RA_sessionElapsedTime; | ||
extern NSString *const kNRMA_RA_payload; | ||
extern NSString *const kNRMA_RA_InteractionDuration; | ||
extern NSString *const kNRMA_RA_osName; | ||
extern NSString *const kNRMA_RA_osVersion; | ||
extern NSString *const kNRMA_RA_osMajorVersion; | ||
extern NSString *const kNRMA_RA_deviceManufacturer; | ||
extern NSString *const kNRMA_RA_deviceModel; | ||
extern NSString *const kNRMA_RA_carrier; | ||
extern NSString *const kNRMA_RA_newRelicVersion; | ||
extern NSString *const kNRMA_RA_memUsageMb; | ||
extern NSString *const kNRMA_RA_sessionId; | ||
extern NSString *const kNRMA_RA_install; | ||
extern NSString *const kNRMA_RA_upgradeFrom; | ||
extern NSString *const kNRMA_RA_platform; | ||
extern NSString *const kNRMA_RA_platformVersion; | ||
extern NSString *const kNRMA_RA_lastInteraction; | ||
extern NSString *const kNRMA_RA_appDataHeader; | ||
extern NSString *const kNRMA_RA_responseBody; | ||
|
||
extern NSString *const kNRMA_RET_mobile; | ||
extern NSString *const kNRMA_RET_mobileSession; | ||
extern NSString *const kNRMA_RET_mobileRequest; | ||
extern NSString *const kNRMA_RET_mobileRequestError; | ||
extern NSString *const kNRMA_RET_mobileCrash; | ||
extern NSString *const kNRMA_RET_mobileBreadcrumb; | ||
extern NSString *const kNRMA_RET_mobileUserAction; | ||
|
||
extern NSString *const kNRMA_RA_methodExecuted; | ||
extern NSString *const kNRMA_RA_targetObject; | ||
extern NSString *const kNRMA_RA_label; | ||
extern NSString *const kNRMA_RA_accessibility; | ||
extern NSString *const kNRMA_RA_touchCoordinates; | ||
extern NSString *const kNMRA_RA_actionType; | ||
extern NSString *const kNRMA_RA_frame; | ||
extern NSString *const kNRMA_RA_orientation; | ||
|
||
extern NSString *const kNRMA_RP_newRelic; | ||
extern NSString *const kNRMA_RP_nr; | ||
|
||
extern NSString *const kNRMA_Attrib_guid; | ||
extern NSString *const kNRMA_Attrib_traceId; | ||
extern NSString *const kNRMA_Attrib_parentId; | ||
extern NSString *const kNRMA_Attrib_userId; | ||
|
||
extern NSString *const kNRMA_Attrib_connectionType; | ||
extern NSString *const kNRMA_Attrib_requestUrl; | ||
extern NSString *const kNRMA_Attrib_requestDomain; | ||
extern NSString *const kNRMA_Attrib_requestPath; | ||
extern NSString *const kNRMA_Attrib_requestMethod; | ||
extern NSString *const kNRMA_Attrib_bytesReceived; | ||
extern NSString *const kNRMA_Attrib_bytesSent; | ||
extern NSString *const kNRMA_Attrib_responseTime; | ||
extern NSString *const kNRMA_Attrib_statusCode; | ||
extern NSString *const kNRMA_Attrib_networkErrorCode; | ||
extern NSString *const kNRMA_Attrib_networkError; | ||
extern NSString *const kNRMA_Attrib_errorType; | ||
extern NSString *const kNRMA_Attrib_contentType; | ||
extern NSString *const kNRMA_Attrib_dtGuid; | ||
extern NSString *const kNRMA_Attrib_dtId; | ||
extern NSString *const kNRMA_Attrib_dtTraceId; | ||
extern NSString *const kNRMA_Attrib_name; | ||
|
||
extern NSString *const kNRMA_Val_errorType_HTTP; | ||
extern NSString *const kNRMA_Val_errorType_Network; | ||
|
||
extern NSString *const kNRMA_Attrib_file; | ||
extern NSString *const kNRMA_Attrib_file_private; | ||
|
||
|
||
// Integer Analytics Constants | ||
static int kNRMA_Attrib_Max_Name_Length = 256; | ||
static int kNRMA_Attrib_Max_Value_Size_Bytes = 4096; | ||
static int kNRMA_Attrib_Max_Number_Attributes = 128; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
// | ||
// Constants.m | ||
// Agent | ||
// | ||
// Created by Mike Bruin on 8/9/23. | ||
// Copyright © 2023 New Relic. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "Constants.h" | ||
|
||
NSString * const kNRMA_RA_eventType = @"eventType"; | ||
NSString * const kNRMA_RA_type = @"type"; | ||
NSString * const kNRMA_RA_timestamp = @"timestamp"; | ||
NSString * const kNRMA_RA_category = @"category"; | ||
NSString * const kNRMA_RA_accountId = @"accountId"; | ||
NSString * const kNRMA_RA_appId = @"appId"; | ||
NSString * const kNRMA_RA_appName = @"appName"; | ||
NSString * const kNRMA_RA_uuid = @"uuid"; | ||
NSString * const kNRMA_RA_sessionDuration = @"sessionDuration"; | ||
NSString * const kNRMA_RA_sessionElapsedTime = @"timeSinceLoad"; | ||
NSString * const kNRMA_RA_payload = @"payload"; | ||
NSString * const kNRMA_RA_InteractionDuration = @"interactionDuration"; | ||
NSString * const kNRMA_RA_osName = @"osName"; | ||
NSString * const kNRMA_RA_osVersion = @"osVersion"; | ||
NSString * const kNRMA_RA_osMajorVersion = @"osMajorVersion"; | ||
NSString * const kNRMA_RA_deviceManufacturer = @"deviceManufacturer"; | ||
NSString * const kNRMA_RA_deviceModel = @"deviceModel"; | ||
NSString * const kNRMA_RA_carrier = @"carrier"; | ||
NSString * const kNRMA_RA_newRelicVersion = @"newRelicVersion"; | ||
NSString * const kNRMA_RA_memUsageMb = @"memUsageMb"; | ||
NSString * const kNRMA_RA_sessionId = @"sessionId"; | ||
NSString * const kNRMA_RA_install = @"install"; | ||
NSString * const kNRMA_RA_upgradeFrom = @"upgradeFrom"; | ||
NSString * const kNRMA_RA_platform = @"platform"; | ||
NSString * const kNRMA_RA_platformVersion = @"platformVersion"; | ||
NSString * const kNRMA_RA_lastInteraction = @"lastInteraction"; | ||
NSString * const kNRMA_RA_appDataHeader = @"nr.X-NewRelic-App-Data"; | ||
NSString * const kNRMA_RA_responseBody = @"nr.responseBody"; | ||
|
||
//reserved mobile eventTypes | ||
NSString * const kNRMA_RET_mobile = @"Mobile"; | ||
NSString * const kNRMA_RET_mobileSession = @"MobileSession"; | ||
NSString * const kNRMA_RET_mobileRequest = @"MobileRequest"; | ||
NSString * const kNRMA_RET_mobileRequestError = @"MobileRequestError"; | ||
NSString * const kNRMA_RET_mobileCrash = @"MobileCrash"; | ||
NSString * const kNRMA_RET_mobileBreadcrumb = @"MobileBreadcrumb"; | ||
NSString * const kNRMA_RET_mobileUserAction = @"MobileUserAction"; | ||
|
||
//gesture attributes (not reserved) | ||
NSString * const kNRMA_RA_methodExecuted = @"methodExecuted"; | ||
NSString * const kNRMA_RA_targetObject = @"targetObject"; | ||
NSString * const kNRMA_RA_label = @"label"; | ||
NSString * const kNRMA_RA_accessibility = @"accessibility"; | ||
NSString * const kNRMA_RA_touchCoordinates = @"touchCoordinates"; | ||
NSString * const kNMRA_RA_actionType = @"actionType"; | ||
NSString * const kNRMA_RA_frame = @"controlRect"; | ||
NSString * const kNRMA_RA_orientation = @"orientation"; | ||
//reserved prefix | ||
NSString * const kNRMA_RP_newRelic = @"newRelic"; | ||
NSString * const kNRMA_RP_nr = @"nr."; | ||
|
||
//Intrinsic Event Attributes (not reserved) | ||
NSString * const kNRMA_Attrib_guid = @"guid"; | ||
NSString * const kNRMA_Attrib_traceId = @"traceId"; | ||
NSString * const kNRMA_Attrib_parentId = @"nr.parentId"; | ||
NSString * const kNRMA_Attrib_userId = @"userId"; | ||
|
||
//Request Event Attributes (not reserved) | ||
NSString * const kNRMA_Attrib_connectionType = @"connectionType"; | ||
NSString * const kNRMA_Attrib_requestUrl = @"requestUrl"; | ||
NSString * const kNRMA_Attrib_requestDomain = @"requestDomain"; | ||
NSString * const kNRMA_Attrib_requestPath = @"requestPath"; | ||
NSString * const kNRMA_Attrib_requestMethod = @"requestMethod"; | ||
NSString * const kNRMA_Attrib_bytesReceived = @"bytesReceived"; | ||
NSString * const kNRMA_Attrib_bytesSent = @"bytesSent"; | ||
NSString * const kNRMA_Attrib_responseTime = @"responseTime"; | ||
NSString * const kNRMA_Attrib_statusCode = @"statusCode"; | ||
NSString * const kNRMA_Attrib_networkErrorCode = @"networkErrorCode"; | ||
NSString * const kNRMA_Attrib_networkError = @"networkError"; | ||
NSString * const kNRMA_Attrib_errorType = @"errorType"; | ||
NSString * const kNRMA_Attrib_contentType = @"contentType"; | ||
NSString * const kNRMA_Attrib_dtGuid = @"guid"; | ||
NSString * const kNRMA_Attrib_dtId = @"id"; | ||
NSString * const kNRMA_Attrib_dtTraceId = @"trace.id"; | ||
NSString * const kNRMA_Attrib_name = @"name"; | ||
|
||
NSString * const kNRMA_Val_errorType_HTTP = @"HTTPError"; | ||
NSString * const kNRMA_Val_errorType_Network = @"NetworkFailure"; | ||
|
||
|
||
NSString * const kNRMA_Attrib_file = @"attributes.txt"; | ||
NSString * const kNRMA_Attrib_file_private = @"privateAttributes.txt"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// NRMAAnalyticEventProtocol.h | ||
// Agent | ||
// | ||
// Created by Steve Malsam on 6/8/23. | ||
// Copyright © 2023 New Relic. All rights reserved. | ||
// | ||
|
||
#ifndef NRMAAnalyticEventProtocol_h | ||
#define NRMAAnalyticEventProtocol_h | ||
|
||
#import "NRMAJSON.h" | ||
|
||
@protocol NRMAAnalyticEventProtocol <NSObject, NRMAJSONABLE> | ||
|
||
@property NSTimeInterval timestamp; | ||
@property NSTimeInterval sessionElapsedTimeSeconds; | ||
@property (nonatomic) NSString *eventType; | ||
|
||
|
||
- (BOOL) addAttribute:(NSString *)name value:(id)value; | ||
- (NSTimeInterval)getEventAge; | ||
|
||
@end | ||
|
||
#endif /* NRMAAnalyticEventProtocol_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// NRMACustomEvent.h | ||
// Agent | ||
// | ||
// Created by Steve Malsam on 6/13/23. | ||
// Copyright © 2023 New Relic. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#import "NRMAMobileEvent.h" | ||
#import "AttributeValidatorProtocol.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface NRMACustomEvent : NRMAMobileEvent | ||
|
||
- (instancetype) initWithEventType:(NSString *)eventType | ||
timestamp:(NSTimeInterval)timestamp | ||
sessionElapsedTimeInSeconds:(NSTimeInterval)sessionElapsedTimeSeconds | ||
withAttributeValidator:(__nullable id<AttributeValidatorProtocol>) attributeValidator; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
Oops, something went wrong.