-
-
Notifications
You must be signed in to change notification settings - Fork 435
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
Collect memory usage in transactions #2445
Conversation
…ndroid set in SentryOptions Added TransactionPerformanceCollector to collect performance data while a transaction is running
|
public class AndroidMemoryCollector implements IMemoryCollector { | ||
@Override | ||
public MemoryCollectionData collect() { | ||
long now = System.currentTimeMillis(); |
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.
Is System.currentTimeMillis()
good enough as timestamp? Or should I go with DateUtils.getCurrentDateTime().getTime()
?
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.
DateUtils
is using Calendar
under the hood which itself seems to be using System.currentTimeMillis()
. Thus I'd stick to System.currentTimeMillis()
.
Performance metrics 🚀
|
Revision | Plain | With Sentry | Diff |
---|---|---|---|
4a9c176 | 319.77 ms | 363.20 ms | 43.43 ms |
f1150bc | 352.62 ms | 453.27 ms | 100.65 ms |
f809aac | 301.51 ms | 346.60 ms | 45.09 ms |
4a9c176 | 336.33 ms | 384.73 ms | 48.41 ms |
5fd37fa | 334.02 ms | 401.10 ms | 67.08 ms |
703d523 | 358.00 ms | 369.94 ms | 11.94 ms |
81a1a6c | 328.73 ms | 421.28 ms | 92.55 ms |
a04f788 | 321.78 ms | 354.12 ms | 32.35 ms |
95647bd | 349.76 ms | 397.92 ms | 48.16 ms |
ecf9680 | 303.12 ms | 346.35 ms | 43.23 ms |
App size
Revision | Plain | With Sentry | Diff |
---|---|---|---|
4a9c176 | 1.73 MiB | 2.33 MiB | 612.69 KiB |
f1150bc | 1.73 MiB | 2.33 MiB | 615.66 KiB |
f809aac | 1.73 MiB | 2.32 MiB | 608.63 KiB |
4a9c176 | 1.73 MiB | 2.33 MiB | 612.69 KiB |
5fd37fa | 1.73 MiB | 2.33 MiB | 616.48 KiB |
703d523 | 1.73 MiB | 2.33 MiB | 613.23 KiB |
81a1a6c | 1.73 MiB | 2.32 MiB | 612.47 KiB |
a04f788 | 1.73 MiB | 2.32 MiB | 609.88 KiB |
95647bd | 1.73 MiB | 2.33 MiB | 616.54 KiB |
ecf9680 | 1.73 MiB | 2.32 MiB | 612.39 KiB |
Codecov ReportBase: 80.09% // Head: 80.15% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2445 +/- ##
============================================
+ Coverage 80.09% 80.15% +0.06%
- Complexity 3807 3828 +21
============================================
Files 306 310 +4
Lines 14390 14461 +71
Branches 1904 1913 +9
============================================
+ Hits 11525 11591 +66
- Misses 2118 2121 +3
- Partials 747 749 +2
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. |
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.
Nice one, looks good! Please have a look at my comments
public class AndroidMemoryCollector implements IMemoryCollector { | ||
@Override | ||
public MemoryCollectionData collect() { | ||
long now = System.currentTimeMillis(); |
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.
DateUtils
is using Calendar
under the hood which itself seems to be using System.currentTimeMillis()
. Thus I'd stick to System.currentTimeMillis()
.
sentry/src/main/java/io/sentry/TransactionPerformanceCollector.java
Outdated
Show resolved
Hide resolved
sentry/src/main/java/io/sentry/TransactionPerformanceCollector.java
Outdated
Show resolved
Hide resolved
added a synchronization mechanism in TransactionPerformanceCollector
📜 Description
Added a MemoryCollector, with different implementations for Java and Android, set in SentryOptions
Added TransactionPerformanceCollector, that uses the MemoryCollector, to collect performance data while a transaction is running.
Collected data is a list of objects containing a timestamp, java heap memory usage and native memory usage (only on Android)
💡 Motivation and Context
We want to build a POC to get the memory usage data as a time series while a transaction runs.
💚 How did you test it?
Unit tests
📝 Checklist
🔮 Next steps