Skip to content

Commit dbea541

Browse files
authored
Merge pull request #131 from bugsnag/next
Release v1.5.0
2 parents c5f51c6 + 9ec55ac commit dbea541

Some content is hidden

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

60 files changed

+1259
-390
lines changed

.buildkite/pipeline.full.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ steps:
208208
- '--app=/app/features/fixtures/mazerunner/mazerunner_2020.apk'
209209
- '--farm=bb'
210210
- '--device=ANDROID_9|ANDROID_10|ANDROID_11|ANDROID_12|ANDROID_13'
211+
- '--appium-version=1.22'
211212
- '--no-tunnel'
212213
- '--aws-public-ip'
213214
- '--fail-fast'
@@ -256,6 +257,7 @@ steps:
256257
- '--app=/app/features/fixtures/mazerunner/mazerunner_2022.apk'
257258
- '--farm=bb'
258259
- '--device=ANDROID_9|ANDROID_10|ANDROID_11|ANDROID_12|ANDROID_13'
260+
- '--appium-version=1.22'
259261
- '--no-tunnel'
260262
- '--aws-public-ip'
261263
- '--fail-fast'
@@ -567,6 +569,7 @@ steps:
567569
- '--app=/app/features/fixtures/mazerunner/mazerunner-dev_2021.apk'
568570
- '--farm=bb'
569571
- '--device=ANDROID_9|ANDROID_10|ANDROID_11|ANDROID_12|ANDROID_13'
572+
- '--appium-version=1.22'
570573
- '--no-tunnel'
571574
- '--aws-public-ip'
572575
- '--fail-fast'

.buildkite/pipeline.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ steps:
7373
commands:
7474
- features/scripts/run-webgl-ci-tests.sh release
7575

76-
77-
78-
7976
- label: ':windows: Build Windows test fixture for Unity 2021'
8077
timeout_in_minutes: 30
8178
key: build-windows-fixture-2021
@@ -118,9 +115,6 @@ steps:
118115
commands:
119116
- features/scripts/run-windows-ci-tests.sh release
120117

121-
122-
123-
124118
- label: ':macos: Build macos test fixture for Unity 2021'
125119
timeout_in_minutes: 30
126120
key: build-macos-fixture-2021
@@ -159,8 +153,6 @@ steps:
159153
commands:
160154
- features/scripts/run-macos-ci-tests.sh release
161155

162-
163-
164156
- label: ':android: Build Android test fixture for Unity 2021'
165157
timeout_in_minutes: 30
166158
key: build-android-fixture-2021
@@ -183,8 +175,6 @@ steps:
183175
- exit_status: '*'
184176
limit: 1
185177

186-
187-
188178
- label: ':bitbar: Run Android e2e tests for Unity 2021'
189179
timeout_in_minutes: 60
190180
depends_on: build-android-fixture-2021
@@ -204,6 +194,7 @@ steps:
204194
- '--app=/app/features/fixtures/mazerunner/mazerunner_2021.apk'
205195
- '--farm=bb'
206196
- '--device=ANDROID_9|ANDROID_10|ANDROID_11|ANDROID_12|ANDROID_13'
197+
- '--appium-version=1.22'
207198
- '--no-tunnel'
208199
- '--aws-public-ip'
209200
- '--fail-fast'

BugsnagPerformance/Assets/BugsnagPerformance/Editor/BugsnagPerformanceEditor.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ private void DrawSettingsEditorWindow()
8787
EditorGUIUtility.labelWidth = 280;
8888
settings.UseNotifierSettings = EditorGUILayout.Toggle("Use BugSnag Error Monitoring SDK Settings", settings.UseNotifierSettings);
8989
}
90-
90+
9191

9292
if (!NotifierConfigAvaliable() || !settings.UseNotifierSettings)
9393
{
94-
DrawStandaloneSettings(so,settings);
94+
DrawStandaloneSettings(so, settings);
9595
}
9696

9797
if (NotifierConfigAvaliable() && settings.UseNotifierSettings)
@@ -100,12 +100,12 @@ private void DrawSettingsEditorWindow()
100100
}
101101

