Turn SentryOptions into a customer-facing interface

Ouverte
#6,405 1 commentaire 0 réactions 1 personne assignée Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@runningcode y travaille déjà.

Depuis le 28/10/2026.

Évaluation

Cette issue n'a pas encore été évaluée.

Description

Android Platform: Android

Problem

SentryOptions is a ~4,300-line concrete class with ~340 public methods that mixes two concerns:

  • Customer configuration: DSN, sample rates, beforeSend* callbacks, enable* flags, and sub-options (Logs, Metrics, Cron, Proxy, …).
  • SDK runtime state and internal collaborators: executor service, serializer, envelope reader, transport factory, envelope disk cache, transaction/continuous profilers, modules and debug-meta loaders, thread checker, composite performance collector, connection status provider, replay controller, date provider, monotonic ticker, and so on. ~53 members already carry @ApiStatus.Internal, which tells us they don't belong on the public type.

Consequences:

  • Customers see, and can set, SDK internals. Binary compatibility makes every internal getter/setter effectively public API, so it's hard to change them.
  • SentryAndroidOptions and the three Spring Boot SentryProperties classes extend the concrete class, so they inherit all of the internal state too. Spring Boot binds properties straight onto that object (see getsentry/sentry-java#6369).
  • The SDK mutates the same object the customer configured (defaults filled in, collaborators swapped in during init). It's hard to tell what is configuration and what is state, or when options are "done".

Idea

Make what customers configure an interface that contains only the customer-facing configuration. Move the SDK internals into a separate internal object that init builds from the configured options (holding the executor, serializer, transport, caches, profilers, etc.).

Sentry.init(options -> { ... }) keeps its shape for customers; only the type behind options changes.

Open questions

  • Interface, builder, or a concrete class with the internals removed? Which gives the easiest migration and works with Java 8?
  • How do Android and Spring Boot options compose: interface inheritance or composition?
  • Can options become read-only after init? What about settings that are meant to change at runtime (e.g., getsentry/sentry-java#5486)?
  • Which internals do customers legitimately set today (e.g., setTransportFactory in tests, setLogger, setSerializer), and which need a supported public hook?
  • Migration path: what can we deprecate in 8.x first, and how are the hybrid SDKs (React Native, Flutter, Unity, KMP) that call into SentryOptions/SentryAndroidOptions affected?
Langage dominant
Kotlin
Étoiles
1.4k
Forks
483
Merge moyen
2 j 54 min
PR mergées (30 j)
207

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de getsentry/sentry-java

Toutes les issues de getsentry/sentry-java

Issues similaires

Plus d'issues Kotlin

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.