sentry-java
sentry-java copied to clipboard
Force flush metrics when aggregator exceeds max weight
:scroll: Description
Implement the force flush behavior described here: develop.sentry.dev/sdk/metrics/#aggregator-behavior
Details like max_weight taken from getsentry/sentry-python@master/sentry_sdk/metrics.py
:bulb: Motivation and Context
:green_heart: How did you test it?
Added unit tests
:pencil: Checklist
- [x] I reviewed the submitted code.
- [x] I added tests to verify the changes.
- [x] No new PII added or SDK only sends newly added PII if
sendDefaultPIIis enabled. - [x] I updated the docs if needed.
- [x] Review from the native team if needed.
- [x] No breaking change or entry added to the changelog.
- [x] No breaking change for hybrid SDKs or communicated to hybrid SDKs.
:crystal_ball: Next steps
| Fails | |
|---|---|
| :no_entry_sign: | Please consider adding a changelog entry for the next release. |
| Messages | |
|---|---|
| :book: | Do not forget to update Sentry-docs with your feature once the pull request gets approved. |
Instructions and example for changelog
Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.
Example:
## Unreleased
- Force flush metrics when aggregator exceeds max weight ([#3220](https://github.com/getsentry/sentry-java/pull/3220))
If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.
Generated by :no_entry_sign: dangerJS against 060f474d5b69d616d720f87a794ecc8dedd35528
Performance metrics :rocket:
| Plain | With Sentry | Diff | |
|---|---|---|---|
| Startup time | 349.68 ms | 402.80 ms | 53.12 ms |
| Size | 1.70 MiB | 2.28 MiB | 590.47 KiB |
Baseline results on branch: feat/metrics
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 67ad7476a42e8fed6df4e6b6cf5592fb8c455aa3 | 424.90 ms | 467.60 ms | 42.70 ms |
| ac0ecb9800ce82e97444b405735c00814f026391 | 425.69 ms | 506.96 ms | 81.27 ms |
| f5d47c0c50e8cacde779e9a9ada036924638ff6f | 300.14 ms | 342.90 ms | 42.76 ms |
| 5254f26b15a1103f4a122aca3a7d76f3c121190c | 411.85 ms | 442.08 ms | 30.23 ms |
| 0140fbcbc32d46e1f467f2fa0393101824961246 | 399.74 ms | 470.37 ms | 70.63 ms |
| f5aa57f441b84c628ba696e496b3d55eab6cd233 | 413.70 ms | 552.20 ms | 138.50 ms |
| 0e0f3c4d1b07e78667abd3e0cf00e04413334248 | 385.67 ms | 458.14 ms | 72.47 ms |
| 4edc1f32ae881e60057a677fcc0256f15a07fd12 | 371.24 ms | 446.73 ms | 75.49 ms |
| 6dd67a4b475ac57ff1ed6e1e581709777fbc63eb | 381.21 ms | 445.40 ms | 64.19 ms |
| 038e0aeb4f0b67157fa9cc6096bcd63924e4bb7b | 364.92 ms | 446.39 ms | 81.47 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 67ad7476a42e8fed6df4e6b6cf5592fb8c455aa3 | 1.70 MiB | 2.28 MiB | 592.10 KiB |
| ac0ecb9800ce82e97444b405735c00814f026391 | 1.70 MiB | 2.28 MiB | 590.22 KiB |
| f5d47c0c50e8cacde779e9a9ada036924638ff6f | 1.70 MiB | 2.27 MiB | 586.58 KiB |
| 5254f26b15a1103f4a122aca3a7d76f3c121190c | 1.70 MiB | 2.28 MiB | 592.06 KiB |
| 0140fbcbc32d46e1f467f2fa0393101824961246 | 1.70 MiB | 2.27 MiB | 587.40 KiB |
| f5aa57f441b84c628ba696e496b3d55eab6cd233 | 1.70 MiB | 2.28 MiB | 590.22 KiB |
| 0e0f3c4d1b07e78667abd3e0cf00e04413334248 | 1.70 MiB | 2.27 MiB | 587.24 KiB |
| 4edc1f32ae881e60057a677fcc0256f15a07fd12 | 1.70 MiB | 2.27 MiB | 586.13 KiB |
| 6dd67a4b475ac57ff1ed6e1e581709777fbc63eb | 1.70 MiB | 2.27 MiB | 587.20 KiB |
| 038e0aeb4f0b67157fa9cc6096bcd63924e4bb7b | 1.70 MiB | 2.28 MiB | 590.25 KiB |
Previous results on branch: feat/metrics-weight-flush
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 13393a010092ece45164ac8825955c600b3791ed | 410.76 ms | 474.69 ms | 63.94 ms |
| cf849ed2169be151ae2956fba779c5972613f50e | 386.39 ms | 454.18 ms | 67.80 ms |
| d9aa41f58e034692436ed3dcfa7a07702b22ec6c | 389.82 ms | 442.28 ms | 52.46 ms |
| 6807442a35207119f4fe18271589e1af325996ef | 375.59 ms | 447.02 ms | 71.43 ms |
| b731ef2d169570bf03c831b55bf0b427bba23b6b | 382.98 ms | 452.75 ms | 69.77 ms |
| b04521628d51b43f6c3e1ba5abbdc1dc0348d59b | 363.77 ms | 432.04 ms | 68.27 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 13393a010092ece45164ac8825955c600b3791ed | 1.70 MiB | 2.28 MiB | 592.20 KiB |
| cf849ed2169be151ae2956fba779c5972613f50e | 1.70 MiB | 2.28 MiB | 590.38 KiB |
| d9aa41f58e034692436ed3dcfa7a07702b22ec6c | 1.70 MiB | 2.28 MiB | 590.18 KiB |
| 6807442a35207119f4fe18271589e1af325996ef | 1.70 MiB | 2.28 MiB | 592.15 KiB |
| b731ef2d169570bf03c831b55bf0b427bba23b6b | 1.70 MiB | 2.28 MiB | 592.25 KiB |
| b04521628d51b43f6c3e1ba5abbdc1dc0348d59b | 1.70 MiB | 2.28 MiB | 592.20 KiB |