Skip to content

Commit 011cde7

Browse files
authored
Merge branch '8.x.x' into feat/potel-17-noop-span-factory-by-default
2 parents 6ddb833 + eff6399 commit 011cde7

File tree

139 files changed

+2385
-1374
lines changed

Some content is hidden

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

139 files changed

+2385
-1374
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: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,153 @@
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+
- Our `sentry-opentelemetry-agent` has been completely reworked and now plays nicely with the rest of the Java SDK
14+
- NOTE: Not all features have been implemented yet for the OpenTelemetry agent.
15+
- You can add `sentry-opentelemetry-agent` to your setup by downloading the latest release and using it when starting up your application
16+
- `SENTRY_PROPERTIES_FILE=sentry.properties java -javaagent:sentry-opentelemetry-agent-x.x.x.jar -jar your-application.jar`
17+
- Please use `sentry.properties` or environment variables to configure the SDK as the agent is now in charge of initializing the SDK and options coming from things like logging integrations or our Spring Boot integration will not take effect.
18+
- You may find the [docs page](https://docs.sentry.io/platforms/java/tracing/instrumentation/opentelemetry/#using-sentry-opentelemetry-agent-with-auto-initialization) useful. While we haven't updated it yet to reflect the changes described here, the section about using the agent with auto init should still be vaild.
19+
- What's new about the Agent
20+
- When the OpenTelemetry Agent is used, Sentry API creates OpenTelemetry spans under the hood, handing back a wrapper object which bridges the gap between traditional Sentry API and OpenTelemetry. We might be replacing some of the Sentry performance API in the future.
21+
- This is achieved by configuring the SDK to use `OtelSpanFactory` instead of `DefaultSpanFactory` which is done automatically by the auto init of the Java Agent.
22+
- OpenTelemetry spans are now only turned into Sentry spans when they are finished so they can be sent to the Sentry server.
23+
- Now registers an OpenTelemetry `Sampler` which uses Sentry sampling configuration
24+
- Other Performance integrations automatically stop creating spans to avoid duplicate spans
25+
- The Sentry SDK now makes use of OpenTelemetry `Context` for storing Sentry `Scopes` (which is similar to what used to be called `Hub`) and thus relies on OpenTelemetry for `Context` propagation.
26+
- Classes used for the previous version of our OpenTelemetry support have been deprecated but can still be used manually. We're not planning to keep the old agent around in favor of less complexity in the SDK.
27+
- Add `ignoredSpanOrigins` option for ignoring spans coming from certain integrations
28+
- We pre-configure this to ignore Performance instrumentation for Spring and other integrations when using our OpenTelemetry Agent to avoid duplicate spans
29+
- Add data fetching environment hint to breadcrumb for GraphQL (#3413) ([#3431](https://github.com/getsentry/sentry-java/pull/3431))
30+
31+
### Fixes
32+
33+
- `TracesSampler` is now only created once in `SentryOptions` instead of creating a new one for every `Hub` (which is now `Scopes`). This means we're now creating fewwer `SecureRandom` instances.
34+
- Move onFinishCallback before span or transaction is finished ([#3459](https://github.com/getsentry/sentry-java/pull/3459))
35+
- Add timestamp when a profile starts ([#3442](https://github.com/getsentry/sentry-java/pull/3442))
36+
- Move fragment auto span finish to onFragmentStarted ([#3424](https://github.com/getsentry/sentry-java/pull/3424))
37+
- Remove profiling timeout logic and disable profiling on API 21 ([#3478](https://github.com/getsentry/sentry-java/pull/3478))
38+
- Properly reset metric flush flag on metric emission ([#3493](https://github.com/getsentry/sentry-java/pull/3493))
39+
40+
41+
### Dependencies
42+
43+
- Bump Native SDK from v0.7.0 to v0.7.5 ([#3441](https://github.com/getsentry/sentry-java/pull/3189))
44+
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#075)
45+
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.0...0.7.5)
46+
47+
## 8.0.0-alpha.1
48+
49+
Version 8 of the Sentry Android/Java SDK brings a variety of features and fixes. The most notable changes are:
50+
51+
- New `Scope` types have been introduced, see "Behavioural Changes" for more details.
52+
- Lifecycle tokens have been introduced to manage `Scope` lifecycle, see "Behavioural Changes" for more details.
53+
- `Hub` has been replaced by `Scopes`
54+
55+
### Behavioural Changes
56+
57+
- 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.
58+
- 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) -> { ... })`.
59+
- 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.
60+
- 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.
61+
- `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".
62+
- We have chosen a default scope that is used for `Sentry.configureScope()` as well as API like `Sentry.setTag()`
63+
- For Android the type defaults to `CURRENT` scope
64+
- For Backend and other JVM applicatons it defaults to `ISOLATION` scope
65+
- 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.
66+
- `Hub` is deprecated in favor of `Scopes`, alongside some `Hub` relevant APIs. More details can be found in the "Migration Guide" section.
67+
68+
### Breaking Changes
69+
70+
- `Contexts` no longer extends `ConcurrentHashMap`, instead we offer a selected set of methods.
71+
72+
### Migration Guide / Deprecations
73+
74+
- `Hub` has been deprecated, we're replacing the following:
75+
- `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.
76+
- `HubAdapter.getInstance()` has been replaced by `ScopesAdapter.getInstance()`
77+
- The `.clone()` method on `IHub`/`IScopes` has been deprecated, please use `.pushScope()` or `.pushIsolationScope()` instead
78+
- Some internal methods like `.getCurrentHub()` and `.setCurrentHub()` have also been replaced.
79+
- `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:
80+
81+
```
82+
try (final @NotNull ISentryLifecycleToken ignored = Sentry.pushScope()) {
83+
// this block has its separate current scope
84+
}
85+
```
86+
87+
as well as:
88+
89+
90+
```
91+
try (final @NotNull ISentryLifecycleToken ignored = Sentry.pushIsolationScope()) {
92+
// this block has its separate isolation scope
93+
}
94+
```
95+
96+
You may also use `LifecycleHelper.close(token)`, e.g. in case you need to pass the token around for closing later.
97+
98+
### Features
99+
100+
- Report exceptions returned by Throwable.getSuppressed() to Sentry as exception groups ([#3396] https://github.com/getsentry/sentry-java/pull/3396)
101+
102+
## 7.10.0
103+
104+
### Features
105+
106+
- Publish Gradle module metadata ([#3422](https://github.com/getsentry/sentry-java/pull/3422))
107+
108+
### Fixes
109+
110+
- Fix faulty `span.frame_delay` calculation for early app start spans ([#3427](https://github.com/getsentry/sentry-java/pull/3427))
111+
- Fix crash when installing `ShutdownHookIntegration` and the VM is shutting down ([#3456](https://github.com/getsentry/sentry-java/pull/3456))
112+
113+
## 7.9.0
114+
115+
### Features
116+
117+
- Add start_type to app context ([#3379](https://github.com/getsentry/sentry-java/pull/3379))
118+
- Add ttid/ttfd contribution flags ([#3386](https://github.com/getsentry/sentry-java/pull/3386))
119+
120+
### Fixes
121+
122+
- (Internal) Metrics code cleanup ([#3403](https://github.com/getsentry/sentry-java/pull/3403))
123+
- Fix Frame measurements in app start transactions ([#3382](https://github.com/getsentry/sentry-java/pull/3382))
124+
- Fix timing metric value different from span duration ([#3368](https://github.com/getsentry/sentry-java/pull/3368))
125+
- Do not always write startup crash marker ([#3409](https://github.com/getsentry/sentry-java/pull/3409))
126+
- This may have been causing the SDK init logic to block the main thread
127+
128+
## 7.8.0
129+
130+
### Features
131+
132+
- Add description to OkHttp spans ([#3320](https://github.com/getsentry/sentry-java/pull/3320))
133+
- Enable backpressure management by default ([#3284](https://github.com/getsentry/sentry-java/pull/3284))
134+
135+
### Fixes
136+
137+
- Add rate limit to Metrics ([#3334](https://github.com/getsentry/sentry-java/pull/3334))
138+
- 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))
139+
- Fix normalization of metrics keys, tags and values ([#3332](https://github.com/getsentry/sentry-java/pull/3332))
140+
141+
## 7.7.0
142+
5143
### Features
6144

7145
- Add support for Spring Rest Client ([#3199](https://github.com/getsentry/sentry-java/pull/3199))
146+
- Extend Proxy options with proxy type ([#3326](https://github.com/getsentry/sentry-java/pull/3326))
147+
148+
### Fixes
149+
150+
- Fixed default deadline timeout to 30s instead of 300s ([#3322](https://github.com/getsentry/sentry-java/pull/3322))
151+
- 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))
8152

9153
## 7.6.0
10154

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)