-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
.NET profiler improvements & test fixes #2968
Conversation
e3b0d8d
to
7e87cb5
Compare
|
||
return new SampleProfilerSession(stopWatch, session, eventSource, logger); | ||
// Process() blocks until the session is stopped so we need to run it on a separate thread. | ||
Task.Factory.StartNew(eventSource.Process, TaskCreationOptions.LongRunning); |
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.
Do we need to observe any exception of this and log? I think right this it'll end up on UnobservedExceptionHandler
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.
it's logged below on line 74
I've added a test case Profiler_ThrowingOnSessionStartup_DoesntBreakSentryInit
to make sure an exception thrown inside profiler session init doesn't break Sentry init
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.
Sorry I don't get it (line 74 is above this). But I mean if the callback running concurrently throws (eventSource.Process
, if that throws? We can ContinuesWith
at the end of StartNew
for example, or have a callback with a trycatch before we call eentSource.Process?
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.
Oh, I get what you mean now. I was confused at first because this bit of code hasn't actually changed so I thought you're talking about sth else.
In case Process()
throws: yes, I think it'd get handled by UnobservedExceptionHandler.
I've added ContinueWith()
81f7ae6
to
a929523
Compare
|
||
return new SampleProfilerSession(stopWatch, session, eventSource, logger); | ||
// Process() blocks until the session is stopped so we need to run it on a separate thread. | ||
Task.Factory.StartNew(eventSource.Process, TaskCreationOptions.LongRunning); |
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.
Sorry I don't get it (line 74 is above this). But I mean if the callback running concurrently throws (eventSource.Process
, if that throws? We can ContinuesWith
at the end of StartNew
for example, or have a callback with a trycatch before we call eentSource.Process?
var frame = profile.Frames[profileToVerify.Stacks[0][i]]; | ||
frame.Module = frame.Module.Replace("System.Private.CoreLib.il", "System.Private.CoreLib"); | ||
profileToVerify.Frames.Add(frame); | ||
factory._sessionTask.Wait(60_000); |
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.
Waits up to a minute for one test and still times out? This is def far from ideal. Skipping in CI is OK but is this going to be flaky locally?
Hard to believe it can take more than 1 minute to startup
test/Sentry.Profiling.Tests/SamplingTransactionProfilerTests.cs
Outdated
Show resolved
Hide resolved
{ | ||
if (_.Exception?.InnerException is { } e) | ||
{ | ||
logger?.LogWarning("Error during sampler profiler EventPipeSession processing.", e); |
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.
Will conflict now I imagine, since we merged ur PR reordering
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.
Actually, I should have looked for usages on the other PR too... All the usages passing an exception got picked up by the generic method so they didn't fail. I've fixed it in this branch with hope it gets merged soon also those fixes are unrelated. If it doesn't get merged, I can cherry-pick the commit to a new PR.
} | ||
catch (Exception e) | ||
{ | ||
_testOutputLogger.LogWarning("Caught an exception in a test block that is allowed to fail when in CI.", e); |
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.
Do we know what this exception will be? That would allow us to validate this in CI (timeout is OK but else it's not?)
Co-authored-by: Bruno Garcia <[email protected]>
* Set in_foreground app context * Update Changelog * Check OS * Update verify tests * Update remaining verify tests * Remove redundant code. * Update app context tests * Catch IsOSPlatform failure * Update CHANGELOG.md Co-authored-by: Bruno Garcia <[email protected]> * Refactor active window check. * Add a comment --------- Co-authored-by: James Crosswell <[email protected]> Co-authored-by: Bruno Garcia <[email protected]>
* Attach screenshot * Add AttachScreenshots option default value test * Update changelog * Update changelog * Add AttachScreenshots to bindable options. * Add AttachScreenshots to verify * Fix verify test * Remove default for AttachScreenshots * Use hint for screenshot attachments * Update CHANGELOG.md Co-authored-by: Bruno Garcia <[email protected]> * Add screenshot processor on options * Add comment, skip on Windows * Move try/catch outside #if * Don't add screenshot processor to scope. * Log if screenshot cannot be captured. * Add tests * Find envelope by id. * Assert attachment item only on mobile. * Initialize ActivityStateManager * Capture screen on UI thread. * Init platform * Move init to MainApplication * Use extension methods on SentryOptions for logging Co-authored-by: Bruno Garcia <[email protected]> * Add missing using * Init platform in lifecycle events * Remove MainApplication from device tests * Write to logcat * Rename Property * Pass AttachScreenshot to native sdk options. * Move CaptureFailed outside of #Debug * Remove leftover code * Remove Logcat logging * Update CHANGELOG.md Co-authored-by: Bruno Garcia <[email protected]> * Use blocking call on main thread * Set debug mode to make logs work * Update src/Sentry.Maui/SentryMauiOptions.cs Co-authored-by: Bruno Garcia <[email protected]> * Remove try catch from screen capture * Rename file to match class name --------- Co-authored-by: Bruno Garcia <[email protected]>
Co-authored-by: GitHub <[email protected]>
3277d18
to
be2c18c
Compare
#skip-changelog