Skip to content

Commit

Permalink
Merge pull request #131 from bugsnag/next
Browse files Browse the repository at this point in the history
Release v1.5.0
  • Loading branch information
richardelms authored Sep 4, 2024
2 parents c5f51c6 + 9ec55ac commit dbea541
Show file tree
Hide file tree
Showing 60 changed files with 1,259 additions and 390 deletions.
3 changes: 3 additions & 0 deletions .buildkite/pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ steps:
- '--app=/app/features/fixtures/mazerunner/mazerunner_2020.apk'
- '--farm=bb'
- '--device=ANDROID_9|ANDROID_10|ANDROID_11|ANDROID_12|ANDROID_13'
- '--appium-version=1.22'
- '--no-tunnel'
- '--aws-public-ip'
- '--fail-fast'
Expand Down Expand Up @@ -256,6 +257,7 @@ steps:
- '--app=/app/features/fixtures/mazerunner/mazerunner_2022.apk'
- '--farm=bb'
- '--device=ANDROID_9|ANDROID_10|ANDROID_11|ANDROID_12|ANDROID_13'
- '--appium-version=1.22'
- '--no-tunnel'
- '--aws-public-ip'
- '--fail-fast'
Expand Down Expand Up @@ -567,6 +569,7 @@ steps:
- '--app=/app/features/fixtures/mazerunner/mazerunner-dev_2021.apk'
- '--farm=bb'
- '--device=ANDROID_9|ANDROID_10|ANDROID_11|ANDROID_12|ANDROID_13'
- '--appium-version=1.22'
- '--no-tunnel'
- '--aws-public-ip'
- '--fail-fast'
Expand Down
11 changes: 1 addition & 10 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ steps:
commands:
- features/scripts/run-webgl-ci-tests.sh release




- label: ':windows: Build Windows test fixture for Unity 2021'
timeout_in_minutes: 30
key: build-windows-fixture-2021
Expand Down Expand Up @@ -118,9 +115,6 @@ steps:
commands:
- features/scripts/run-windows-ci-tests.sh release




- label: ':macos: Build macos test fixture for Unity 2021'
timeout_in_minutes: 30
key: build-macos-fixture-2021
Expand Down Expand Up @@ -159,8 +153,6 @@ steps:
commands:
- features/scripts/run-macos-ci-tests.sh release



- label: ':android: Build Android test fixture for Unity 2021'
timeout_in_minutes: 30
key: build-android-fixture-2021
Expand All @@ -183,8 +175,6 @@ steps:
- exit_status: '*'
limit: 1



- label: ':bitbar: Run Android e2e tests for Unity 2021'
timeout_in_minutes: 60
depends_on: build-android-fixture-2021
Expand All @@ -204,6 +194,7 @@ steps:
- '--app=/app/features/fixtures/mazerunner/mazerunner_2021.apk'
- '--farm=bb'
- '--device=ANDROID_9|ANDROID_10|ANDROID_11|ANDROID_12|ANDROID_13'
- '--appium-version=1.22'
- '--no-tunnel'
- '--aws-public-ip'
- '--fail-fast'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ private void DrawSettingsEditorWindow()
EditorGUIUtility.labelWidth = 280;
settings.UseNotifierSettings = EditorGUILayout.Toggle("Use BugSnag Error Monitoring SDK Settings", settings.UseNotifierSettings);
}


if (!NotifierConfigAvaliable() || !settings.UseNotifierSettings)
{
DrawStandaloneSettings(so,settings);
DrawStandaloneSettings(so, settings);
}

if (NotifierConfigAvaliable() && settings.UseNotifierSettings)
Expand All @@ -100,12 +100,12 @@ private void DrawSettingsEditorWindow()
}

EditorGUIUtility.labelWidth = 200;
EditorGUILayout.PropertyField(so.FindProperty("AutoInstrumentAppStart"));
EditorGUILayout.PropertyField(so.FindProperty("Endpoint"));

EditorGUI.indentLevel--;

EditorGUILayout.PropertyField(so.FindProperty("AutoInstrumentAppStart"));
EditorGUILayout.PropertyField(so.FindProperty("ServiceName"));

EditorGUI.indentLevel--;
so.ApplyModifiedProperties();
EditorUtility.SetDirty(settings);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections;
using UnityEngine;

Expand Down Expand Up @@ -37,19 +37,19 @@ private void AbortAppStartSpans()
{
if (_rootSpan != null && !_rootSpan.Ended)
{
_rootSpan.Abort();
_rootSpan.Discard();
}
if (_loadAssembliesSpan != null && !_loadAssembliesSpan.Ended)
{
_loadAssembliesSpan.Abort();
_loadAssembliesSpan.Discard();
}
if (_splashScreenSpan != null && !_splashScreenSpan.Ended)
{
_splashScreenSpan.Abort();
_splashScreenSpan.Discard();
}
if (_firstSceneSpan != null && !_firstSceneSpan.Ended)
{
_firstSceneSpan.Abort();
_firstSceneSpan.Discard();
}
}

