Skip to content

Commit

Permalink
Merge a62056e into 25f1ca4
Browse files Browse the repository at this point in the history
  • Loading branch information
adinauer authored Jul 2, 2024
2 parents 25f1ca4 + a62056e commit a59fca2
Show file tree
Hide file tree
Showing 441 changed files with 15,338 additions and 6,311 deletions.
1 change: 0 additions & 1 deletion .craft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ targets:
maven:io.sentry:sentry-android-core:
maven:io.sentry:sentry-android-ndk:
maven:io.sentry:sentry-android-timber:
maven:io.sentry:sentry-android-okhttp:
maven:io.sentry:sentry-kotlin-extensions:
maven:io.sentry:sentry-android-fragment:
maven:io.sentry:sentry-bom:
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ body:
options:
- sentry-android
- sentry-android-ndk
- sentry-android-okhttp
- sentry-android-timber
- sentry-android-fragment
- sentry-android-sqlite
- sentry-apollo
- sentry-compose
- sentry-apollo-3
- sentry-compose
- sentry-okhttp
- other
validations:
required: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/system-tests-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

- name: Exclude android modules from build
run: |
sed -i -e '/.*"sentry-android-ndk",/d' -e '/.*"sentry-android",/d' -e '/.*"sentry-compose",/d' -e '/.*"sentry-android-core",/d' -e '/.*"sentry-android-fragment",/d' -e '/.*"sentry-android-navigation",/d' -e '/.*"sentry-android-okhttp",/d' -e '/.*"sentry-android-sqlite",/d' -e '/.*"sentry-android-timber",/d' -e '/.*"sentry-android-integration-tests:sentry-uitest-android-benchmark",/d' -e '/.*"sentry-android-integration-tests:sentry-uitest-android",/d' -e '/.*"sentry-android-integration-tests:test-app-sentry",/d' -e '/.*"sentry-samples:sentry-samples-android",/d' settings.gradle.kts
sed -i -e '/.*"sentry-android-ndk",/d' -e '/.*"sentry-android",/d' -e '/.*"sentry-compose",/d' -e '/.*"sentry-android-core",/d' -e '/.*"sentry-android-fragment",/d' -e '/.*"sentry-android-navigation",/d' -e '/.*"sentry-android-sqlite",/d' -e '/.*"sentry-android-timber",/d' -e '/.*"sentry-android-integration-tests:sentry-uitest-android-benchmark",/d' -e '/.*"sentry-android-integration-tests:sentry-uitest-android",/d' -e '/.*"sentry-android-integration-tests:test-app-sentry",/d' -e '/.*"sentry-samples:sentry-samples-android",/d' settings.gradle.kts
- name: Exclude android modules from ignore list
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
native:
uses: getsentry/github-workflows/.github/workflows/updater.yml@v2
with:
path: sentry-android-ndk/sentry-native
path: scripts/update-sentry-native-ndk.sh
name: Native SDK
secrets:
# If a custom token is used instead, a CI would be triggered on a created PR.
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "sentry-android-ndk/sentry-native"]
path = sentry-android-ndk/sentry-native
url = https://github.com/getsentry/sentry-native
151 changes: 151 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,156 @@
# Changelog

## Unreleased

### Breaking Changes

- `sentry-android-okhttp` has been removed in favor of `sentry-okhttp`, removing android dependency from the module ([#3510](https://github.com/getsentry/sentry-java/pull/3510))

### Fixes

- Support spans that are split into multiple batches ([#3539](https://github.com/getsentry/sentry-java/pull/3539))
- When spans belonging to a single transaction were split into multiple batches for SpanExporter, we did not add all spans because the isSpanTooOld check wasn't inverted.
- Parse and use `send-default-pii` and `max-request-body-size` from `sentry.properties` ([#3534](https://github.com/getsentry/sentry-java/pull/3534))

## 8.0.0-alpha.2

### Behavioural Changes

- (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))
- This now includes prefab support for sentry-native, allowing you to link and access the sentry-native API within your native app code
- Checkout the `sentry-samples/sentry-samples-android` example on how to configure CMake and consume `sentry.h`

### Features

- Our `sentry-opentelemetry-agent` has been completely reworked and now plays nicely with the rest of the Java SDK
- You may also want to give this new agent a try even if you haven't used OpenTelemetry (with Sentry) before. It offers support for [many more libraries and frameworks](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md), improving on our trace propagation, `Scopes` (used to be `Hub`) propagation as well as performance instrumentation (i.e. more spans).
- If you are using a framework we did not support before and currently resort to manual instrumentation, please give the agent a try. See [here for a list of supported libraries, frameworks and application servers](https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/docs/supported-libraries.md).
- NOTE: Not all features have been implemented yet for the OpenTelemetry agent. Features of note that are not working yet:
- Metrics
- Measurements
- `forceFinish` on transaction
- `scheduleFinish` on transaction
- see [#3436](https://github.com/getsentry/sentry-java/issues/3436) for a more up-to-date list of features we have (not) implemented
- Please see "Installing `sentry-opentelemetry-agent`" for more details on how to set up the agent.
- What's new about the Agent
- 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.
- 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.
- OpenTelemetry spans are now only turned into Sentry spans when they are finished so they can be sent to the Sentry server.
- Now registers an OpenTelemetry `Sampler` which uses Sentry sampling configuration
- Other Performance integrations automatically stop creating spans to avoid duplicate spans
- 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.
- 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.
- Add `ignoredSpanOrigins` option for ignoring spans coming from certain integrations
- We pre-configure this to ignore Performance instrumentation for Spring and other integrations when using our OpenTelemetry Agent to avoid duplicate spans
- Add data fetching environment hint to breadcrumb for GraphQL (#3413) ([#3431](https://github.com/getsentry/sentry-java/pull/3431))

### Fixes

- `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 fewer `SecureRandom` instances.
- Move onFinishCallback before span or transaction is finished ([#3459](https://github.com/getsentry/sentry-java/pull/3459))
- Add timestamp when a profile starts ([#3442](https://github.com/getsentry/sentry-java/pull/3442))
- Move fragment auto span finish to onFragmentStarted ([#3424](https://github.com/getsentry/sentry-java/pull/3424))
- Remove profiling timeout logic and disable profiling on API 21 ([#3478](https://github.com/getsentry/sentry-java/pull/3478))
- Properly reset metric flush flag on metric emission ([#3493](https://github.com/getsentry/sentry-java/pull/3493))

### Migration Guide / Deprecations

- Classes used for the previous version of the Sentry OpenTelemetry Java Agent have been deprecated (`SentrySpanProcessor`, `SentryPropagator`, `OpenTelemetryLinkErrorEventProcessor`)
- Sentry OpenTelemetry Java Agent has been reworked and now allows you to manually create spans using Sentry API as well.
- Please see "Installing `sentry-opentelemetry-agent`" for more details on how to set up the agent.

### Installing `sentry-opentelemetry-agent`

#### Upgrading from a previous agent
If you've been using the previous version of `sentry-opentelemetry-agent`, simply replace the agent JAR with the [latest release](https://central.sonatype.com/artifact/io.sentry/sentry-opentelemetry-agent?smo=true) and start your application. That should be it.

#### New to the agent
If you've not been using OpenTelemetry before, you can add `sentry-opentelemetry-agent` to your setup by downloading the latest release and using it when starting up your application
- `SENTRY_PROPERTIES_FILE=sentry.properties java -javaagent:sentry-opentelemetry-agent-x.x.x.jar -jar your-application.jar`
- 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.
- 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 valid.

If you want to skip auto initialization of the SDK performed by the agent, please follow the steps above and set the environment variable `SENTRY_AUTO_INIT` to `false` then add the following to your `Sentry.init`:

```
Sentry.init(options -> {
options.setDsn("https://3d2ac63d6e1a4c6e9214443678f119a3@o87286.ingest.us.sentry.io/1801383");
OpenTelemetryUtil.applyOpenTelemetryOptions(options);
...
});
```

If you're using our Spring (Boot) integration with auto init, use the following:
```
@Bean
Sentry.OptionsConfiguration<SentryOptions> optionsConfiguration() {
return (options) -> {
OpenTelemetryUtil.applyOpenTelemetryOptions(options);
};
}
```

### Dependencies

- Bump Native SDK from v0.7.0 to v0.7.5 ([#3441](https://github.com/getsentry/sentry-java/pull/3189))
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#075)
- [diff](https://github.com/getsentry/sentry-native/compare/0.7.0...0.7.5)

## 8.0.0-alpha.1

Version 8 of the Sentry Android/Java SDK brings a variety of features and fixes. The most notable changes are:

- New `Scope` types have been introduced, see "Behavioural Changes" for more details.
- Lifecycle tokens have been introduced to manage `Scope` lifecycle, see "Behavioural Changes" for more details.
- `Hub` has been replaced by `Scopes`

### Behavioural Changes

- 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.
- 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) -> { ... })`.
- 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.
- 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.
- `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".
- We have chosen a default scope that is used for `Sentry.configureScope()` as well as API like `Sentry.setTag()`
- For Android the type defaults to `CURRENT` scope
- For Backend and other JVM applicatons it defaults to `ISOLATION` scope
- 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.
- `Hub` is deprecated in favor of `Scopes`, alongside some `Hub` relevant APIs. More details can be found in the "Migration Guide" section.

### Breaking Changes

- `Contexts` no longer extends `ConcurrentHashMap`, instead we offer a selected set of methods.

### Migration Guide / Deprecations

- `Hub` has been deprecated, we're replacing the following:
- `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.
- `HubAdapter.getInstance()` has been replaced by `ScopesAdapter.getInstance()`
- The `.clone()` method on `IHub`/`IScopes` has been deprecated, please use `.pushScope()` or `.pushIsolationScope()` instead
- Some internal methods like `.getCurrentHub()` and `.setCurrentHub()` have also been replaced.
- `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:

```
try (final @NotNull ISentryLifecycleToken ignored = Sentry.pushScope()) {
// this block has its separate current scope
}
```

as well as:


```
try (final @NotNull ISentryLifecycleToken ignored = Sentry.pushIsolationScope()) {
// this block has its separate isolation scope
}
```

You may also use `LifecycleHelper.close(token)`, e.g. in case you need to pass the token around for closing later.

### Features

- Report exceptions returned by Throwable.getSuppressed() to Sentry as exception groups ([#3396] https://github.com/getsentry/sentry-java/pull/3396)

## 7.11.0

### Features
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Sentry SDK for Java and Android
| sentry-android | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android) | 19 |
| sentry-android-core | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-core) | 19 |
| sentry-android-ndk | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-ndk/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-ndk) | 19 |
| sentry-android-okhttp | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-okhttp/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-okhttp) | 21 |
| sentry-android-timber | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-timber/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-timber) | 19 |
| 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 |
Expand Down
9 changes: 2 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ buildscript {
classpath(Config.QualityPlugins.errorpronePlugin)
classpath(Config.QualityPlugins.gradleVersionsPlugin)

// add classpath of androidNativeBundle
// com.ydq.android.gradle.build.tool:nativeBundle:{version}}
classpath(Config.NativePlugins.nativeBundlePlugin)

// add classpath of sentry android gradle plugin
// classpath("io.sentry:sentry-android-gradle-plugin:{version}")

Expand Down Expand Up @@ -78,6 +74,7 @@ allprojects {
repositories {
google()
mavenCentral()
mavenLocal()
}
group = Config.Sentry.group
version = properties[Config.Sentry.versionNameProp].toString()
Expand All @@ -99,7 +96,7 @@ allprojects {
dependsOn("cleanTest")
}
withType<JavaCompile> {
options.compilerArgs.addAll(arrayOf("-Xlint:all", "-Werror", "-Xlint:-classfile", "-Xlint:-processing"))
options.compilerArgs.addAll(arrayOf("-Xlint:all", "-Werror", "-Xlint:-classfile", "-Xlint:-processing", "-Xlint:-try"))
}
}
}
Expand All @@ -110,7 +107,6 @@ subprojects {
"sentry-android-fragment",
"sentry-android-navigation",
"sentry-android-ndk",
"sentry-android-okhttp",
"sentry-android-sqlite",
"sentry-android-timber"
)
Expand Down Expand Up @@ -294,7 +290,6 @@ private val androidLibs = setOf(
"sentry-android-ndk",
"sentry-android-fragment",
"sentry-android-navigation",
"sentry-android-okhttp",
"sentry-android-timber",
"sentry-compose-android"
)
Expand Down
13 changes: 5 additions & 8 deletions buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ object Config {
val apolloKotlin = "com.apollographql.apollo3:apollo-runtime:3.8.2"

object OpenTelemetry {
val otelVersion = "1.33.0"
val otelVersion = "1.39.0"
val otelAlphaVersion = "$otelVersion-alpha"
val otelJavaagentVersion = "1.32.0"
val otelJavaagentVersion = "2.5.0"
val otelJavaagentAlphaVersion = "$otelJavaagentVersion-alpha"
val otelSemanticConvetionsVersion = "1.23.1-alpha"

Expand Down Expand Up @@ -199,7 +199,9 @@ object Config {
object QualityPlugins {
object Jacoco {
val version = "0.8.7"
val minimumCoverage = BigDecimal.valueOf(0.6)

// TODO [POTEL] add tests and restore
val minimumCoverage = BigDecimal.valueOf(0.1)
}
val spotless = "com.diffplug.spotless"
val spotlessVersion = "6.11.0"
Expand Down Expand Up @@ -254,9 +256,4 @@ object Config {
val errorprone = "com.google.errorprone:error_prone_core:2.11.0"
val errorProneNullAway = "com.uber.nullaway:nullaway:0.9.5"
}

object NativePlugins {
val nativeBundlePlugin = "io.github.howardpang:androidNativeBundle:1.1.1"
val nativeBundleExport = "com.ydq.android.gradle.native-aar.export"
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android.useAndroidX=true
android.defaults.buildfeatures.buildconfig=true

# Release information
versionName=7.11.0
versionName=8.0.0-alpha.2

# Override the SDK name on native crashes on Android
sentryAndroidSdkName=sentry.native.android
Expand Down
35 changes: 35 additions & 0 deletions scripts/update-sentry-native-ndk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
set -euo pipefail

cd $(dirname "$0")/../
GRADLE_NDK_FILEPATH=sentry-android-ndk/build.gradle.kts
GRADLE_SAMPLE_FILEPATH=sentry-samples/sentry-samples-android/build.gradle.kts

case $1 in
get-version)
version=$(perl -ne 'print "$1\n" if ( m/io\.sentry:sentry-native-ndk:([0-9.]+)+/ )' $GRADLE_NDK_FILEPATH)

echo "v$version"
;;
get-repo)
echo "https://github.com/getsentry/sentry-native.git"
;;
set-version)
version=$2

# Remove leading "v"
if [[ "$version" == v* ]]; then
version="${version:1}"
fi

echo "Setting sentry-native-ndk version to '$version'"

PATTERN="io\.sentry:sentry-native-ndk:([0-9.]+)+"
perl -pi -e "s/$PATTERN/io.sentry:sentry-native-ndk:$version/g" $GRADLE_NDK_FILEPATH
perl -pi -e "s/$PATTERN/io.sentry:sentry-native-ndk:$version/g" $GRADLE_SAMPLE_FILEPATH
;;
*)
echo "Unknown argument $1"
exit 1
;;
esac
Loading

0 comments on commit a59fca2

Please sign in to comment.