Skip to content
Prompt

sentry-java — Cursor Rules

by getsentry

AI Summary

New 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

0/2000
Loading comments...

Health Signals

MaintenanceCommitted Today
Active
Adoption1K+ stars on GitHub
1.3k ★ · Popular
DocsMissing or thin
Undocumented

GitHub Signals

Stars1.3k
Forks471
Issues273
UpdatedToday
View on GitHub
MIT License

My Fox Den

Community Rating

Sign in to rate this booster

Works With

Any AI assistant that accepts custom rules or system prompts

Claude
ChatGPT
Cursor
Windsurf
Copilot
+ more