102102
EditorGUIUtility.labelWidth = 200;
103-
EditorGUILayout.PropertyField(so.FindProperty("AutoInstrumentAppStart"));
104103
EditorGUILayout.PropertyField(so.FindProperty("Endpoint"));
105104

106-
EditorGUI.indentLevel--;
107-
105+
EditorGUILayout.PropertyField(so.FindProperty("AutoInstrumentAppStart"));
106+
EditorGUILayout.PropertyField(so.FindProperty("ServiceName"));
108107

108+
EditorGUI.indentLevel--;
109109
so.ApplyModifiedProperties();
110110
EditorUtility.SetDirty(settings);
111111
}

BugsnagPerformance/Assets/BugsnagPerformance/Scripts/Internal/AppStartHandler.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections;
33
using UnityEngine;
44

@@ -37,19 +37,19 @@ private void AbortAppStartSpans()
3737
{
3838
if (_rootSpan != null && !_rootSpan.Ended)
3939
{
40-
_rootSpan.Abort();
40+
_rootSpan.Discard();
4141
}
4242
if (_loadAssembliesSpan != null && !_loadAssembliesSpan.Ended)
4343
{
44-
_loadAssembliesSpan.Abort();
44+
_loadAssembliesSpan.Discard();
4545
}
4646
if (_splashScreenSpan != null && !_splashScreenSpan.Ended)
4747
{
48-
_splashScreenSpan.Abort();
48+
_splashScreenSpan.Discard();
4949
}
5050
if (_firstSceneSpan != null && !_firstSceneSpan.Ended)
5151
{
52-
_firstSceneSpan.Abort();
52+
_firstSceneSpan.Discard();
5353
}
5454
}
5555

@@ -91,7 +91,7 @@ internal void SubsystemRegistration()
9191
{
9292
_rootSpan = CreateAppStartSpan("[AppStart/UnityRuntime]", "app_start");
9393
_loadAssembliesSpan = CreateAppStartSpan("[AppStartPhase/LoadAssemblies]", "app_start_phase");
94-
_loadAssembliesSpan.SetAttribute("bugsnag.phase", "LoadAssemblies");
94+
_loadAssembliesSpan.SetAttributeInternal("bugsnag.phase", "LoadAssemblies");
9595
}
9696

9797
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
@@ -104,14 +104,14 @@ private static void AfterAssembliesLoaded()
104104
private static void BeforeSplashScreen()
105105
{
106106
_splashScreenSpan = CreateAppStartSpan("[AppStartPhase/SplashScreen]", "app_start_phase");
107-
_splashScreenSpan.SetAttribute("bugsnag.phase", "SplashScreen");
107+
_splashScreenSpan.SetAttributeInternal("bugsnag.phase", "SplashScreen");
108108
}
109109

110110
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
111111
private static void BeforeSceneLoad()
112112
{
113113
_firstSceneSpan = CreateAppStartSpan("[AppStartPhase/LoadFirstScene]", "app_start_phase");
114-
_firstSceneSpan.SetAttribute("bugsnag.phase", "LoadFirstScene");
114+
_firstSceneSpan.SetAttributeInternal("bugsnag.phase", "LoadFirstScene");
115115
}
116116

117117
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]

