sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

feat: initial implementation for sending SDK integrations list

Open romtsn opened this issue 3 years ago • 1 comments

:scroll: Description

  • Changed List to Set because we don't care about duplicates (and also, it's easier to use, e.g. for Navigation listener, which can be attached/detached multiple times during the app lifetime)
  • It's also a synchronized Set since it can be modified from different threads
  • An easier would be to change the signature of register method which would return true/false depending on whether the integration is enabled or not, then we could add all of them on the registring site. But this would mean breaking the public API so I opted out from that

You can see the event with integrations here https://sentry.io/organizations/sentry-sdks/issues/3402041535/events/e085890223004873b274c7bb6c6d1c8f/json/

:bulb: Motivation and Context

Closes #1885

:crystal_ball: Next steps

  • @adinauer probably you wanna do this for Java integrations as well?
  • Probably extract integration strings into constants
  • OR somehow parse the class name of the integration and extract it from there
  • I didn't touch tests like at all

romtsn avatar Jul 20 '22 08:07 romtsn

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

Generated by :no_entry_sign: dangerJS against 594cc5e4f36100b702827b3f19ed396b5007c8e4

github-actions[bot] avatar Jul 20 '22 08:07 github-actions[bot]

Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 324.45 ms 380.57 ms 56.12 ms
Size 1.73 MiB 2.34 MiB 626.30 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
4b32504a16c1ffd2325208184a90b34a8252fb02 315.69 ms 373.96 ms 58.27 ms
754021cd6c6cb9de539fc3eeca8695872d8fd52a 358.70 ms 361.98 ms 3.28 ms
fe30606689aa4c20db711bb91bfd369169ee18f5 310.82 ms 335.36 ms 24.55 ms
14c083ae2435e14d57e68a65b254a2de80126cc5 350.82 ms 388.86 ms 38.04 ms
4b32504a16c1ffd2325208184a90b34a8252fb02 357.14 ms 404.04 ms 46.90 ms
c1399c15f62734a7e49c6040deb6bf7c9e7c9dc0 345.06 ms 385.49 ms 40.43 ms
f6a135d1ef81f9cd70d72608e8beb8c2103f69bd 263.96 ms 383.59 ms 119.63 ms
5fa24ec3912850ef1d3a7821efb5ea8f15f06e5e 326.29 ms 384.53 ms 58.24 ms
efa7b3ddfa946241933996ab5bddb8c3f7bb1642 330.06 ms 370.14 ms 40.08 ms
efa7b3ddfa946241933996ab5bddb8c3f7bb1642 335.38 ms 384.85 ms 49.48 ms

App size

Revision Plain With Sentry Diff
4b32504a16c1ffd2325208184a90b34a8252fb02 1.73 MiB 2.34 MiB 623.74 KiB
754021cd6c6cb9de539fc3eeca8695872d8fd52a 1.73 MiB 2.33 MiB 623.06 KiB
fe30606689aa4c20db711bb91bfd369169ee18f5 1.73 MiB 2.34 MiB 623.74 KiB
14c083ae2435e14d57e68a65b254a2de80126cc5 1.73 MiB 2.33 MiB 620.61 KiB
4b32504a16c1ffd2325208184a90b34a8252fb02 1.73 MiB 2.34 MiB 623.74 KiB
c1399c15f62734a7e49c6040deb6bf7c9e7c9dc0 1.73 MiB 2.33 MiB 620.61 KiB
f6a135d1ef81f9cd70d72608e8beb8c2103f69bd 1.73 MiB 2.33 MiB 623.10 KiB
5fa24ec3912850ef1d3a7821efb5ea8f15f06e5e 1.73 MiB 2.33 MiB 620.61 KiB
efa7b3ddfa946241933996ab5bddb8c3f7bb1642 1.73 MiB 2.34 MiB 625.56 KiB
efa7b3ddfa946241933996ab5bddb8c3f7bb1642 1.73 MiB 2.34 MiB 625.56 KiB

Previous results on branch: feat/integrations-in-events

Startup times

Revision Plain With Sentry Diff
607bde55cd7573917c4cebe464923bd16ecd8095 312.84 ms 341.02 ms 28.18 ms
f2ac7504a0c350051e4d6a3b5349bc3650de3647 331.21 ms 382.12 ms 50.92 ms
47b56739710904a50ee1fa79bc506e06d27334c9 317.63 ms 363.37 ms 45.74 ms
13749c341292317b12e99f2dc53bee99c58ef578 335.81 ms 367.06 ms 31.25 ms
3556d6db320a97cf517f10545e40ae71f27ccbba 273.42 ms 318.63 ms 45.22 ms
20115be396d7c7f712cbab8a834e79fcbf3e0581 339.14 ms 381.59 ms 42.44 ms
966848592852b67b01db8711b2490038f9e6a9e8 347.31 ms 370.49 ms 23.18 ms
8789ba45be81aadba5f0974e3601d7bf06f04c61 355.11 ms 394.53 ms 39.42 ms
6b688daa4cbd05184a9e792e9f4502df18088be3 374.96 ms 422.16 ms 47.20 ms
d1e381e10242834d4340b5aa3973a3631c9f8c2a 300.51 ms 369.57 ms 69.06 ms

