Skip to content

Commit e80fc0b

Browse files
Merge pull request #272 from newrelic/prod75
New Relic iOS agent 7.5.0 (Production)
2 parents 9e1a24f + ae8e415 commit e80fc0b

File tree

156 files changed

+4152
-1110
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+4152
-1110
lines changed

.github/workflows/main.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,39 @@ jobs:
7070

7171
- name: Run tests on tvOS (using fastlane)
7272
run: bundle exec fastlane runTVOSTests
73+
74+
testWatchOS:
75+
name : TestWatchOS
76+
# runs-on: will be set to macos-latest when running on actual GHA.
77+
# *** runs-on: ubuntu-latest is used when running via act on mac os. ***
78+
runs-on: macos-latest
79+
steps:
80+
- uses: actions/checkout@v3
81+
with:
82+
submodules: true
83+
84+
- uses: maxim-lobanov/setup-xcode@v1
85+
with:
86+
xcode-version: '14.3'
87+
88+
- name: Install lcov
89+
run: brew install lcov
90+
91+
- name: Update gem
92+
run: bundle update
93+
94+
- name: Install gems
95+
run: bundle install
96+
97+
- name: Run tests on watchOS (using fastlane)
98+
run: bundle exec fastlane runWatchOSTests
99+
73100
deployS3:
74101
name: DeployS3
75102
# runs-on: will be set to macos-latest when running on actual GHA.
76103
# *** runs-on: ubuntu-latest is used when running via act on mac os. ***
77104
runs-on: macos-13
78-
needs: [testIOS, testTVOS]
105+
needs: [testIOS, testTVOS, testWatchOS]
79106
if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/main'
80107
outputs:
81108
version: ${{ steps.setOutput.outputs.version }}

Agent.xcodeproj/project.pbxproj

Lines changed: 1406 additions & 38 deletions
Large diffs are not rendered by default.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1530"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES"
8+
buildArchitectures = "Automatic">
9+
<BuildActionEntries>
10+
<BuildActionEntry
11+
buildForTesting = "YES"
12+
buildForRunning = "YES"
13+
buildForProfiling = "YES"
14+
buildForArchiving = "YES"
15+
buildForAnalyzing = "YES">
16+
<BuildableReference
17+
BuildableIdentifier = "primary"
18+
BlueprintIdentifier = "348232212BC5EEE60070FAC3"
19+
BuildableName = "NewRelic.framework"
20+
BlueprintName = "Agent-watchOS"
21+
ReferencedContainer = "container:Agent.xcodeproj">
22+
</BuildableReference>
23+
</BuildActionEntry>
24+
</BuildActionEntries>
25+
</BuildAction>
26+
<TestAction
27+
buildConfiguration = "Debug"
28+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
29+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
30+
shouldUseLaunchSchemeArgsEnv = "YES">
31+
<TestPlans>
32+
<TestPlanReference
33+
reference = "container:Tests/Agent-watchOS.xctestplan"
34+
default = "YES">
35+
</TestPlanReference>
36+
</TestPlans>
37+
</TestAction>
38+
<LaunchAction
39+
buildConfiguration = "Debug"
40+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
41+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
42+
launchStyle = "0"
43+
useCustomWorkingDirectory = "NO"
44+
ignoresPersistentStateOnLaunch = "NO"
45+
debugDocumentVersioning = "YES"
46+
debugServiceExtension = "internal"
47+
allowLocationSimulation = "YES">
48+
</LaunchAction>
49+
<ProfileAction
50+
buildConfiguration = "Release"
51+
shouldUseLaunchSchemeArgsEnv = "YES"
52+
savedToolIdentifier = ""
53+
useCustomWorkingDirectory = "NO"
54+
debugDocumentVersioning = "YES">
55+
<MacroExpansion>
56+
<BuildableReference
57+
BuildableIdentifier = "primary"
58+
BlueprintIdentifier = "348232212BC5EEE60070FAC3"
59+
BuildableName = "NewRelic.framework"
60+
BlueprintName = "Agent-watchOS"
61+
ReferencedContainer = "container:Agent.xcodeproj">
62+
</BuildableReference>
63+
</MacroExpansion>
64+
</ProfileAction>
65+
<AnalyzeAction
66+
buildConfiguration = "Debug">
67+
</AnalyzeAction>
68+
<ArchiveAction
69+
buildConfiguration = "Release"
70+
revealArchiveInOrganizer = "YES">
71+
</ArchiveAction>
72+
</Scheme>

