Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: getsentry/sentry-java
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7.12.0
Choose a base ref
...
head repository: getsentry/sentry-java
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7.13.0
Choose a head ref
  • 16 commits
  • 68 files changed
  • 7 contributors

Commits on Jul 15, 2024

  1. Merge branch 'release/7.12.0'

    getsentry-bot committed Jul 15, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    9c4170f View commit details

Commits on Jul 16, 2024

  1. Bump github/codeql-action from 3.25.10 to 3.25.11 (#3529)

    Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.10 to 3.25.11.
    - [Release notes](https://github.com/github/codeql-action/releases)
    - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
    - [Commits](github/codeql-action@23acc5c...b611370)
    
    ---
    updated-dependencies:
    - dependency-name: github/codeql-action
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jul 16, 2024
    Copy the full SHA
    a449452 View commit details
  2. Bump JamesIves/github-pages-deploy-action from 4.5.0 to 4.6.1 (#3531)

    Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.5.0 to 4.6.1.
    - [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases)
    - [Commits](JamesIves/github-pages-deploy-action@65b5dfd...5c6e9e9)
    
    ---
    updated-dependencies:
    - dependency-name: JamesIves/github-pages-deploy-action
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jul 16, 2024
    Copy the full SHA
    028e225 View commit details
  3. Bump gradle/actions (#3532)

    Bumps [gradle/actions](https://github.com/gradle/actions) from 2cd2a6e951bd0b53f55a08e4e4c6f2586f3a36b9 to cdbbabd09cff07936e1c9dbe8c9d4b6ac2ef7156.
    - [Release notes](https://github.com/gradle/actions/releases)
    - [Commits](gradle/actions@2cd2a6e...cdbbabd)
    
    ---
    updated-dependencies:
    - dependency-name: gradle/actions
      dependency-type: direct:production
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jul 16, 2024
    Copy the full SHA
    83b0c04 View commit details
  4. Add sentry-android-replay module to craft and readme (#3578)

    romtsn authored Jul 16, 2024
    Copy the full SHA
    7620eac View commit details

Commits on Jul 17, 2024

  1. Check app start spans time and foreground state (#3550)

    * App start now takes AppStartMetrics.appLaunchedInForeground variable to add spans to the transaction
    * App starts longer than 1 minute are dropped (same as Firebase)
    * added Activity lifecycle registration to check start launch time and foreground status
    * added AppStartMetrics.registerApplicationForegroundCheck in the SentryPerformanceProvider and SentryAndroid.init, other than AppStartMetrics.onApplicationCreate
    * ActivityLifecycleIntegration now reads first activity creation on create instead of class instantiation
    * AppStartMetrics stops app start profiler if no activity is being created
    stefanosiano authored Jul 17, 2024
    Copy the full SHA
    73237da View commit details

Commits on Jul 23, 2024

  1. release: 7.12.1

    getsentry-bot committed Jul 23, 2024
    Copy the full SHA
    391c199 View commit details
  2. Bump github/codeql-action from 3.25.11 to 3.25.13 (#3591)

    Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.25.11 to 3.25.13.
    - [Release notes](https://github.com/github/codeql-action/releases)
    - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
    - [Commits](github/codeql-action@b611370...2d79040)
    
    ---
    updated-dependencies:
    - dependency-name: github/codeql-action
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jul 23, 2024
    Copy the full SHA
    60865fe View commit details
  3. Bump reactivecircus/android-emulator-runner from 2.31.0 to 2.32.0 (#3573

    )
    
    Bumps [reactivecircus/android-emulator-runner](https://github.com/reactivecircus/android-emulator-runner) from 2.31.0 to 2.32.0.
    - [Release notes](https://github.com/reactivecircus/android-emulator-runner/releases)
    - [Changelog](https://github.com/ReactiveCircus/android-emulator-runner/blob/main/CHANGELOG.md)
    - [Commits](ReactiveCircus/android-emulator-runner@77986be...f0d1ed2)
    
    ---
    updated-dependencies:
    - dependency-name: reactivecircus/android-emulator-runner
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jul 23, 2024
    Copy the full SHA
    485ff61 View commit details
  4. Bump JamesIves/github-pages-deploy-action from 4.6.1 to 4.6.3 (#3590)

    Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.6.1 to 4.6.3.
    - [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases)
    - [Commits](JamesIves/github-pages-deploy-action@5c6e9e9...94f3c65)
    
    ---
    updated-dependencies:
    - dependency-name: JamesIves/github-pages-deploy-action
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jul 23, 2024
    Copy the full SHA
    74ed0f6 View commit details
  5. Bump gradle/actions (#3597)

    Bumps [gradle/actions](https://github.com/gradle/actions) from cdbbabd09cff07936e1c9dbe8c9d4b6ac2ef7156 to fd87365911aa12c016c307ea21313f351dc53551.
    - [Release notes](https://github.com/gradle/actions/releases)
    - [Commits](gradle/actions@cdbbabd...fd87365)
    
    ---
    updated-dependencies:
    - dependency-name: gradle/actions
      dependency-type: direct:production
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jul 23, 2024
    Copy the full SHA
    a0423a0 View commit details
  6. Bump gradle/wrapper-validation-action from 3.4.2 to 3.5.0 (#3589)

    Bumps [gradle/wrapper-validation-action](https://github.com/gradle/wrapper-validation-action) from 3.4.2 to 3.5.0.
    - [Release notes](https://github.com/gradle/wrapper-validation-action/releases)
    - [Commits](gradle/wrapper-validation-action@8842585...f9c9c57)
    
    ---
    updated-dependencies:
    - dependency-name: gradle/wrapper-validation-action
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jul 23, 2024
    Copy the full SHA
    fc84053 View commit details

Commits on Jul 25, 2024

  1. Merge branch 'release/7.12.1'

    getsentry-bot committed Jul 25, 2024
    Copy the full SHA
    7ee0493 View commit details

Commits on Jul 29, 2024

  1. Bump Spring Boot to 3.3.2 (#3541)

    * Bump Spring Boot to 3.3.1
    
    * changelog
    
    * add specific classpath dependency for commons compress
    
    * bump to latest patch release of spring boot
    
    ---------
    
    Co-authored-by: Lukas Bloder <lukas.bloder@gmail.com>
    adinauer and lbloder authored Jul 29, 2024
    Copy the full SHA
    3a89243 View commit details

Commits on Jul 30, 2024

  1. [SR] Capture Replays for ANRs and crashes (#3565)

    romtsn authored Jul 30, 2024
    Copy the full SHA
    e039872 View commit details
  2. release: 7.13.0

    getsentry-bot committed Jul 30, 2024
    Copy the full SHA
    b64477e View commit details
Showing with 3,000 additions and 658 deletions.
  1. +1 −0 .craft.yml
  2. +2 −2 .github/workflows/agp-matrix.yml
  3. +1 −1 .github/workflows/build.yml
  4. +3 −3 .github/workflows/codeql-analysis.yml
  5. +1 −1 .github/workflows/enforce-license-compliance.yml
  6. +2 −2 .github/workflows/generate-javadocs.yml
  7. +1 −1 .github/workflows/gradle-wrapper-validation.yml
  8. +2 −2 .github/workflows/integration-tests-benchmarks.yml
  9. +1 −1 .github/workflows/integration-tests-ui.yml
  10. +1 −1 .github/workflows/release-build.yml
  11. +1 −1 .github/workflows/system-tests-backend.yml
  12. +26 −0 CHANGELOG.md
  13. +1 −0 README.md
  14. +1 −0 build.gradle.kts
  15. +2 −1 buildSrc/src/main/java/Config.kt
  16. +1 −1 gradle.properties
  17. +4 −1 sentry-android-core/api/sentry-android-core.api
  18. +11 −1 sentry-android-core/src/main/java/io/sentry/android/core/ActivityLifecycleIntegration.java
  19. +82 −0 sentry-android-core/src/main/java/io/sentry/android/core/AnrV2EventProcessor.java
  20. +5 −0 sentry-android-core/src/main/java/io/sentry/android/core/SentryAndroid.java
  21. +1 −0 sentry-android-core/src/main/java/io/sentry/android/core/SentryPerformanceProvider.java
  22. +82 −4 sentry-android-core/src/main/java/io/sentry/android/core/performance/AppStartMetrics.java
  23. +77 −3 sentry-android-core/src/test/java/io/sentry/android/core/ActivityLifecycleIntegrationTest.kt
  24. +73 −4 sentry-android-core/src/test/java/io/sentry/android/core/AnrV2EventProcessorTest.kt
  25. +130 −75 sentry-android-core/src/test/java/io/sentry/android/core/PerformanceAndroidEventProcessorTest.kt
  26. +9 −0 sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt
  27. +3 −1 sentry-android-core/src/test/java/io/sentry/android/core/SentryPerformanceProviderTest.kt
  28. +156 −0 sentry-android-core/src/test/java/io/sentry/android/core/performance/AppStartMetricsTest.kt
  29. +7 −2 sentry-android-replay/api/sentry-android-replay.api
  30. +13 −4 sentry-android-replay/src/main/java/io/sentry/android/replay/DefaultReplayBreadcrumbConverter.kt
  31. +201 −10 sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayCache.kt
  32. +85 −23 sentry-android-replay/src/main/java/io/sentry/android/replay/ReplayIntegration.kt
  33. +135 −185 sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BaseCaptureStrategy.kt
  34. +124 −97 sentry-android-replay/src/main/java/io/sentry/android/replay/capture/BufferCaptureStrategy.kt
  35. +207 −6 sentry-android-replay/src/main/java/io/sentry/android/replay/capture/CaptureStrategy.kt
  36. +43 −39 sentry-android-replay/src/main/java/io/sentry/android/replay/capture/SessionCaptureStrategy.kt
  37. +20 −0 sentry-android-replay/src/main/java/io/sentry/android/replay/util/Executors.kt
  38. +53 −0 sentry-android-replay/src/main/java/io/sentry/android/replay/util/Persistable.kt
  39. +1 −1 sentry-android-replay/src/main/java/io/sentry/android/replay/video/SimpleVideoEncoder.kt
  40. +22 −0 sentry-android-replay/src/test/java/io/sentry/android/replay/DefaultReplayBreadcrumbConverterTest.kt
  41. +265 −4 sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayCacheTest.kt
  42. +186 −35 sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationTest.kt
  43. +4 −1 sentry-android-replay/src/test/java/io/sentry/android/replay/ReplayIntegrationWithRecorderTest.kt
  44. +1 −12 sentry-android-replay/src/test/java/io/sentry/android/replay/ReplaySmokeTest.kt
  45. +270 −0 sentry-android-replay/src/test/java/io/sentry/android/replay/capture/BufferCaptureStrategyTest.kt
  46. +355 −0 sentry-android-replay/src/test/java/io/sentry/android/replay/capture/SessionCaptureStrategyTest.kt
  47. +16 −8 sentry/api/sentry.api
  48. +8 −1 sentry/src/main/java/io/sentry/Baggage.java
  49. +2 −0 sentry/src/main/java/io/sentry/IOptionsObserver.java
  50. +4 −1 sentry/src/main/java/io/sentry/IScopeObserver.java
  51. +1 −5 sentry/src/main/java/io/sentry/NoOpReplayController.java
  52. +6 −0 sentry/src/main/java/io/sentry/PropagationContext.java
  53. +1 −3 sentry/src/main/java/io/sentry/ReplayController.java
  54. +3 −1 sentry/src/main/java/io/sentry/ReplayRecording.java
  55. +11 −4 sentry/src/main/java/io/sentry/Scope.java
  56. +5 −1 sentry/src/main/java/io/sentry/ScopeObserverAdapter.java
  57. +2 −0 sentry/src/main/java/io/sentry/Sentry.java
  58. +18 −22 sentry/src/main/java/io/sentry/SentryClient.java
  59. +8 −2 sentry/src/main/java/io/sentry/SentryEnvelopeItem.java
  60. +10 −0 sentry/src/main/java/io/sentry/cache/PersistingOptionsObserver.java
  61. +20 −3 sentry/src/main/java/io/sentry/cache/PersistingScopeObserver.java
  62. +1 −0 sentry/src/main/java/io/sentry/protocol/Contexts.java
  63. +20 −4 sentry/src/test/java/io/sentry/ScopeTest.kt
  64. +75 −39 sentry/src/test/java/io/sentry/SentryClientTest.kt
  65. +26 −3 sentry/src/test/java/io/sentry/SentryEnvelopeItemTest.kt
  66. +8 −0 sentry/src/test/java/io/sentry/SentryTest.kt
  67. +32 −4 sentry/src/test/java/io/sentry/cache/PersistingOptionsObserverTest.kt
  68. +51 −32 sentry/src/test/java/io/sentry/cache/PersistingScopeObserverTest.kt
1 change: 1 addition & 0 deletions .craft.yml
Original file line number Diff line number Diff line change
@@ -56,3 +56,4 @@ targets:
maven:io.sentry:sentry-compose-desktop:
maven:io.sentry:sentry-apollo-3:
maven:io.sentry:sentry-android-sqlite:
maven:io.sentry:sentry-android-replay:
4 changes: 2 additions & 2 deletions .github/workflows/agp-matrix.yml
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@2cd2a6e951bd0b53f55a08e4e4c6f2586f3a36b9 # pin@v3
uses: gradle/actions/setup-gradle@fd87365911aa12c016c307ea21313f351dc53551 # pin@v3
with:
gradle-home-cache-cleanup: true

@@ -59,7 +59,7 @@ jobs:

# We tried to use the cache action to cache gradle stuff, but it made tests slower and timeout
- name: Run instrumentation tests
uses: reactivecircus/android-emulator-runner@77986be26589807b8ebab3fde7bbf5c60dabec32 # pin@v2
uses: reactivecircus/android-emulator-runner@f0d1ed2dcad93c7479e8b2f2226c83af54494915 # pin@v2
with:
api-level: 30
force-avd-creation: false
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@2cd2a6e951bd0b53f55a08e4e4c6f2586f3a36b9 # pin@v3
uses: gradle/actions/setup-gradle@fd87365911aa12c016c307ea21313f351dc53551 # pin@v3
with:
gradle-home-cache-cleanup: true

6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -36,12 +36,12 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@2cd2a6e951bd0b53f55a08e4e4c6f2586f3a36b9 # pin@v3
uses: gradle/actions/setup-gradle@fd87365911aa12c016c307ea21313f351dc53551 # pin@v3
with:
gradle-home-cache-cleanup: true

- name: Initialize CodeQL
uses: github/codeql-action/init@23acc5c183826b7a8a97bce3cecc52db901f8251 # pin@v2
uses: github/codeql-action/init@2d790406f505036ef40ecba973cc774a50395aac # pin@v2
with:
languages: ${{ matrix.language }}

@@ -55,4 +55,4 @@ jobs:
./gradlew buildForCodeQL
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@23acc5c183826b7a8a97bce3cecc52db901f8251 # pin@v2
uses: github/codeql-action/analyze@2d790406f505036ef40ecba973cc774a50395aac # pin@v2
2 changes: 1 addition & 1 deletion .github/workflows/enforce-license-compliance.yml
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@2cd2a6e951bd0b53f55a08e4e4c6f2586f3a36b9 # pin@v3
uses: gradle/actions/setup-gradle@fd87365911aa12c016c307ea21313f351dc53551 # pin@v3
with:
gradle-home-cache-cleanup: true

4 changes: 2 additions & 2 deletions .github/workflows/generate-javadocs.yml
Original file line number Diff line number Diff line change
@@ -20,15 +20,15 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@2cd2a6e951bd0b53f55a08e4e4c6f2586f3a36b9 # pin@v3
uses: gradle/actions/setup-gradle@fd87365911aa12c016c307ea21313f351dc53551 # pin@v3
with:
gradle-home-cache-cleanup: true

- name: Generate Aggregate Javadocs
run: |
./gradlew aggregateJavadocs
- name: Deploy
uses: JamesIves/github-pages-deploy-action@65b5dfd4f5bcd3a7403bbc2959c144256167464e # pin@4.5.0
uses: JamesIves/github-pages-deploy-action@94f3c658273cf92fb48ef99e5fbc02bd2dc642b2 # pin@4.6.3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
2 changes: 1 addition & 1 deletion .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -13,4 +13,4 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: gradle/wrapper-validation-action@88425854a36845f9c881450d9660b5fd46bee142 # pin@v1
- uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 # pin@v1
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests-benchmarks.yml
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@2cd2a6e951bd0b53f55a08e4e4c6f2586f3a36b9 # pin@v3
uses: gradle/actions/setup-gradle@fd87365911aa12c016c307ea21313f351dc53551 # pin@v3
with:
gradle-home-cache-cleanup: true

@@ -86,7 +86,7 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@2cd2a6e951bd0b53f55a08e4e4c6f2586f3a36b9 # pin@v3
uses: gradle/actions/setup-gradle@fd87365911aa12c016c307ea21313f351dc53551 # pin@v3
with:
gradle-home-cache-cleanup: true

2 changes: 1 addition & 1 deletion .github/workflows/integration-tests-ui.yml
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@2cd2a6e951bd0b53f55a08e4e4c6f2586f3a36b9 # pin@v3
uses: gradle/actions/setup-gradle@fd87365911aa12c016c307ea21313f351dc53551 # pin@v3
with:
gradle-home-cache-cleanup: true

2 changes: 1 addition & 1 deletion .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@2cd2a6e951bd0b53f55a08e4e4c6f2586f3a36b9 # pin@v3
uses: gradle/actions/setup-gradle@fd87365911aa12c016c307ea21313f351dc53551 # pin@v3
with:
gradle-home-cache-cleanup: true

2 changes: 1 addition & 1 deletion .github/workflows/system-tests-backend.yml
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@2cd2a6e951bd0b53f55a08e4e4c6f2586f3a36b9 # pin@v3
uses: gradle/actions/setup-gradle@fd87365911aa12c016c307ea21313f351dc53551 # pin@v3
with:
gradle-home-cache-cleanup: true

26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## 7.13.0

### Features

- Session Replay: ([#3565](https://github.com/getsentry/sentry-java/pull/3565)) ([#3609](https://github.com/getsentry/sentry-java/pull/3609))
- Capture remaining replay segment for ANRs on next app launch
- Capture remaining replay segment for unhandled crashes on next app launch

### Fixes

- Session Replay: ([#3565](https://github.com/getsentry/sentry-java/pull/3565)) ([#3609](https://github.com/getsentry/sentry-java/pull/3609))
- Fix stopping replay in `session` mode at 1 hour deadline
- Never encode full frames for a video segment, only do partial updates. This further reduces size of the replay segment
- Use propagation context when no active transaction for ANRs

### Dependencies

- Bump Spring Boot to 3.3.2 ([#3541](https://github.com/getsentry/sentry-java/pull/3541))

## 7.12.1

### Fixes

- Check app start spans time and ignore background app starts ([#3550](https://github.com/getsentry/sentry-java/pull/3550))
- This should eliminate long-lasting App Start transactions

## 7.12.0

### Features
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ Sentry SDK for Java and Android
| sentry-android-fragment | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-fragment/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-fragment) | 19 |
| sentry-android-navigation | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-navigation/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-navigation) | 19 |
| sentry-android-sqlite | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-sqlite/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-sqlite) | 19 |
| sentry-android-replay | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-replay/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-replay) | 26 |
| sentry-compose-android | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-compose-android/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-compose-android) | 21 |
| sentry-compose-desktop | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-compose-desktop/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-compose-desktop) |
| sentry-compose | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-compose/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-compose) |
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@ buildscript {

classpath(Config.QualityPlugins.binaryCompatibilityValidatorPlugin)
classpath(Config.BuildPlugins.composeGradlePlugin)
classpath(Config.BuildPlugins.commonsCompressOverride)
}
}

3 changes: 2 additions & 1 deletion buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ object Config {
val kotlinStdLib = "stdlib-jdk8"

val springBootVersion = "2.7.5"
val springBoot3Version = "3.2.0"
val springBoot3Version = "3.3.2"
val kotlinCompatibleLanguageVersion = "1.4"

val composeVersion = "1.5.3"
@@ -27,6 +27,7 @@ object Config {
val dokkaPlugin = "org.jetbrains.dokka:dokka-gradle-plugin:1.7.10"
val dokkaPluginAlias = "org.jetbrains.dokka"
val composeGradlePlugin = "org.jetbrains.compose:compose-gradle-plugin:$composeVersion"
val commonsCompressOverride = "org.apache.commons:commons-compress:1.25.0"
}

object Android {
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ android.useAndroidX=true
android.defaults.buildfeatures.buildconfig=true

# Release information
versionName=7.12.0
versionName=7.13.0

# Override the SDK name on native crashes on Android
sentryAndroidSdkName=sentry.native.android
5 changes: 4 additions & 1 deletion sentry-android-core/api/sentry-android-core.api
Original file line number Diff line number Diff line change
@@ -427,7 +427,7 @@ public class io/sentry/android/core/performance/ActivityLifecycleTimeSpan : java
public final fun getOnStart ()Lio/sentry/android/core/performance/TimeSpan;
}

public class io/sentry/android/core/performance/AppStartMetrics {
public class io/sentry/android/core/performance/AppStartMetrics : io/sentry/android/core/performance/ActivityLifecycleCallbacksAdapter {
public fun <init> ()V
public fun addActivityLifecycleTimeSpans (Lio/sentry/android/core/performance/ActivityLifecycleTimeSpan;)V
public fun clear ()V
@@ -443,10 +443,13 @@ public class io/sentry/android/core/performance/AppStartMetrics {
public static fun getInstance ()Lio/sentry/android/core/performance/AppStartMetrics;
public fun getSdkInitTimeSpan ()Lio/sentry/android/core/performance/TimeSpan;
public fun isAppLaunchedInForeground ()Z
public fun onActivityCreated (Landroid/app/Activity;Landroid/os/Bundle;)V
public static fun onApplicationCreate (Landroid/app/Application;)V
public static fun onApplicationPostCreate (Landroid/app/Application;)V
public static fun onContentProviderCreate (Landroid/content/ContentProvider;)V
public static fun onContentProviderPostCreate (Landroid/content/ContentProvider;)V
public fun registerApplicationForegroundCheck (Landroid/app/Application;)V
public fun setAppLaunchedInForeground (Z)V
public fun setAppStartProfiler (Lio/sentry/ITransactionProfiler;)V
public fun setAppStartSamplingDecision (Lio/sentry/TracesSamplingDecision;)V
public fun setAppStartType (Lio/sentry/android/core/performance/AppStartMetrics$AppStartType;)V
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
import io.sentry.NoOpTransaction;
import io.sentry.SentryDate;
import io.sentry.SentryLevel;
import io.sentry.SentryNanotimeDate;
import io.sentry.SentryOptions;
import io.sentry.SpanStatus;
import io.sentry.TracesSamplingDecision;
@@ -37,6 +38,7 @@
import java.io.Closeable;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.Date;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.Future;
@@ -75,7 +77,7 @@ public final class ActivityLifecycleIntegration
private @Nullable ISpan appStartSpan;
private final @NotNull WeakHashMap<Activity, ISpan> ttidSpanMap = new WeakHashMap<>();
private final @NotNull WeakHashMap<Activity, ISpan> ttfdSpanMap = new WeakHashMap<>();
private @NotNull SentryDate lastPausedTime = AndroidDateUtils.getCurrentSentryDateTime();
private @NotNull SentryDate lastPausedTime = new SentryNanotimeDate(new Date(0), 0);
private final @NotNull Handler mainHandler = new Handler(Looper.getMainLooper());
private @Nullable Future<?> ttfdAutoCloseFuture = null;

@@ -627,6 +629,14 @@ WeakHashMap<Activity, ISpan> getTtfdSpanMap() {
}

private void setColdStart(final @Nullable Bundle savedInstanceState) {
// The very first activity start timestamp cannot be set to the class instantiation time, as it
// may happen before an activity is started (service, broadcast receiver, etc). So we set it
// here.
if (hub != null && lastPausedTime.nanoTimestamp() == 0) {
lastPausedTime = hub.getOptions().getDateProvider().now();
} else if (lastPausedTime.nanoTimestamp() == 0) {
lastPausedTime = AndroidDateUtils.getCurrentSentryDateTime();
}
if (!firstActivityCreated) {
// if Activity has savedInstanceState then its a warm start
// https://developer.android.com/topic/performance/vitals/launch-time#warm
Original file line number Diff line number Diff line change
@@ -4,16 +4,19 @@
import static io.sentry.cache.PersistingOptionsObserver.ENVIRONMENT_FILENAME;
import static io.sentry.cache.PersistingOptionsObserver.PROGUARD_UUID_FILENAME;
import static io.sentry.cache.PersistingOptionsObserver.RELEASE_FILENAME;
import static io.sentry.cache.PersistingOptionsObserver.REPLAY_ERROR_SAMPLE_RATE_FILENAME;
import static io.sentry.cache.PersistingOptionsObserver.SDK_VERSION_FILENAME;
import static io.sentry.cache.PersistingScopeObserver.BREADCRUMBS_FILENAME;
import static io.sentry.cache.PersistingScopeObserver.CONTEXTS_FILENAME;
import static io.sentry.cache.PersistingScopeObserver.EXTRAS_FILENAME;
import static io.sentry.cache.PersistingScopeObserver.FINGERPRINT_FILENAME;
import static io.sentry.cache.PersistingScopeObserver.LEVEL_FILENAME;
import static io.sentry.cache.PersistingScopeObserver.REPLAY_FILENAME;
import static io.sentry.cache.PersistingScopeObserver.REQUEST_FILENAME;
import static io.sentry.cache.PersistingScopeObserver.TRACE_FILENAME;
import static io.sentry.cache.PersistingScopeObserver.TRANSACTION_FILENAME;
import static io.sentry.cache.PersistingScopeObserver.USER_FILENAME;
import static io.sentry.protocol.Contexts.REPLAY_ID;

import android.annotation.SuppressLint;
import android.app.ActivityManager;
@@ -51,6 +54,8 @@
import io.sentry.protocol.SentryTransaction;
import io.sentry.protocol.User;
import io.sentry.util.HintUtils;
import java.io.File;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -78,13 +83,24 @@ public final class AnrV2EventProcessor implements BackfillingEventProcessor {

private final @NotNull SentryExceptionFactory sentryExceptionFactory;

private final @Nullable SecureRandom random;

public AnrV2EventProcessor(
final @NotNull Context context,
final @NotNull SentryAndroidOptions options,
final @NotNull BuildInfoProvider buildInfoProvider) {
this(context, options, buildInfoProvider, null);
}

AnrV2EventProcessor(
final @NotNull Context context,
final @NotNull SentryAndroidOptions options,
final @NotNull BuildInfoProvider buildInfoProvider,
final @Nullable SecureRandom random) {
this.context = context;
this.options = options;
this.buildInfoProvider = buildInfoProvider;
this.random = random;

final SentryStackTraceFactory sentryStackTraceFactory =
new SentryStackTraceFactory(this.options);
@@ -151,6 +167,72 @@ private void backfillScope(final @NotNull SentryEvent event, final @NotNull Obje
setFingerprints(event, hint);
setLevel(event);
setTrace(event);
setReplayId(event);
}

private boolean sampleReplay(final @NotNull SentryEvent event) {
final @Nullable String replayErrorSampleRate =
PersistingOptionsObserver.read(options, REPLAY_ERROR_SAMPLE_RATE_FILENAME, String.class);

if (replayErrorSampleRate == null) {
return false;
}

try {
// we have to sample here with the old sample rate, because it may change between app launches
final @NotNull SecureRandom random = this.random != null ? this.random : new SecureRandom();
final double replayErrorSampleRateDouble = Double.parseDouble(replayErrorSampleRate);
if (replayErrorSampleRateDouble < random.nextDouble()) {
options
.getLogger()
.log(
SentryLevel.DEBUG,
"Not capturing replay for ANR %s due to not being sampled.",
event.getEventId());
return false;
}
} catch (Throwable e) {
options.getLogger().log(SentryLevel.ERROR, "Error parsing replay sample rate.", e);
return false;
}

return true;
}

private void setReplayId(final @NotNull SentryEvent event) {
@Nullable
String persistedReplayId = PersistingScopeObserver.read(options, REPLAY_FILENAME, String.class);
final @NotNull File replayFolder =
new File(options.getCacheDirPath(), "replay_" + persistedReplayId);
if (!replayFolder.exists()) {
if (!sampleReplay(event)) {
return;
}
// if the replay folder does not exist (e.g. running in buffer mode), we need to find the
// latest replay folder that was modified before the ANR event.
persistedReplayId = null;
long lastModified = Long.MIN_VALUE;
final File[] dirs = new File(options.getCacheDirPath()).listFiles();
if (dirs != null) {
for (File dir : dirs) {
if (dir.isDirectory() && dir.getName().startsWith("replay_")) {
if (dir.lastModified() > lastModified
&& dir.lastModified() <= event.getTimestamp().getTime()) {
lastModified = dir.lastModified();
persistedReplayId = dir.getName().substring("replay_".length());
}
}
}
}
}

if (persistedReplayId == null) {
return;
}

// store the relevant replayId so ReplayIntegration can pick it up and finalize that replay
PersistingScopeObserver.store(options, persistedReplayId, REPLAY_FILENAME);
event.getContexts().put(REPLAY_ID, persistedReplayId);
}

private void setTrace(final @NotNull SentryEvent event) {
Loading