Skip to content

Commit d46cc68

Browse files
authored
Merge branch '8.x.x' into feat/potel-14-sync-span-name
2 parents ce1f729 + 94ba63c commit d46cc68

File tree

128 files changed

+1984
-1328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+1984
-1328
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ jobs:
3535
run: make preMerge
3636

3737
- name: Upload coverage to Codecov
38-
uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # pin@v3
38+
uses: codecov/codecov-action@5ecb98a3c6b747ed38dc09f787459979aebb39be # pin@v4
3939
with:
4040
name: sentry-java
4141
fail_ci_if_error: false
42+
token: ${{ secrets.CODECOV_TOKEN }}
4243

4344
- name: Upload test results
4445
if: always()

.github/workflows/update-deps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
native:
1414
uses: getsentry/github-workflows/.github/workflows/updater.yml@v2
1515
with:
16-
path: sentry-android-ndk/sentry-native
16+
path: scripts/update-sentry-native-ndk.sh
1717
name: Native SDK
1818
secrets:
1919
# If a custom token is used instead, a CI would be triggered on a created PR.

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
[submodule "sentry-android-ndk/sentry-native"]
2-
path = sentry-android-ndk/sentry-native
3-
url = https://github.com/getsentry/sentry-native

CHANGELOG.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,121 @@
22

33
## Unreleased
44

