From ed58209925b6ae7d217752858d9a04163b185a62 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 27 Oct 2026 11:48:40 +0100 Subject: [PATCH 1/3] docs(java): Document Hub API removal Replace the remaining Spring and Android examples that use removed Hub APIs. Add migration mappings for the v9 Scopes APIs and lifecycle-token pattern. Co-Authored-By: Claude --- .../android/integrations/okhttp/index.mdx | 6 ++-- docs/platforms/android/migration/v8-to-v9.mdx | 19 +++++++++++- .../java/common/migration/8.x-to-9.0.mdx | 21 ++++++++++++- .../java/guides/spring/advanced-usage.mdx | 30 +++++++++---------- 4 files changed, 56 insertions(+), 20 deletions(-) diff --git a/docs/platforms/android/integrations/okhttp/index.mdx b/docs/platforms/android/integrations/okhttp/index.mdx index 003a1c2187e9d..c7335b38012c2 100644 --- a/docs/platforms/android/integrations/okhttp/index.mdx +++ b/docs/platforms/android/integrations/okhttp/index.mdx @@ -302,7 +302,7 @@ private final List failedRequestTargets = Collections.singletonList(".*" private final OkHttpClient client = new OkHttpClient.Builder() .eventListener(new SentryOkHttpEventListener()) .addInterceptor(new SentryOkHttpInterceptor( - Sentry.getCurrentHub(), + Sentry.getCurrentScopes(), null, true, codeRanges, @@ -340,7 +340,7 @@ private final List failedRequestTargets = Collections.singletonList(".*" private final OkHttpClient client = new OkHttpClient.Builder() .eventListener(new SentryOkHttpEventListener()) .addInterceptor(new SentryOkHttpInterceptor( - Sentry.getCurrentHub(), + Sentry.getCurrentScopes(), null, true, codeRanges, @@ -378,7 +378,7 @@ private final List failedRequestTargets = Collections.singletonList("mya private final OkHttpClient client = new OkHttpClient.Builder() .eventListener(new SentryOkHttpEventListener()) .addInterceptor(new SentryOkHttpInterceptor( - Sentry.getCurrentHub(), + Sentry.getCurrentScopes(), null, true, codeRanges, diff --git a/docs/platforms/android/migration/v8-to-v9.mdx b/docs/platforms/android/migration/v8-to-v9.mdx index e1432a2345878..d5a461d741fd3 100644 --- a/docs/platforms/android/migration/v8-to-v9.mdx +++ b/docs/platforms/android/migration/v8-to-v9.mdx @@ -4,7 +4,24 @@ description: "Learn how to migrate from Sentry Android SDK 8.x to 9.0.0." sidebar_order: 8890 --- -Version 9 removes the global Logs and Metrics enable options. Manual telemetry APIs now work whenever the SDK is enabled, while automatic Timber and Logcat capture require their own explicit opt-in. +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. + +## Removed Hub APIs + +The Hub compatibility layer was deprecated in version 8 and is removed in version 9. Replace any remaining Hub references before upgrading: + +| Removed API | Replacement | +| -------------------------------------------- | ----------------------------------------------------------------------------- | +| `IHub` | `IScopes` | +| `HubAdapter.getInstance()` | `ScopesAdapter.getInstance()` | +| `HubScopesWrapper` | Use the wrapped `IScopes` instance directly | +| `NoOpHub.getInstance()` | `NoOpScopes.getInstance()` | +| `Sentry.getCurrentHub()` | `Sentry.getCurrentScopes()` | +| `Sentry.setCurrentHub(...)` | `Sentry.setCurrentScopes(...)` | +| `IHub.clone()` and `IScopes.clone()` | `forkedScopes(...)` or `forkedCurrentScope(...)` | +| `Sentry.popScope()` and `IScopes.popScope()` | Close the lifecycle token returned by `pushScope()` or `pushIsolationScope()` | + +Use try-with-resources or a `finally` block to close lifecycle tokens. This restores the previous scopes without relying on a separate `popScope()` call. ## Manual Logs and Metrics diff --git a/docs/platforms/java/common/migration/8.x-to-9.0.mdx b/docs/platforms/java/common/migration/8.x-to-9.0.mdx index 436907aec025b..f735f25d5b35c 100644 --- a/docs/platforms/java/common/migration/8.x-to-9.0.mdx +++ b/docs/platforms/java/common/migration/8.x-to-9.0.mdx @@ -4,7 +4,26 @@ description: "Learn how to migrate from version 8.x to 9.0 of the Sentry Java SD sidebar_order: 994 --- -Version 9 removes the global Logs and Metrics enable options. Manual telemetry APIs now work whenever the SDK is enabled, while automatic logging integrations require their own explicit opt-in. +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. + +## Removed Hub APIs + +The Hub compatibility layer was deprecated in version 8 and is removed in version 9. Replace any remaining Hub references before upgrading: + +| Removed API | Replacement | +| -------------------------------------------- | ----------------------------------------------------------------------------- | +| `IHub` | `IScopes` | +| `HubAdapter.getInstance()` | `ScopesAdapter.getInstance()` | +| `HubScopesWrapper` | Use the wrapped `IScopes` instance directly | +| `NoOpHub.getInstance()` | `NoOpScopes.getInstance()` | +| `Sentry.getCurrentHub()` | `Sentry.getCurrentScopes()` | +| `Sentry.setCurrentHub(...)` | `Sentry.setCurrentScopes(...)` | +| `IHub.clone()` and `IScopes.clone()` | `forkedScopes(...)` or `forkedCurrentScope(...)` | +| `Sentry.popScope()` and `IScopes.popScope()` | Close the lifecycle token returned by `pushScope()` or `pushIsolationScope()` | +| Spring WebFlux `SENTRY_HUB_KEY` | `SENTRY_SCOPES_KEY` | +| GraphQL `ExceptionDetails.getHub()` | `ExceptionDetails.getScopes()` | + +Use try-with-resources or a `finally` block to close lifecycle tokens. This restores the previous scopes without relying on a separate `popScope()` call. ## Manual Logs and Metrics diff --git a/docs/platforms/java/guides/spring/advanced-usage.mdx b/docs/platforms/java/guides/spring/advanced-usage.mdx index 9b0117afbae0f..15b6d5a068a43 100644 --- a/docs/platforms/java/guides/spring/advanced-usage.mdx +++ b/docs/platforms/java/guides/spring/advanced-usage.mdx @@ -22,7 +22,7 @@ Configuring this field activates the