Profile envelopes sent directly from profiler#2298
Conversation
Dropped old timed out profiles handling. Now they are directly sent when they time out AndroidTransactionProfiler does not return the ProfileTraceData anymore Added ui test for timed out profiles
|
|
Do I need a changelog entry? The |
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 3d89dea | 322.38 ms | 350.82 ms | 28.45 ms |
| 3d89dea | 345.59 ms | 364.06 ms | 18.47 ms |
| 7300956 | 324.20 ms | 353.79 ms | 29.58 ms |
| 221a5df | 350.61 ms | 391.58 ms | 40.97 ms |
| 4dd88fe | 306.88 ms | 391.58 ms | 84.70 ms |
| 2f079a1 | 296.91 ms | 337.43 ms | 40.51 ms |
| 2c5f172 | 289.18 ms | 307.56 ms | 18.38 ms |
| 1e4690d | 354.69 ms | 387.88 ms | 33.19 ms |
| 2c5f172 | 310.20 ms | 357.16 ms | 46.96 ms |
| 4dd88fe | 302.12 ms | 331.17 ms | 29.04 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 3d89dea | 1.74 MiB | 2.33 MiB | 604.92 KiB |
| 3d89dea | 1.74 MiB | 2.33 MiB | 604.92 KiB |
| 7300956 | 1.73 MiB | 2.29 MiB | 578.69 KiB |
| 221a5df | 1.73 MiB | 2.29 MiB | 581.39 KiB |
| 4dd88fe | 1.73 MiB | 2.29 MiB | 579.50 KiB |
| 2f079a1 | 1.74 MiB | 2.33 MiB | 605.56 KiB |
| 2c5f172 | 1.73 MiB | 2.29 MiB | 580.10 KiB |
| 1e4690d | 1.74 MiB | 2.33 MiB | 604.92 KiB |
| 2c5f172 | 1.73 MiB | 2.29 MiB | 580.10 KiB |
| 4dd88fe | 1.73 MiB | 2.29 MiB | 579.50 KiB |
Previous results on branch: feat/android-profiler-sends-envelopes
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 192a9f0 | 270.92 ms | 313.15 ms | 42.23 ms |
| f0a7fca | 338.82 ms | 383.54 ms | 44.72 ms |
| cd0ffed | 344.89 ms | 392.55 ms | 47.66 ms |
| c6d0735 | 359.24 ms | 397.53 ms | 38.29 ms |
| 3f263a8 | 310.81 ms | 361.34 ms | 50.53 ms |
| adfb80f | 329.92 ms | 390.77 ms | 60.85 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 192a9f0 | 1.73 MiB | 2.29 MiB | 580.27 KiB |
| f0a7fca | 1.73 MiB | 2.29 MiB | 580.27 KiB |
| cd0ffed | 1.73 MiB | 2.29 MiB | 580.20 KiB |
| c6d0735 | 1.73 MiB | 2.29 MiB | 581.16 KiB |
| 3f263a8 | 1.73 MiB | 2.29 MiB | 580.27 KiB |
| adfb80f | 1.73 MiB | 2.29 MiB | 580.27 KiB |
Codecov ReportBase: 80.11% // Head: 80.08% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2298 +/- ##
============================================
- Coverage 80.11% 80.08% -0.03%
+ Complexity 3433 3429 -4
============================================
Files 242 242
Lines 12765 12752 -13
Branches 1703 1700 -3
============================================
- Hits 10227 10213 -14
- Misses 1889 1890 +1
Partials 649 649
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Good question! @romtsn how do we usually deal with internal changes? |
|
Looks good to me! 👍 |
|
I guess the changelog is not only for the users but also for us, right? So I'd probably add an entry there. Also, this sounds like a behavior change (profiles are sent without transactions now), which makes it reasonable to add to the changelog again. |
| ? ProfilingTraceData.TRUNCATION_REASON_TIMEOUT | ||
| : ProfilingTraceData.TRUNCATION_REASON_NORMAL); | ||
|
|
||
| HubAdapter.getInstance().captureProfile(profilingTraceData); |
There was a problem hiding this comment.
How about we move this into the constructor? Then we should be also able to test it properly without overriding Sentry.setCurrentHub
Perhaps, we could even make AndroidTransactionProfiler an integration, but I'm not sure if it was ever discussed before @marandaneto
There was a problem hiding this comment.
Maybe create an envelope out of the profilingTraceData and call captureEnvelope instead?
Your call here @romtsn
I don't recall any discussion related to AndroidTransactionProfiler as an integration.
There was a problem hiding this comment.
Out of curiosity, why is it preferred to create an Envelope and call captureEnvelope instead of calling captureProfile/captureTransaction/captureWhatever?
Is it for consistency or are there other reasons? @marandaneto
I can quickly create the envelope and drop the captureProfile methods, if it's better
There was a problem hiding this comment.
Because this expands the public API and is not needed.
There was a problem hiding this comment.
Does this mean we want to delay the 6.6.0 release until we removed captureProfile from the public API again in main?
Ah it's marked internal anyways, nevermind.
There was a problem hiding this comment.
@adinauer Actually, HubAdapter is public, and it has a captureProfile method
There was a problem hiding this comment.
HubAdapter is just to make Sentry static class testable.
There was a problem hiding this comment.
That's fine, but HubAdapter isn't marked as internal, so technically there's nothing preventing users to actually use it.
Just wanted to make sure we are aware of this
There was a problem hiding this comment.
@marandaneto i made the change. Would you take another look before merging?
adinauer
left a comment
There was a problem hiding this comment.
LGTM, agree with roman on the changelog. I too think it should be listed.
removed captureProfile methods profiles are sent creating an envelope and using captureEnvelope added SentryEnvelope.from(... ProfilingTraceData ...)
romtsn
left a comment
There was a problem hiding this comment.
@stefanosiano I'm planning to cut a release today, would you like to merge it so it gets in?
📜 Description
The
AndroidTransactionProfilernow directly sends profile envelopes. This means we don't have to pass theProfileTraceDataanymore anyway.So we could drop the old timed out profiles handling, as they are directly sent when they time out
💡 Motivation and Context
This change allows profiles to be sent independently from transactions.
It also fixes and simplify timed out profiles handling. Previously we had to wait for a transaction to finish to attach the timed out profile to it and send the envelope. Now the envelope is sent as soon as the profile times out.
💚 How did you test it?
I added a ui test to check the profile is sent on timeout without finishing the transaction
I added few unit tests to check the
captureProfilemethod of the hub is called by the profiler itself.📝 Checklist
🔮 Next steps