Expand Down Expand Up @@ -91,7 +91,7 @@ internal void SubsystemRegistration()
{
_rootSpan = CreateAppStartSpan("[AppStart/UnityRuntime]", "app_start");
_loadAssembliesSpan = CreateAppStartSpan("[AppStartPhase/LoadAssemblies]", "app_start_phase");
_loadAssembliesSpan.SetAttribute("bugsnag.phase", "LoadAssemblies");
_loadAssembliesSpan.SetAttributeInternal("bugsnag.phase", "LoadAssemblies");
}

[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
Expand All @@ -104,14 +104,14 @@ private static void AfterAssembliesLoaded()
private static void BeforeSplashScreen()
{
_splashScreenSpan = CreateAppStartSpan("[AppStartPhase/SplashScreen]", "app_start_phase");
_splashScreenSpan.SetAttribute("bugsnag.phase", "SplashScreen");
_splashScreenSpan.SetAttributeInternal("bugsnag.phase", "SplashScreen");
}

[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void BeforeSceneLoad()
{
_firstSceneSpan = CreateAppStartSpan("[AppStartPhase/LoadFirstScene]", "app_start_phase");
_firstSceneSpan.SetAttribute("bugsnag.phase", "LoadFirstScene");
_firstSceneSpan.SetAttributeInternal("bugsnag.phase", "LoadFirstScene");
}

[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ internal class Delivery : IPhasedStartup
{
private string _endpoint;
private string _apiKey;
private bool _isFixedSamplingProbability = false;
private OnProbabilityChanged _onProbabilityChanged;

private bool _flushingCache;

private ResourceModel _resourceModel;
private CacheManager _cacheManager;

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

public void Configure(PerformanceConfiguration config)
{
_endpoint = config.Endpoint;
_endpoint = config.GetEndpoint();
_apiKey = config.ApiKey;
_isFixedSamplingProbability = config.IsFixedSamplingProbability;
}

public void Start()
Expand All @@ -69,7 +69,7 @@ public void Start()

public void Deliver(List<Span> batch)
{
var payload = new TracePayload(_resourceModel, batch);
var payload = new TracePayload(_resourceModel, batch, _isFixedSamplingProbability);
MainThreadDispatchBehaviour.Instance().Enqueue(PushToServer(payload, OnTraceDeliveryCompleted));
}

Expand Down Expand Up @@ -99,7 +99,7 @@ public void DeliverPValueRequest(OnServerResponse onResponse = null)
{
onResponse = OnPValueRequestCompleted;
}
var payload = new TracePayload(_resourceModel, null);
var payload = new TracePayload(_resourceModel, null, false);
MainThreadDispatchBehaviour.Instance().Enqueue(PushToServer(payload, onResponse));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;
Expand All @@ -12,7 +12,7 @@ internal class PValueUpdater : IPhasedStartup
private DateTime _pValueTimeout;
private float _pValueTimeoutSeconds;
private float _pValueCheckIntervalSeconds;

public bool IsConfigured { get; private set; }

public PValueUpdater(Delivery delivery, Sampler sampler)
{
Expand All @@ -25,6 +25,7 @@ public void Configure(PerformanceConfiguration config)
{
_pValueTimeoutSeconds = config.PValueTimeoutSeconds;
_pValueCheckIntervalSeconds = config.PValueCheckIntervalSeconds;
IsConfigured = true;
}

public void Start()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

namespace BugsnagUnityPerformance
namespace BugsnagUnityPerformance
{
public class Sampler : IPhasedStartup
{
Expand Down Expand Up @@ -27,19 +26,27 @@ public Sampler(PersistentState persistentState)

public void Configure(PerformanceConfiguration config)
{
_probability = config.SamplingProbability;
if (config.IsFixedSamplingProbability)
{
_probability = config.SamplingProbability;
}
}

public void Start()
{
var storedProbability = _persistentState.Probability;
if (storedProbability >= 0)
{
_probability = storedProbability;
}
else
// If the probability is not set, try to load it from the persistent state, otherwise set it to 1.0
if (_probability < 0)
{
_persistentState.Probability = _probability;
var storedProbability = _persistentState.Probability;
if (storedProbability >= 0)
{
_probability = storedProbability;
}
else
{
_probability = 1.0;
_persistentState.Probability = _probability;
}
}
}

Expand All @@ -48,12 +55,12 @@ public bool Sampled(Span span, bool shouldAddAttribute = true)
var p = Probability;
var isSampled = IsSampled(span, GetUpperBound(p));
#if BUGSNAG_DEBUG
Logger.I(string.Format("Span {0} is sampled: {1} with p value: {2}",span.Name,isSampled,p));
Logger.I(string.Format("Span {0} is sampled: {1} with p value: {2}", span.Name, isSampled, p));
#endif
if (isSampled && shouldAddAttribute)
{
span.UpdateSamplingProbability(p);
span.SetAttribute("bugsnag.sampling.p", p);
span.SetAttributeInternal("bugsnag.sampling.p", p);
}
return isSampled;
}
Expand Down
Loading

0 comments on commit dbea541

Please sign in to comment.