-
-
Notifications
You must be signed in to change notification settings - Fork 55
feat: Auto Instrumentation for Awake #998
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
Conversation
|
…sentry-unity into feat/awake-instrument
src/Sentry.Unity.Editor/ConfigurationWindow/SentryEditorWindowInstrumentation.cs
Outdated
Show resolved
Hide resolved
// Skip the session init requests (there may be multiple of them). We can't skip them by a "positive" | ||
// because they're also repeated with standard events (in an envelope). | ||
Debug.Log("SMOKE TEST: Skipping all non-event requests"); | ||
Debug.Log("SMOKE TEST: Skipping all session requests"); | ||
for (; currentMessage < 10; currentMessage++) | ||
{ | ||
if (t.CheckMessage(currentMessage, "'type':'event'")) | ||
if (t.CheckMessage(currentMessage, "'type':'transaction'")) | ||
{ | ||
break; | ||
} | ||
} | ||
Debug.Log($"SMOKE TEST: Done skipping non-event requests. Last one was: #{currentMessage}"); | ||
Debug.Log($"SMOKE TEST: Done skipping session requests. Last one was: #{currentMessage}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels strange. The comments talk about skipping sessions, but really you're skipping everything until you get a transaction. As long a there are less than 10 of them... 🤔
src/Sentry.Unity.Editor/AutoInstrumentation/ModuleReadWriter.cs
Outdated
Show resolved
Hide resolved
src/Sentry.Unity.Editor/AutoInstrumentation/ModuleReadWriter.cs
Outdated
Show resolved
Hide resolved
src/Sentry.Unity.Editor/AutoInstrumentation/PerformanceAutoInstrumentation.cs
Outdated
Show resolved
Hide resolved
src/Sentry.Unity.Editor/AutoInstrumentation/PerformanceAutoInstrumentation.cs
Show resolved
Hide resolved
src/Sentry.Unity.Editor/AutoInstrumentation/PerformanceAutoInstrumentation.cs
Outdated
Show resolved
Hide resolved
src/Sentry.Unity.Editor/AutoInstrumentation/PerformanceAutoInstrumentation.cs
Outdated
Show resolved
Hide resolved
Generally looks good. Commented with some minor nits. Didn't test it out though - I'd need more context. |
The idea is to start and finish spans automatically for every
Awake
method in allMonoBehaviour
within the project.Noticeable pitfall: Not every
MonoBehaviour
implementsAwake
.The plan:
Assembly-CSharp.dll
Start Span
as the very first instructionFinish Span
before everyreturn
app.start
transactionawake
spanHow it works right now:
We look for any
Awake
in any class withinAssembly-CSharp.dll
that inherits fromMonoBehaviour
.I.e.
and we modify it to look like
The IL code for the original
And the modified IL code