Agent.xcworkspace/contents.xcworkspacedata

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Agent/ActivityTracing/NRMAActivityNameGenerator.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ + (NSString*) generateActivityNameFromClass:(Class)cls selector:(SEL)selector
2020
NSString* name = nil;
2121
NSString* class = [self translationNameFromClass:NSStringFromClass(cls)];
2222
NSString* sel = NSStringFromSelector(selector);
23+
#if !TARGET_OS_WATCH
2324
if ([cls isSubclassOfClass:[UIViewController class]]) {
2425
if ([kNRMA_selector_viewDidLoad isEqualToString:sel] ||
2526
[kNRMA_selector_viewWillAppear isEqualToString:sel]) {
@@ -28,6 +29,9 @@ + (NSString*) generateActivityNameFromClass:(Class)cls selector:(SEL)selector
2829
} else {
2930
name = class;
3031
}
32+
#else
33+
name = class;
34+
#endif
3135

3236
return name;
3337
}

Agent/ActivityTracing/NRMALastActivityTraceController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ + (void) storeLastActivityStampWithName:(NSString*)name
2020
duration:(NSNumber*)durationMillis
2121
{
2222
if (name == nil || timestampMillis == nil || durationMillis == nil) {
23-
NRLOG_VERBOSE(@"Attempted to store last activity with incomplete data.");
23+
NRLOG_AGENT_VERBOSE(@"Attempted to store last activity with incomplete data.");
2424
return;
2525
}
2626
@synchronized(kNRMALastExecutedActivityLock) {

Agent/ActivityTracing/NRMAThreadLocalStore.m

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ + (NRMATrace*)threadLocalTrace
4242
+ (void)setThreadRootTrace:(NRMATrace *)root
4343
{
4444
if (root == nil) {
45-
NRLOG_VERBOSE(@"Attempted to load a nil trace.");
45+
NRLOG_AGENT_VERBOSE(@"Attempted to load a nil trace.");
4646
return;
4747
}
4848

@@ -55,7 +55,7 @@ + (void)setThreadRootTrace:(NRMATrace *)root
5555
[stack addObject:root];
5656
}
5757

58-
NRLOG_VERBOSE(@"Trace %@ is now active", root);
58+
NRLOG_AGENT_VERBOSE(@"Trace %@ is now active", root);
5959
}
6060

6161
/** delete thread-local data on all threads */
@@ -77,7 +77,7 @@ + (void)destroyStore
7777
+ (BOOL) pushChild:(NRMATrace *)childTrace forParent:(NRMATrace *)parentTrace
7878
{
7979
if (childTrace == nil || parentTrace == nil) {
80-
NRLOG_VERBOSE(@"<Activity: \"%@\"> Trace enterMethod has nil child or parent trace segment. p=%@, c=%@",[NRMATraceController getCurrentActivityName], parentTrace, childTrace);
80+
NRLOG_AGENT_VERBOSE(@"<Activity: \"%@\"> Trace enterMethod has nil child or parent trace segment. p=%@, c=%@",[NRMATraceController getCurrentActivityName], parentTrace, childTrace);
8181
return NO;
8282
}
8383
BOOL parentIsOnSameThread = [self isThreadMatchForChild:childTrace parent:parentTrace];
@@ -101,7 +101,7 @@ + (int) prepareNewThread:(NSMutableArray*)stack child:(NRMATrace*)child withPare
101101
{
102102
int error = 0;
103103
if (stack.count > 0) {
104-
NRLOG_VERBOSE(@"<Activity: \"%@\"> thread local stack is not empty! Entering thread %ud from %ud, p=%@, c=%@, stack=%@",
104+
NRLOG_AGENT_VERBOSE(@"<Activity: \"%@\"> thread local stack is not empty! Entering thread %ud from %ud, p=%@, c=%@, stack=%@",
105105
[NRMATraceController getCurrentActivityName],
106106
child.threadInfo.identity,
107107
parent.threadInfo.identity,
@@ -125,7 +125,7 @@ + (int) prepareSameThread:(NSMutableArray*)stack child:(NRMATrace*)child withPar
125125

126126
if ([NRMAThreadLocalStore threadLocalTrace] != parent) {
127127
if (![self validateIsSerialParent:parent child:child]) {
128-
NRLOG_ERROR(@"<Activity: \"%@\"> threadLocalTrace is not parentTrace! On thread %ud, p=%@, c=%@, f=%@, stack=%@",
128+
NRLOG_AGENT_ERROR(@"<Activity: \"%@\"> threadLocalTrace is not parentTrace! On thread %ud, p=%@, c=%@, f=%@, stack=%@",
129129
[NRMATraceController getCurrentActivityName],
130130
child.threadInfo.identity,
131131
parent, child, [NRMAThreadLocalStore threadLocalTrace], stack);
@@ -138,7 +138,7 @@ + (int) prepareSameThread:(NSMutableArray*)stack child:(NRMATrace*)child withPar
138138
} else if ([stack lastObject] != parent) {
139139
if (![self validateIsSerialParent:parent child:child]) {
140140

141-
NRLOG_ERROR(@"<Activity: \"%@\"> parentTrace is not at bottom of threadLocalStack! On thread %ud, p=%@, c=%@, f=%@, stack=%@",
141+
NRLOG_AGENT_ERROR(@"<Activity: \"%@\"> parentTrace is not at bottom of threadLocalStack! On thread %ud, p=%@, c=%@, f=%@, stack=%@",
142142
[NRMATraceController getCurrentActivityName],
143143
child.threadInfo.identity,
144144
parent, child, [NRMAThreadLocalStore threadLocalTrace], stack);
@@ -184,12 +184,12 @@ + (BOOL)popCurrentTraceIfEqualTo:(NRMATrace*)trace returningParent:(NRMATrace *_
184184
if (trace.threadInfo.identity != pthread_mach_thread_np(pthread_self()))
185185
{
186186
// whoops, trace is on the wrong thread
187-
NRLOG_VERBOSE(@"<Activity: \"%@\"> popCurrentTrace: exited trace is not on the current thread! et=%@, tlc=%@",[NRMATraceController getCurrentActivityName], trace, currentTrace);
187+
NRLOG_AGENT_VERBOSE(@"<Activity: \"%@\"> popCurrentTrace: exited trace is not on the current thread! et=%@, tlc=%@",[NRMATraceController getCurrentActivityName], trace, currentTrace);
188188
return NO;
189189
}
190190

191191
if (trace != currentTrace) {
192-
NRLOG_VERBOSE(@"<Activity: \"%@\"> popCurrentTrace: exited trace is not the current threadLocalTrace. et=%@, tlc=%@",[NRMATraceController getCurrentActivityName], trace, currentTrace);
192+
NRLOG_AGENT_VERBOSE(@"<Activity: \"%@\"> popCurrentTrace: exited trace is not the current threadLocalTrace. et=%@, tlc=%@",[NRMATraceController getCurrentActivityName], trace, currentTrace);
193193
}
194194

195195
if ([stack lastObject] != trace) {
@@ -205,7 +205,7 @@ + (BOOL)popCurrentTraceIfEqualTo:(NRMATrace*)trace returningParent:(NRMATrace *_
205205
}
206206
else
207207
{
208-
NRLOG_VERBOSE(@"<Activity: \"%@\"> popCurrentTrace: exited trace is not on the current stack! et=%@, tlc=%@",[NRMATraceController getCurrentActivityName], trace, stack);
208+
NRLOG_AGENT_VERBOSE(@"<Activity: \"%@\"> popCurrentTrace: exited trace is not on the current stack! et=%@, tlc=%@",[NRMATraceController getCurrentActivityName], trace, stack);
209209
}
210210

211211
*parent = [stack lastObject];
@@ -262,7 +262,7 @@ + (NSMutableArray*)threadLocalStack {
262262
+ (void) setThreadLocalTrace:(NRMATrace*)trace
263263
{
264264
if (trace == nil) {
265-
NRLOG_ERROR(@"Attempted to set a nil trace to the thread local dictionary");
265+
NRLOG_AGENT_ERROR(@"Attempted to set a nil trace to the thread local dictionary");
266266
return;
267267
}
268268

Agent/ActivityTracing/NRMATrace.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ - (void) consumeMeasurement:(NRMAMeasurement *)measurement {
9595
if ([measurement isKindOfClass:[NRMAHTTPTransactionMeasurement class]]) {
9696
NSDate* sessionStartDate = [[NewRelicAgentInternal sharedInstance] getAppSessionStartDate];
9797
if(((NRMAHTTPTransactionMeasurement*)measurement).startTime < [sessionStartDate timeIntervalSince1970]*1000) {
98-
NRLOG_WARNING(@"Trace machine ignoring network transaction older than session. Session started at %@, where network transaction began %f milliseconds prior.",sessionStartDate, [sessionStartDate timeIntervalSince1970]*1000 - ((NRMAHTTPTransactionMeasurement*)measurement).startTime);
98+
NRLOG_AGENT_WARNING(@"Trace machine ignoring network transaction older than session. Session started at %@, where network transaction began %f milliseconds prior.",sessionStartDate, [sessionStartDate timeIntervalSince1970]*1000 - ((NRMAHTTPTransactionMeasurement*)measurement).startTime);
9999
return;
100100
}
101101
_networkTimeMillis += ((NRMAHTTPTransactionMeasurement*)measurement).totalTime;

Agent/ActivityTracing/NRMATraceController.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ + (void) startTracingWithName:(NSString *)name interactionObject:(id __unsafe_un
152152
return;
153153
}
154154

155-
NRLOG_VERBOSE(@"\"%@\" Activity started", name);
155+
NRLOG_AGENT_VERBOSE(@"\"%@\" Activity started", name);
156156
[NRMATraceController startTracing:NO];
157157
[[[NewRelicAgentInternal sharedInstance] analyticsController] setLastInteraction:name];
158158
NRMATraceMachine* traceMach = [self traceMachine];
@@ -190,7 +190,7 @@ + (NRMATrace*) startTracing:(BOOL)persistentTrace
190190
rootTrace.name = @"UI_Thread";
191191
rootTrace.entryTimestamp = NRMAMillisecondTimestamp();
192192

193-
NRLOG_VERBOSE(@"Started activity with root trace : %@", rootTrace);
193+
NRLOG_AGENT_VERBOSE(@"Started activity with root trace : %@", rootTrace);
194194

195195
[NRMATraceController startTracingWithRootTrace:rootTrace];
196196

@@ -254,7 +254,7 @@ + (BOOL) completeActivityTraceWithExitTimestampMillis:(double)exitTimestampMilli
254254
}
255255

256256
if(![NRMATraceController isTracingActive]) {
257-
NRLOG_VERBOSE(@"completeTrace called while no trace was running.");
257+
NRLOG_AGENT_VERBOSE(@"completeTrace called while no trace was running.");
258258
return NO;
259259
}
260260
#ifndef DISABLE_NRMA_EXCEPTION_WRAPPER
@@ -265,7 +265,7 @@ + (BOOL) completeActivityTraceWithExitTimestampMillis:(double)exitTimestampMilli
265265
[traceMach invalidateTimers]; //invalidate any timers that might be running.
266266

267267
NRMAActivityTrace *activityTrace = traceMach.activityTrace;
268-
NRLOG_VERBOSE(@"\"%@\" Activity Completed.", activityTrace.name);
268+
NRLOG_AGENT_VERBOSE(@"\"%@\" Activity Completed.", activityTrace.name);
269269

270270

271271
[traceMach.tracePool removeMeasurementConsumer:activityTrace.rootTrace];
@@ -305,7 +305,7 @@ + (BOOL) newTraceSetup:(NRMATrace*)newTrace
305305
parentTrace:(NRMATrace*)parentTrace
306306
{
307307
if (newTrace == nil || parentTrace == nil) {
308-
NRLOG_VERBOSE(@"<Activity : \"%@\"> : newTraceSetup called with a nil parent or child trace: p=%@, c=%@",
308+
NRLOG_AGENT_VERBOSE(@"<Activity : \"%@\"> : newTraceSetup called with a nil parent or child trace: p=%@, c=%@",
309309
[NRMATraceController getCurrentActivityName],parentTrace, newTrace);
310310
return NO;
311311
}
@@ -437,15 +437,15 @@ + (NRMATrace*) registerNewTrace:(NSString *)name
437437
@synchronized(localTraceMachine) {
438438
if (localTraceMachine == nil) {
439439

440-
NRLOG_VERBOSE(@"tried to register a new trace but tracing is inactive");
440+
NRLOG_AGENT_VERBOSE(@"tried to register a new trace but tracing is inactive");
441441
return nil;
442442
}
443443

444444
NRMATrace* childTrace = [[NRMATrace alloc] initWithName:name
445445
traceMachine:localTraceMachine];
446446

447447
if( localTraceMachine.activityTrace.nodes >= NRMA_MAX_NODE_LIMIT){
448-
NRLOG_VERBOSE(@"<Activity: \"%@\"> : NR_MAX_NODE_LIMIT(%d) reached dropping node",[NRMATraceController getCurrentActivityName],NRMA_MAX_NODE_LIMIT);
448+
NRLOG_AGENT_VERBOSE(@"<Activity: \"%@\"> : NR_MAX_NODE_LIMIT(%d) reached dropping node",[NRMATraceController getCurrentActivityName],NRMA_MAX_NODE_LIMIT);
449449
childTrace.ignoreNode = YES;
450450
#ifndef DISABLE_NRMA_EXCEPTION_WRAPPER
451451
@try {
@@ -621,7 +621,7 @@ + (BOOL) shouldCollectTraces
621621
// todo: use fine grained AT capture rules later.
622622
int currentCount = harvestData.activityTraces.count;
623623
int maxCount = configuration.at_capture.maxTotalTraceCount;
624-
NRLOG_VERBOSE(@"Should collect traces: %d/%d", currentCount, maxCount);
624+
NRLOG_AGENT_VERBOSE(@"Should collect traces: %d/%d", currentCount, maxCount);
625625
return harvestData.activityTraces.count < configuration.at_capture.maxTotalTraceCount;
626626
}
627627

Agent/ActivityTracing/NRMATraceMachine.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,15 @@ - (void) startHealthyTimerWithInterval:(NSTimeInterval)interval
9090
selector:@selector(healthyTimeout)
9191
userInfo:nil
9292
repeats:NO];
93-
NRLOG_VERBOSE(@"Healthy trace timer started with interval: %f",interval);
93+
// NSLog(@"Healthy trace timer started with interval: %f",interval);
94+
9495
[[NSRunLoop mainRunLoop] addTimer:self->healthyTimer forMode:NSDefaultRunLoopMode];
9596
});
9697
}
9798

9899
- (void) healthyTimeout
99100
{
100-
NRLOG_VERBOSE(@"Healthy trace timer fired");
101+
//NRLOG_AGENT_VERBOSE(@"Healthy trace timer fired");
101102
double currentTime = NRMAMillisecondTimestamp();
102103
double lastUpdated = self.activityTrace.lastUpdated;
103104

@@ -136,7 +137,7 @@ - (void) healthyTimeout
136137

137138
- (void) unhealthyTimeout
138139
{
139-
NRLOG_VERBOSE(@"Unhealthy trace timer fired");
140+
//NRLOG_AGENT_VERBOSE(@"Unhealthy trace timer fired");
140141
#ifndef DISABLE_NRMA_EXCEPTION_WRAPPER
141142
@try {
142143
#endif

Agent/ActivityTracing/NRMATraceMachineAgentUserInterface.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ + (NSString*) startCustomActivity:(NSString*)name
2626
{
2727

2828
if (![name length]) {
29-
NRLOG_ERROR(@"Attempted to call startCustomActivity with empty \"name\" value. Aborting custom activity.");
29+
NRLOG_AGENT_ERROR(@"Attempted to call startCustomActivity with empty \"name\" value. Aborting custom activity.");
3030
return nil;
3131
}
3232

3333
NSString* cleansedName = [NewRelicInternalUtils cleanseStringForCollector:name];
3434

3535
if (![cleansedName length]) {
36-
NRLOG_ERROR(@"name = \"%@\" passed to \"start interaction\" contains no legal characters. Please constrain characters to only alpha-numeric values. Aborting custom activity.",name);
36+
NRLOG_AGENT_ERROR(@"name = \"%@\" passed to \"start interaction\" contains no legal characters. Please constrain characters to only alpha-numeric values. Aborting custom activity.",name);
3737
return nil;
3838
}
3939

Agent/Analytics/Constants.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ extern NSString *const kNRMA_Attrib_file_private;
9090
extern NSString *const kNRMA_EventStoreFilename;
9191

9292
extern NSString *const kNRMA_Offline_folder;
93+
94+
extern NSString *const kNRMA_Collector_connect_url;
95+
extern NSString *const kNRMA_Collector_data_url;
96+
extern NSString *const kNRMA_Collector_hex_url;
97+
9398
// Integer Analytics Constants
9499
static int kNRMA_Attrib_Max_Name_Length = 256;
95100
static int kNRMA_Attrib_Max_Value_Size_Bytes = 4096;

Agent/Analytics/Constants.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,7 @@
9696
NSString * const kNRMA_EventStoreFilename = @"eventsStore.txt";
9797

9898
NSString * const kNRMA_Offline_folder = @"offlineStorage";
99+
100+
NSString * const kNRMA_Collector_connect_url = @"/mobile/v5/connect";
101+
NSString * const kNRMA_Collector_data_url = @"/mobile/v3/data";
102+
NSString * const kNRMA_Collector_hex_url = @"/mobile/f";

0 commit comments

Comments
 (0)