AI SummaryNew features must be opt-in by default. Options control whether a feature is enabled and how it behaves. Newer features use namespaced option classes nested inside , e.g.: Each namespaced options class is a inside with its own fields, getters/setters, and callbacks (e.g. , ).
Install
Copy this and paste it into Claude Code, Cursor, or any AI assistant:
I want to add the "sentry-java — Cursor Rules" prompt rules to my project. Repository: https://github.com/getsentry/sentry-java Please read the repo to find the rules/prompt file, then: 1. Download it to the correct location (.cursorrules, .windsurfrules, .github/prompts/, or project root — based on the file type) 2. If there's an existing rules file, merge the new rules in rather than overwriting 3. Confirm what was added
Description
Adding and modifying SDK options
Adding Options to the SDK
New features must be opt-in by default. Options control whether a feature is enabled and how it behaves.
Namespaced Options
Newer features use namespaced option classes nested inside SentryOptions, e.g.: • SentryOptions.getLogs() → SentryOptions.Logs • SentryOptions.getMetrics() → SentryOptions.Metrics Each namespaced options class is a public static final class inside SentryOptions with its own fields, getters/setters, and callbacks (e.g. BeforeSendLogCallback, BeforeSendMetricCallback). A typical namespaced options class contains: • enabled boolean (default false for opt-in) • sampleRate double (if the feature supports sampling) • beforeSend callback interface (nested inside the options class) To add a new namespaced options class: • Create the public static final class inside SentryOptions with fields, getters/setters, and any callback interfaces • Add a private field on SentryOptions initialized with new SentryOptions.MyFeature() • Add getter/setter on SentryOptions annotated with @ApiStatus.Experimental
Direct (Non-Namespaced) Options
Options that apply globally across the SDK (e.g. dsn, environment, release, sampleRate, maxBreadcrumbs) live as direct fields on SentryOptions with getter/setter pairs. Use this pattern for options that aren't tied to a specific feature namespace.
Configuration Layers
Options can be set through multiple layers. When adding a new option, consider which layers apply:
Discussion
Health Signals
My Fox Den
Community Rating
Sign in to rate this booster
Works With
Any AI assistant that accepts custom rules or system prompts