-
Notifications
You must be signed in to change notification settings - Fork 2
app start control #196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
app start control #196
Changes from all commits
7882f6d
88f6e2d
e38db8d
fcc3e3a
740dcea
c719189
662b0b3
dd341c9
1da450a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace BugsnagUnityPerformance | ||
{ | ||
internal class AppStartSpanControl : IAppStartSpanControl | ||
{ | ||
private const string Prefix = "[AppStart/UnityRuntime]"; | ||
private readonly Span _span; | ||
|
||
public AppStartSpanControl(Span span) => _span = span; | ||
|
||
public void SetType(string type) | ||
{ | ||
_span?.TryUpdateAppStartSpan(type, Prefix); | ||
} | ||
|
||
public void ClearType() | ||
{ | ||
_span?.TryUpdateAppStartSpan(null, Prefix); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace BugsnagUnityPerformance | ||
{ | ||
internal class SpanControlRegistry | ||
{ | ||
private readonly AppStartHandler _appStartHandler; | ||
|
||
public SpanControlRegistry(AppStartHandler handler) | ||
{ | ||
_appStartHandler = handler; | ||
} | ||
|
||
public T GetSpanControl<T>(ISpanQuery<T> query) where T : class | ||
{ | ||
if (query is SpanType.AppStartQuery) | ||
{ | ||
var span = _appStartHandler.GetAppStartSpan(); | ||
return span != null ? new AppStartSpanControl(span) as T : null; | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace BugsnagUnityPerformance | ||
{ | ||
public interface IAppStartSpanControl | ||
{ | ||
void SetType(string type); | ||
void ClearType(); | ||
} | ||
|
||
public interface ISpanQuery<T> { } | ||
|
||
public static class SpanType | ||
{ | ||
public static readonly ISpanQuery<IAppStartSpanControl> AppStart = new AppStartQuery(); | ||
internal sealed class AppStartQuery : ISpanQuery<IAppStartSpanControl> { } | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using BugsnagUnityPerformance; | ||
|
||
public class AppStartClearCustomisation : Scenario | ||
{ | ||
public override void PreparePerformanceConfig(string apiKey, string host) | ||
{ | ||
base.PreparePerformanceConfig(apiKey, host); | ||
SetMaxBatchSize(4); | ||
Configuration.AutoInstrumentAppStart = AutoInstrumentAppStartSetting.START_ONLY; | ||
} | ||
|
||
public override void Run() | ||
{ | ||
BugsnagPerformance.GetSpanControl(SpanType.AppStart)?.SetType("ColdStart"); | ||
BugsnagPerformance.GetSpanControl(SpanType.AppStart)?.ClearType(); | ||
BugsnagPerformance.ReportAppStarted(); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.