App size

Revision Plain With Sentry Diff
607bde55cd7573917c4cebe464923bd16ecd8095 1.73 MiB 2.33 MiB 621.17 KiB
f2ac7504a0c350051e4d6a3b5349bc3650de3647 1.73 MiB 2.34 MiB 626.06 KiB
47b56739710904a50ee1fa79bc506e06d27334c9 1.73 MiB 2.34 MiB 626.08 KiB
13749c341292317b12e99f2dc53bee99c58ef578 1.73 MiB 2.33 MiB 621.17 KiB
3556d6db320a97cf517f10545e40ae71f27ccbba 1.73 MiB 2.33 MiB 614.83 KiB
20115be396d7c7f712cbab8a834e79fcbf3e0581 1.73 MiB 2.34 MiB 626.01 KiB
966848592852b67b01db8711b2490038f9e6a9e8 1.73 MiB 2.34 MiB 626.03 KiB
8789ba45be81aadba5f0974e3601d7bf06f04c61 1.73 MiB 2.34 MiB 626.08 KiB
6b688daa4cbd05184a9e792e9f4502df18088be3 1.73 MiB 2.34 MiB 626.08 KiB
d1e381e10242834d4340b5aa3973a3631c9f8c2a 1.73 MiB 2.34 MiB 624.19 KiB

github-actions[bot] avatar Dec 15 '22 11:12 github-actions[bot]

@lbloder what do you think of Philipp's suggestion? At least for those that implement the Integration interface, we could get the class name and remove the Integration part from its name when we call register. This would reduce the maintenance overhead for those that implement Integration at least.

romtsn avatar Dec 29 '22 09:12 romtsn

@lbloder can I also ask you to add the missing integrations to packages (sdkVersion.addPackage())? This would also help us to analyze data based on packages. The modules that need this to be added:

  • okhttp
  • apollo2
  • apollo3
  • fragment
  • navigation
  • compose
  • compose-helper (also needs to be added to the integrations list)

Don't know about jdbc and graphql, since you haven't added them to the integrations yet

romtsn avatar Dec 29 '22 09:12 romtsn

Codecov Report

Base: 80.26% // Head: 80.42% // Increases project coverage by +0.16% :tada:

Coverage data is based on head (594cc5e) compared to base (e9b703c). Patch coverage: 87.30% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2179      +/-   ##
============================================
+ Coverage     80.26%   80.42%   +0.16%     
- Complexity     3988     4011      +23     
============================================
  Files           327      329       +2     
  Lines         15017    15114      +97     
  Branches       1977     1979       +2     
============================================
+ Hits          12053    12156     +103     
+ Misses         2187     2179       -8     
- Partials        777      779       +2     
Impacted Files Coverage Δ
...rc/main/java/io/sentry/protocol/SentryPackage.java 66.66% <33.33%> (-3.71%) :arrow_down:
...ry/SendCachedEnvelopeFireAndForgetIntegration.java 65.11% <50.00%> (+34.16%) :arrow_up:
...y/src/main/java/io/sentry/protocol/SdkVersion.java 65.62% <54.54%> (-5.49%) :arrow_down:
...ava/io/sentry/SentryIntegrationPackageStorage.java 95.45% <95.45%> (ø)
.../io/sentry/apollo3/SentryApollo3HttpInterceptor.kt 80.85% <100.00%> (+1.07%) :arrow_up:
...n/java/io/sentry/apollo/SentryApolloInterceptor.kt 82.14% <100.00%> (+0.89%) :arrow_up:
.../java/io/sentry/graphql/SentryInstrumentation.java 72.58% <100.00%> (+1.39%) :arrow_up:
...n/java/io/sentry/jdbc/SentryJdbcEventListener.java 88.00% <100.00%> (+3.00%) :arrow_up:
...jul/src/main/java/io/sentry/jul/SentryHandler.java 76.08% <100.00%> (+0.71%) :arrow_up:
...src/main/java/io/sentry/log4j2/SentryAppender.java 84.90% <100.00%> (+0.59%) :arrow_up:
... and 15 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Jan 27 '23 15:01 codecov[bot]

One more ask - could you please add SentryIntegrationPackageStorage.getInstance().addIntegration("FileIO"); to the FileIOSpanManager ctor? this way we don't need to wait for gradle plugin to inject its features, but can already track FileIO usages. Thanks 🙏

romtsn avatar Feb 16 '23 11:02 romtsn