Skip to content
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

Send transaction memory stats in profile payload #2447

Merged
merged 36 commits into from
Jan 25, 2023

Conversation

stefanosiano
Copy link
Member

@stefanosiano stefanosiano commented Dec 30, 2022

📜 Description

Added list of MemoryCollectionData to Android profiles payload as measurements

💡 Motivation and Context

We want to add more data to profiles, so we are including the memory statistics we get from transactions to profile payloads.
Also, at the moment there's no easy way to send the data in the transaction, due to transaction metrics not supporting lists of data. We want to have some data and eventually show it in the Sentry dashboard. The quickest way is to send them in the profiles.

💚 How did you test it?

Unit tests

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • No breaking changes

🔮 Next steps

@github-actions
Copy link
Contributor

github-actions bot commented Dec 30, 2022

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 8e01539

@github-actions
Copy link
Contributor

github-actions bot commented Dec 30, 2022

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 350.54 ms 355.79 ms 5.25 ms
Size 1.73 MiB 2.33 MiB 623.04 KiB

Previous results on branch: feat/android-profiles-memory-measurement

Startup times

Revision Plain With Sentry Diff
e10a9e0 344.18 ms 370.08 ms 25.90 ms
a3feb29 319.24 ms 392.94 ms 73.69 ms
851e2e8 345.82 ms 379.59 ms 33.77 ms
04b7c64 327.04 ms 395.22 ms 68.18 ms
3ac4b7e 274.90 ms 359.72 ms 84.82 ms
b1b6fc0 308.18 ms 334.90 ms 26.72 ms
e5f16c4 269.00 ms 334.24 ms 65.24 ms
68b24b4 317.52 ms 353.14 ms 35.62 ms
ca688d7 335.90 ms 376.63 ms 40.73 ms
2a6ff10 341.69 ms 398.55 ms 56.86 ms

App size

Revision Plain With Sentry Diff
e10a9e0 1.73 MiB 2.33 MiB 622.30 KiB
a3feb29 1.73 MiB 2.33 MiB 622.25 KiB
851e2e8 1.73 MiB 2.33 MiB 617.24 KiB
04b7c64 1.73 MiB 2.33 MiB 622.30 KiB
3ac4b7e 1.73 MiB 2.33 MiB 620.89 KiB
b1b6fc0 1.73 MiB 2.33 MiB 620.89 KiB
e5f16c4 1.73 MiB 2.33 MiB 622.30 KiB
68b24b4 1.73 MiB 2.33 MiB 620.63 KiB
ca688d7 1.73 MiB 2.33 MiB 620.69 KiB
2a6ff10 1.73 MiB 2.33 MiB 620.69 KiB

@codecov-commenter
Copy link

codecov-commenter commented Dec 30, 2022

Codecov Report

Base: 80.12% // Head: 80.13% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (8e01539) compared to base (690f9dd).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #2447   +/-   ##
=========================================
  Coverage     80.12%   80.13%           
- Complexity     3916     3917    +1     
=========================================
  Files           321      321           
  Lines         14783    14788    +5     
  Branches       1951     1951           
=========================================
+ Hits          11845    11850    +5     
  Misses         2170     2170           
  Partials        768      768           
Impacted Files Coverage Δ
...c/main/java/io/sentry/NoOpTransactionProfiler.java 100.00% <ø> (ø)
...ava/io/sentry/TransactionPerformanceCollector.java 94.00% <ø> (ø)
...sentry/profilemeasurements/ProfileMeasurement.java 52.72% <ø> (ø)
sentry/src/main/java/io/sentry/SentryTracer.java 91.89% <100.00%> (+0.12%) ⬆️
...y/profilemeasurements/ProfileMeasurementValue.java 60.41% <100.00%> (+0.84%) ⬆️

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

Base automatically changed from feat/memory-usage-collection to main January 3, 2023 18:03
stefanosiano and others added 19 commits January 3, 2023 19:31
# Conflicts:
#	CHANGELOG.md
#	sentry/src/main/java/io/sentry/SentryTracer.java
#	sentry/src/main/java/io/sentry/TransactionPerformanceCollector.java
#	sentry/src/test/java/io/sentry/TransactionPerformanceCollectorTest.kt
…running

TransactionPerformanceCollector now returns PerformanceCollectionData, which contains memory and cpu usage data
…emory-measurement

# Conflicts:
#	CHANGELOG.md
AndroidTransactionProfiler now gets an instance of PerformanceCollectionData instead of MemoryCollectionData
# Conflicts:
#	CHANGELOG.md
#	sentry/src/main/java/io/sentry/TransactionPerformanceCollector.java
# Conflicts:
#	CHANGELOG.md
#	sentry/src/main/java/io/sentry/TransactionPerformanceCollector.java
…emory-measurement

# Conflicts:
#	CHANGELOG.md
#	sentry/src/main/java/io/sentry/TransactionPerformanceCollector.java
@stefanosiano stefanosiano changed the base branch from main to feat/cpu-usage-collection January 13, 2023 17:29
@stefanosiano stefanosiano changed the base branch from feat/cpu-usage-collection to main January 13, 2023 17:38
@stefanosiano stefanosiano marked this pull request as ready for review January 16, 2023 17:34
# Conflicts:
#	CHANGELOG.md
#	sentry/src/main/java/io/sentry/TransactionPerformanceCollector.java
@romtsn
Copy link
Member

romtsn commented Jan 20, 2023

will take a look after the cpu PR is merged, otherwise the diff contains the changes from there as well

Copy link
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done, looking good! I might be missing something but as far as I can see the CPU data is not serialized / added as a measurement to the profile protocol, right? I'm looking at AndroidTransactionProfiler.putPerformanceCollectionDataInMeasurements

}
}
}
},
0,
TRANSACTION_COLLECTION_INTERVAL_MILLIS,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: any reason you're providing a delay parameter here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we let some time pass between setup() and collect() calls.
This way ICollectors that collect average stats based on time intervals, like AndroidCpuCollector, can have an actual time interval to evaluate.
Just added a comment to clarify it

@stefanosiano
Copy link
Member Author

Nicely done, looking good! I might be missing something but as far as I can see the CPU data is not serialized / added as a measurement to the profile protocol, right? I'm looking at AndroidTransactionProfiler.putPerformanceCollectionDataInMeasurements

I'm doing another pr for sending the cpu data, so yeah, they're not added to the profile, yet

# Conflicts:
#	CHANGELOG.md
#	sentry-android-core/api/sentry-android-core.api
#	sentry-android-core/src/main/java/io/sentry/android/core/AndroidCpuCollector.java
#	sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java
#	sentry-android-core/src/test/java/io/sentry/android/core/AndroidCpuCollectorTest.kt
#	sentry-android-core/src/test/java/io/sentry/android/core/AndroidMemoryCollectorTest.kt
#	sentry/api/sentry.api
#	sentry/src/main/java/io/sentry/PerformanceCollectionData.java
#	sentry/src/main/java/io/sentry/SentryOptions.java
#	sentry/src/main/java/io/sentry/TransactionPerformanceCollector.java
#	sentry/src/test/java/io/sentry/JavaMemoryCollectorTest.kt
#	sentry/src/test/java/io/sentry/TransactionPerformanceCollectorTest.kt
@stefanosiano stefanosiano merged commit b049670 into main Jan 25, 2023
@stefanosiano stefanosiano deleted the feat/android-profiles-memory-measurement branch January 25, 2023 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants