Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/platforms/android/features/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Sentry's Android SDK enables automatic reporting of errors and exceptions, and i

<Expandable title="Already using Sentry for Android? Here are some recent highlights">

We released <PlatformLink to="/tracing/instrumentation/perf-v2/">Performance-V2</PlatformLink>,
a set of experimental features to give you more details about app start performance and frame delay on a span level.
We released <PlatformLink to="/tracing/instrumentation/perf-v2/">Performance V2</PlatformLink>,
a set of features that give you more details about app start performance and frame delay on a span level.

We released <PlatformLink to="/enhance-errors/source-context/">Source Context</PlatformLink>, which shows snippets of code around the location of stack frames.

Expand Down
22 changes: 21 additions & 1 deletion docs/platforms/android/migration/v8-to-v9.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: "Learn how to migrate from Sentry Android SDK 8.x to 9.0.0."
sidebar_order: 8890
---

Version 9 removes the deprecated Hub compatibility APIs and the global Logs and Metrics enable options. Migrate remaining Hub references to Scopes, then update your telemetry configuration.
Version 9 removes the deprecated Hub compatibility APIs, the global Logs and Metrics enable options, and the `enablePerformanceV2` option. Migrate remaining Hub references to Scopes, then update your telemetry configuration.

## Removed Hub APIs

Expand Down Expand Up @@ -71,3 +71,23 @@ new SentryTimberIntegration(false);
```

Pass `true` only when Timber records should also be sent as Sentry Logs.

## Removed Performance V2 Option

Version 8 enabled Performance V2 by default. Version 9 always enables it and removes the option to turn it off:

- `SentryAndroidOptions.setEnablePerformanceV2(...)` and `SentryAndroidOptions.isEnablePerformanceV2()` have been removed. Delete these calls.
- The `io.sentry.performance-v2.enable` manifest entry has been removed. Delete it from your manifest:

```xml {filename:AndroidManifest.xml}
<meta-data android:name="io.sentry.performance-v2.enable" android:value="false" />
```

If you previously turned Performance V2 off, the SDK now:

- Measures app starts from process start on Android 7.0 (API 24) and later. Below API 24, it falls back to the SDK initialization time.
- Measures slow and frozen frames for each span instead of only for Activity transactions.

### Removed `ActivityFramesTracker`

`ActivityFramesTracker` has been removed, and the `ActivityLifecycleIntegration` constructor no longer takes it. If you create `ActivityLifecycleIntegration` manually, pass only the `Application` and `BuildInfoProvider` arguments.
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ For example, when the SDK uses process-start timing, the duration includes time

The SDK sets the Span operation to `app.start.cold` for _Cold start_ and `app.start.warm` for _Warm start_.

On Android 7.0 (API 24) and later, the SDK can use process start as the beginning of an app start with [Performance V2](/platforms/android/tracing/instrumentation/perf-v2/) enabled. If that timestamp is unavailable or Performance V2 is disabled, it falls back to the SDK initialization time, usually recorded by `SentryPerformanceProvider`. The measurement ends when the first frame is drawn. **Note**: Performance V2 is enabled by default in SDK 8.0 and later.
On Android 7.0 (API 24) and later, the SDK uses process start as the beginning of an app start. If that timestamp is unavailable, it falls back to the SDK initialization time, usually recorded by `SentryPerformanceProvider`. The measurement ends when the first frame is drawn.

<Alert>

Expand Down Expand Up @@ -310,7 +310,7 @@ Supported on Android OS version `7.0` and above.

</Alert>

Unresponsive UI and animation hitches annoy users and degrade the user experience. Two measurements to track these types of experiences are _slow frames_ and _frozen frames_. If you want your app to run smoothly, you should try to avoid both. The SDK adds these two measurements for the [Activity](/platforms/android/tracing/instrumentation/automatic-instrumentation/#activity-instrumentation) transactions.
Unresponsive UI and animation hitches annoy users and degrade the user experience. Two measurements to track these types of experiences are _slow frames_ and _frozen frames_. If you want your app to run smoothly, you should try to avoid both. The SDK adds these two measurements to every span.

Slow and frozen frames are Mobile Vitals, which you can learn about in the [full documentation](/product/dashboards/sentry-dashboards/mobile/mobile-vitals/).

Expand Down Expand Up @@ -341,20 +341,6 @@ SentryAndroid.init(this) { options ->
The option may contain a list of Strings (including regular expressions) which are matched against the URLs of outgoing requests. If one of the entries in the list matches the URL of an outgoing request, trace data will be attached to that request. String entries do not have to be full matches, meaning the URL of a request is matched when it contains a string provided through the option.
If `tracePropagationTargets` is not provided, trace data is attached to every outgoing request from the instrumented client.

#### AndroidX Support

Sentry uses the `androidx.core` library for detecting [slow and frozen frames](#slow-and-frozen-frames). This is necessary to produce accurate results across all Android OS versions.

We check for availability at runtime, so if you're not using `androidx.core`, you can remove it from Sentry's transitive dependencies.

```Groovy
implementation ('io.sentry:sentry-android:{{@inject packages.version('sentry.java.android', '4.2.0') }}') {
exclude group: 'androidx.core', module: 'core'
}
```

Note that by removing this transitive dependency, slow and frozen frames won't be reported.

### OkHttp Library Instrumentation

The OkHttp's instrumentation, once added the `SentryOkHttpInterceptor`, starts a span out of the active span bound to the scope for each HTTP Request. The SDK sets the span `operation` to `http.client` and `description` to request `$METHOD $url`; for example, `GET https://sentry.io`.
Expand Down Expand Up @@ -587,7 +573,7 @@ The span starts when each Activity is launched, which is defined as an applicati

The span finishes after the Activity draws its first frame.

For the first Activity in a cold start, the TTID span starts at the app-start timestamp rather than just before `Activity.onCreate()`. On Android 7.0 and later, with Performance V2 enabled, the SDK can use process start for this timestamp.
For the first Activity in a cold start, the TTID span starts at the app-start timestamp rather than just before `Activity.onCreate()`. On Android 7.0 and later, the SDK can use process start for this timestamp.

When it does, TTID includes `Application.attachBaseContext()` and `Application.onCreate()`. If the SDK falls back to its initialization timestamp, work before SDK initialization may not be included.

Expand Down
34 changes: 3 additions & 31 deletions docs/platforms/android/tracing/instrumentation/perf-v2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,41 +7,13 @@ og_image: /og-images/platforms-android-tracing-instrumentation-perf-v2.png

Performance V2 contains a set of features that enrich performance instrumentation. It tightly integrates with the [Mobile Vitals](/product/dashboards/sentry-dashboards/mobile/mobile-vitals/) dashboard module, enabling <PlatformLink to="/tracing/instrumentation/perf-v2/#app-start">App Start</PlatformLink> and <PlatformLink to="/tracing/instrumentation/perf-v2/#frames-delay">Frames Delay</PlatformLink> reporting.

Since version 8 of the SDK, Performance V2 is generally available and enabled by default. In versions `7.4.0..<8.0.0`, this feature is available as _experimental_ and you need to opt in to use it:

### Enabling Performance V2

```java {filename:MyApplication.java} {4}
import io.sentry.android.core.SentryAndroid;

SentryAndroid.init(this, options -> {
options.setEnablePerformanceV2(true);
});
```

```kotlin {filename:MyApplication.kt} {4}
import io.sentry.android.core.SentryAndroid

SentryAndroid.init(this) { options ->
options.enablePerformanceV2 = true
}
```

```xml {filename:AndroidManifest.xml} {3-5}
<manifest>
<application>
<meta-data
android:name="io.sentry.performance-v2.enable"
android:value="true" />
</application>
</manifest>
```
Performance V2 is always on. Version 9 of the SDK removes the `enablePerformanceV2` option. If you're upgrading from version 8, see the <PlatformLink to="/migration/v8-to-v9/#removed-performance-v2-option">migration guide</PlatformLink>.

### App Start

Besides enabling Performance V2, this feature requires the <PlatformLink to="/configuration/gradle/">Sentry Android Gradle Plugin</PlatformLink> (version `4.2.0` or above) to be applied to your app module.
This feature requires the <PlatformLink to="/configuration/gradle/">Sentry Android Gradle Plugin</PlatformLink> (version `4.2.0` or above) to be applied to your app module.

Once enabled, your App Start transaction will show a detailed span breakdown of various components:
Your App Start transaction shows a detailed span breakdown of various components:
* `process.load`: The process initialization time
* `contentprovider.load`: `ContentProvider.onCreate()` execution time
* `application.load`: `Application.onCreate()` execution time
Expand Down
Loading