5+
### Behavioural Changes
6+
7+
- (Android) The JNI layer for sentry-native has now been moved from sentry-java to sentry-native ([#3189](https://github.com/getsentry/sentry-java/pull/3189))
8+
- This now includes prefab support for sentry-native, allowing you to link and access the sentry-native API within your native app code
9+
- Checkout the `sentry-samples/sentry-samples-android` example on how to configure CMake and consume `sentry.h`
10+
11+
### Features
12+
13+
- Publish Gradle module metadata ([#3422](https://github.com/getsentry/sentry-java/pull/3422))
14+
- Add data fetching environment hint to breadcrumb for GraphQL (#3413) ([#3431](https://github.com/getsentry/sentry-java/pull/3431))
15+
16+
### Fixes
17+
18+
- Fix faulty `span.frame_delay` calculation for early app start spans ([#3427](https://github.com/getsentry/sentry-java/pull/3427))
19+
20+
### Dependencies
21+
22+
- Bump Native SDK from v0.7.0 to v0.7.5 ([#3441](https://github.com/getsentry/sentry-java/pull/3189))
23+
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#075)
24+
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.0...0.7.5)
25+
26+
## 8.0.0-alpha.1
27+
28+
Version 8 of the Sentry Android/Java SDK brings a variety of features and fixes. The most notable changes are:
29+
30+
- New `Scope` types have been introduced, see "Behavioural Changes" for more details.
31+
- Lifecycle tokens have been introduced to manage `Scope` lifecycle, see "Behavioural Changes" for more details.
32+
- `Hub` has been replaced by `Scopes`
33+
34+
### Behavioural Changes
35+
36+
- We're introducing some new `Scope` types in the SDK, allowing for better control over what data is attached where. Previously there was a stack of scopes that was pushed and popped. Instead we now fork scopes for a given lifecycle and then restore the previous scopes. Since `Hub` is gone, it is also never cloned anymore. Separation of data now happens through the different scope types while making it easier to manipulate exactly what you need without having to attach data at the right time to have it apply where wanted.
37+
- Global scope is attached to all events created by the SDK. It can also be modified before `Sentry.init` has been called. It can be manipulated using `Sentry.configureScope(ScopeType.GLOBAL, (scope) -> { ... })`.
38+
- Isolation scope can be used e.g. to attach data to all events that come up while handling an incoming request. It can also be used for other isolation purposes. It can be manipulated using `Sentry.configureScope(ScopeType.ISOLATION, (scope) -> { ... })`. The SDK automatically forks isolation scope in certain cases like incoming requests, CRON jobs, Spring `@Async` and more.
39+
- Current scope is forked often and data added to it is only added to events that are created while this scope is active. Data is also passed on to newly forked child scopes but not to parents.
40+
- `Sentry.popScope` has been deprecated, please call `.close()` on the token returned by `Sentry.pushScope` instead or use it in a way described in more detail in "Migration Guide".
41+
- We have chosen a default scope that is used for `Sentry.configureScope()` as well as API like `Sentry.setTag()`
42+
- For Android the type defaults to `CURRENT` scope
43+
- For Backend and other JVM applicatons it defaults to `ISOLATION` scope
44+
- Event processors on `Scope` can now be ordered by overriding the `getOrder` method on implementations of `EventProcessor`. NOTE: This order only applies to event processors on `Scope` but not `SentryOptions` at the moment. Feel free to request this if you need it.
45+
- `Hub` is deprecated in favor of `Scopes`, alongside some `Hub` relevant APIs. More details can be found in the "Migration Guide" section.
46+
47+
### Breaking Changes
48+
49+
- `Contexts` no longer extends `ConcurrentHashMap`, instead we offer a selected set of methods.
50+
51+
### Migration Guide / Deprecations
52+
53+
- `Hub` has been deprecated, we're replacing the following:
54+
- `IHub` has been replaced by `IScopes`, however you should be able to simply pass `IHub` instances to code expecting `IScopes`, allowing for an easier migration.
55+
- `HubAdapter.getInstance()` has been replaced by `ScopesAdapter.getInstance()`
56+
- The `.clone()` method on `IHub`/`IScopes` has been deprecated, please use `.pushScope()` or `.pushIsolationScope()` instead
57+
- Some internal methods like `.getCurrentHub()` and `.setCurrentHub()` have also been replaced.
58+
- `Sentry.popScope` has been replaced by calling `.close()` on the token returned by `Sentry.pushScope()` and `Sentry.pushIsolationScope()`. The token can also be used in a `try` block like this:
59+
60+
```
61+
try (final @NotNull ISentryLifecycleToken ignored = Sentry.pushScope()) {
62+
// this block has its separate current scope
63+
}
64+
```
65+
66+
as well as:
67+
68+
69+
```
70+
try (final @NotNull ISentryLifecycleToken ignored = Sentry.pushIsolationScope()) {
71+
// this block has its separate isolation scope
72+
}
73+
```
74+
75+
You may also use `LifecycleHelper.close(token)`, e.g. in case you need to pass the token around for closing later.
76+
77+
### Features
78+
79+
- Report exceptions returned by Throwable.getSuppressed() to Sentry as exception groups ([#3396] https://github.com/getsentry/sentry-java/pull/3396)
80+
81+
## 7.9.0
82+
83+
### Features
84+
85+
- Add start_type to app context ([#3379](https://github.com/getsentry/sentry-java/pull/3379))
86+
- Add ttid/ttfd contribution flags ([#3386](https://github.com/getsentry/sentry-java/pull/3386))
87+
88+
### Fixes
89+
90+
- (Internal) Metrics code cleanup ([#3403](https://github.com/getsentry/sentry-java/pull/3403))
91+
- Fix Frame measurements in app start transactions ([#3382](https://github.com/getsentry/sentry-java/pull/3382))
92+
- Fix timing metric value different from span duration ([#3368](https://github.com/getsentry/sentry-java/pull/3368))
93+
- Do not always write startup crash marker ([#3409](https://github.com/getsentry/sentry-java/pull/3409))
94+
- This may have been causing the SDK init logic to block the main thread
95+
96+
## 7.8.0
97+
98+
### Features
99+
100+
- Add description to OkHttp spans ([#3320](https://github.com/getsentry/sentry-java/pull/3320))
101+
- Enable backpressure management by default ([#3284](https://github.com/getsentry/sentry-java/pull/3284))
102+
103+
### Fixes
104+
105+
- Add rate limit to Metrics ([#3334](https://github.com/getsentry/sentry-java/pull/3334))
106+
- Fix java.lang.ClassNotFoundException: org.springframework.web.servlet.HandlerMapping in Spring Boot Servlet mode without WebMVC ([#3336](https://github.com/getsentry/sentry-java/pull/3336))
107+
- Fix normalization of metrics keys, tags and values ([#3332](https://github.com/getsentry/sentry-java/pull/3332))
108+
109+
## 7.7.0
110+
5111
### Features
6112

7113
- Add support for Spring Rest Client ([#3199](https://github.com/getsentry/sentry-java/pull/3199))
114+
- Extend Proxy options with proxy type ([#3326](https://github.com/getsentry/sentry-java/pull/3326))
115+
116+
### Fixes
117+
118+
- Fixed default deadline timeout to 30s instead of 300s ([#3322](https://github.com/getsentry/sentry-java/pull/3322))
119+
- Fixed `Fix java.lang.ClassNotFoundException: org.springframework.web.servlet.HandlerExceptionResolver` in Spring Boot Servlet mode without WebMVC ([#3333](https://github.com/getsentry/sentry-java/pull/3333))
8120

9121
## 7.6.0
10122

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Sentry
3+
Copyright (c) 2019-2024 Sentry
44
Copyright (c) 2015 Salomon BRYS for Android ANRWatchDog
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy

build.gradle.kts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ buildscript {
3232
classpath(Config.QualityPlugins.errorpronePlugin)
3333
classpath(Config.QualityPlugins.gradleVersionsPlugin)
3434

35-
// add classpath of androidNativeBundle
36-
// com.ydq.android.gradle.build.tool:nativeBundle:{version}}
37-
classpath(Config.NativePlugins.nativeBundlePlugin)
38-
3935
// add classpath of sentry android gradle plugin
4036
// classpath("io.sentry:sentry-android-gradle-plugin:{version}")
4137

@@ -78,6 +74,7 @@ allprojects {
7874
repositories {
7975
google()
8076
mavenCentral()
77+
mavenLocal()
8178
}
8279
group = Config.Sentry.group
8380
version = properties[Config.Sentry.versionNameProp].toString()
@@ -160,16 +157,7 @@ subprojects {
160157
if (this@subprojects.name.contains("-compose")) {
161158
this.configureForMultiplatform(this@subprojects)
162159
} else {
163-
this.getByName("main").contents {
164-
// non android modules
165-
from("build${sep}libs")
166-
from("build${sep}publications${sep}maven")
167-
// android modules
168-
from("build${sep}outputs${sep}aar") {
169-
include("*-release*")
170-
}
171-
from("build${sep}publications${sep}release")
172-
}
160+
this.configureForJvm(this@subprojects)
173161
}
174162
// craft only uses zip archives
175163
this.forEach { dist ->

buildSrc/src/main/java/Config.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,4 @@ object Config {
256256
val errorprone = "com.google.errorprone:error_prone_core:2.11.0"
257257
val errorProneNullAway = "com.uber.nullaway:nullaway:0.9.5"
258258
}
259-
260-
object NativePlugins {
261-
val nativeBundlePlugin = "io.github.howardpang:androidNativeBundle:1.1.1"
262-
val nativeBundleExport = "com.ydq.android.gradle.native-aar.export"
263-
}
264259
}

buildSrc/src/main/java/Publication.kt

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ private object Consts {
1010
// configure distZip tasks for multiplatform
1111
fun DistributionContainer.configureForMultiplatform(project: Project) {
1212
val sep = File.separator
13+
val version = project.properties["versionName"].toString()
1314

1415
this.maybeCreate("android").contents {
15-
from("build${sep}publications${sep}androidRelease")
16+
from("build${sep}publications${sep}androidRelease") {
17+
renameModule(project.name, "android", version = version)
18+
}
1619
from("build${sep}outputs${sep}aar") {
1720
include("*-release*")
1821
rename {
@@ -25,7 +28,9 @@ fun DistributionContainer.configureForMultiplatform(project: Project) {
2528
}
2629
}
2730
this.getByName("main").contents {
28-
from("build${sep}publications${sep}kotlinMultiplatform")
31+
from("build${sep}publications${sep}kotlinMultiplatform") {
32+
renameModule(project.name, version = version)
33+
}
2934
from("build${sep}kotlinToolingMetadata")
3035
from("build${sep}libs") {
3136
include("*compose-kotlin*")
@@ -39,7 +44,9 @@ fun DistributionContainer.configureForMultiplatform(project: Project) {
3944
}
4045
this.maybeCreate("desktop").contents {
4146
// kotlin multiplatform modules
42-
from("build${sep}publications${sep}desktop")
47+
from("build${sep}publications${sep}desktop") {
48+
renameModule(project.name, "desktop", version = version)
49+
}
4350
from("build${sep}libs") {
4451
include("*desktop*")
4552
withJavadoc(renameTo = "compose-desktop")
@@ -53,6 +60,26 @@ fun DistributionContainer.configureForMultiplatform(project: Project) {
5360
project.tasks.getByName("distZip").finalizedBy(*platformDists)
5461
}
5562

63+
fun DistributionContainer.configureForJvm(project: Project) {
64+
val sep = File.separator
65+
val version = project.properties["versionName"].toString()
66+
67+
this.getByName("main").contents {
68+
// non android modules
69+
from("build${sep}libs")
70+
from("build${sep}publications${sep}maven") {
71+
renameModule(project.name, version = version)
72+
}
73+
// android modules
74+
from("build${sep}outputs${sep}aar") {
75+
include("*-release*")
76+
}
77+
from("build${sep}publications${sep}release") {
78+
renameModule(project.name, version = version)
79+
}
80+
}
81+
}
82+
5683
private fun CopySpec.withJavadoc(renameTo: String = "compose") {
5784
include("*javadoc*")
5885
rename {
@@ -63,3 +90,13 @@ private fun CopySpec.withJavadoc(renameTo: String = "compose") {
6390
}
6491
}
6592
}
93+
94+
private fun CopySpec.renameModule(projectName: String, renameTo: String = "", version: String) {
95+
var target = ""
96+
if (renameTo.isNotEmpty()) {
97+
target = "-$renameTo"
98+
}
99+
rename {
100+
it.replace("module.json", "$projectName$target-$version.module")
101+
}
102+
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ android.useAndroidX=true
1010
android.defaults.buildfeatures.buildconfig=true
1111

1212
# Release information
13-
versionName=7.6.0
13+
versionName=8.0.0-alpha.1
1414

1515
# Override the SDK name on native crashes on Android
1616
sentryAndroidSdkName=sentry.native.android
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
cd $(dirname "$0")/../
5+
GRADLE_NDK_FILEPATH=sentry-android-ndk/build.gradle.kts
6+
GRADLE_SAMPLE_FILEPATH=sentry-samples/sentry-samples-android/build.gradle.kts
7+
8+
case $1 in
9+
get-version)
10+
version=$(perl -ne 'print "$1\n" if ( m/io\.sentry:sentry-native-ndk:([0-9.]+)+/ )' $GRADLE_NDK_FILEPATH)
11+
12+
echo "v$version"
13+
;;
14+
get-repo)
15+
echo "https://github.com/getsentry/sentry-native.git"
16+
;;
17+
set-version)
18+
version=$2
19+
20+
# Remove leading "v"
21+
if [[ "$version" == v* ]]; then
22+
version="${version:1}"
23+
fi
24+
25+
echo "Setting sentry-native-ndk version to '$version'"
26+
27+
PATTERN="io\.sentry:sentry-native-ndk:([0-9.]+)+"
28+
perl -pi -e "s/$PATTERN/io.sentry:sentry-native-ndk:$version/g" $GRADLE_NDK_FILEPATH
29+
perl -pi -e "s/$PATTERN/io.sentry:sentry-native-ndk:$version/g" $GRADLE_SAMPLE_FILEPATH
30+
;;
31+
*)
32+
echo "Unknown argument $1"
33+
exit 1
34+
;;
35+
esac

0 commit comments

Comments
 (0)