BugsnagPerformance/Assets/BugsnagPerformance/Scripts/Internal/Delivery.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ internal class Delivery : IPhasedStartup
1616
{
1717
private string _endpoint;
1818
private string _apiKey;
19+
private bool _isFixedSamplingProbability = false;
1920
private OnProbabilityChanged _onProbabilityChanged;
20-
2121
private bool _flushingCache;
22-
2322
private ResourceModel _resourceModel;
2423
private CacheManager _cacheManager;
2524

@@ -58,8 +57,9 @@ public Delivery(ResourceModel resourceModel, CacheManager cacheManager, OnProbab
5857

5958
public void Configure(PerformanceConfiguration config)
6059
{
61-
_endpoint = config.Endpoint;
60+
_endpoint = config.GetEndpoint();
6261
_apiKey = config.ApiKey;
62+
_isFixedSamplingProbability = config.IsFixedSamplingProbability;
6363
}
6464

6565
public void Start()
@@ -69,7 +69,7 @@ public void Start()
6969

7070
public void Deliver(List<Span> batch)
7171
{
72-
var payload = new TracePayload(_resourceModel, batch);
72+
var payload = new TracePayload(_resourceModel, batch, _isFixedSamplingProbability);
7373
MainThreadDispatchBehaviour.Instance().Enqueue(PushToServer(payload, OnTraceDeliveryCompleted));
7474
}
7575

@@ -99,7 +99,7 @@ public void DeliverPValueRequest(OnServerResponse onResponse = null)
9999
{
100100
onResponse = OnPValueRequestCompleted;
101101
}
102-
var payload = new TracePayload(_resourceModel, null);
102+
var payload = new TracePayload(_resourceModel, null, false);
103103
MainThreadDispatchBehaviour.Instance().Enqueue(PushToServer(payload, onResponse));
104104
}
105105

BugsnagPerformance/Assets/BugsnagPerformance/Scripts/Internal/PValueUpdater.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections;
33
using UnityEngine;
44
using UnityEngine.Networking;
@@ -12,7 +12,7 @@ internal class PValueUpdater : IPhasedStartup
1212
private DateTime _pValueTimeout;
1313
private float _pValueTimeoutSeconds;
1414
private float _pValueCheckIntervalSeconds;
15-
15+
public bool IsConfigured { get; private set; }
1616

1717
public PValueUpdater(Delivery delivery, Sampler sampler)
1818
{
@@ -25,6 +25,7 @@ public void Configure(PerformanceConfiguration config)
2525
{
2626
_pValueTimeoutSeconds = config.PValueTimeoutSeconds;
2727
_pValueCheckIntervalSeconds = config.PValueCheckIntervalSeconds;
28+
IsConfigured = true;
2829
}
2930

3031
public void Start()

BugsnagPerformance/Assets/BugsnagPerformance/Scripts/Internal/Sampler.cs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-

2-
namespace BugsnagUnityPerformance
1+
namespace BugsnagUnityPerformance
32
{
43
public class Sampler : IPhasedStartup
54
{
@@ -27,19 +26,27 @@ public Sampler(PersistentState persistentState)
2726

2827
public void Configure(PerformanceConfiguration config)
2928
{
30-
_probability = config.SamplingProbability;
29+
if (config.IsFixedSamplingProbability)
30+
{
31+
_probability = config.SamplingProbability;
32+
}
3133
}
3234

3335
public void Start()
3436
{
35-
var storedProbability = _persistentState.Probability;
36-
if (storedProbability >= 0)
37-
{
38-
_probability = storedProbability;
39-
}
40-
else
37+
// If the probability is not set, try to load it from the persistent state, otherwise set it to 1.0
38+
if (_probability < 0)
4139
{
42-
_persistentState.Probability = _probability;
40+
var storedProbability = _persistentState.Probability;
41+
if (storedProbability >= 0)
42+
{
43+
_probability = storedProbability;
44+
}
45+
else
46+
{
47+
_probability = 1.0;
48+
_persistentState.Probability = _probability;
49+
}
4350
}
4451
}
4552

@@ -48,12 +55,12 @@ public bool Sampled(Span span, bool shouldAddAttribute = true)
4855
var p = Probability;
4956
var isSampled = IsSampled(span, GetUpperBound(p));
5057
#if BUGSNAG_DEBUG
51-
Logger.I(string.Format("Span {0} is sampled: {1} with p value: {2}",span.Name,isSampled,p));
58+
Logger.I(string.Format("Span {0} is sampled: {1} with p value: {2}", span.Name, isSampled, p));
5259
#endif
5360
if (isSampled && shouldAddAttribute)
5461
{
5562
span.UpdateSamplingProbability(p);
56-
span.SetAttribute("bugsnag.sampling.p", p);
63+
span.SetAttributeInternal("bugsnag.sampling.p", p);
5764
}
5865
return isSampled;
5966
}

0 commit comments

Comments
 (0)