Skip to content
Open
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
24 changes: 24 additions & 0 deletions .cursor/rules/feature_flags.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
alwaysApply: false
description: Feature Flags
---
# Java SDK Feature Flags

There is a scope based and a span based API for tracking feature flag evaluations.

## Scope Based API

The `addFeatureFlag` method can be used to track feature flag evaluations. It exists on `Sentry` static API as well as `IScopes` and `IScope`.

The `maxFeatureFlags` option controls how many flags are tracked per scope and also how many are sent to Sentry as part of events.
Scope based feature flags can also be disabled by setting the value to 0. Defaults to 100 feature flag evaluations.

Order of feature flag evaluations is important as we only keep track of the last {maxFeatureFlag} items.

When a feature flag evluation with the same name is added, the previous one is removed and the new one is stored so that it'll be dropped last.

When sending out an error event, feature flag buffers from all three scope types (global, isolation and current scope) are merged, chosing the newest {maxFeatureFlag} entries across all scope types. Feature flags are sent as part of the `flags` context.

## Span Based API

tbd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remember to update it

9 changes: 9 additions & 0 deletions .cursor/rules/overview_dev.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ Use the `fetch_rules` tool to include these rules when working on specific areas
- Rate limiting, cache rotation
- Android vs JVM caching differences

- **`feature_flags`**: Use when working with:
- Feature flag tracking and evaluation
- `addFeatureFlag()`, `getFeatureFlags()` methods
- `FeatureFlagBuffer`, `FeatureFlag` protocol
- `maxFeatureFlags` option and buffer management
- Feature flag merging across scope types
- Scope-based vs span-based feature flag APIs

### Integration & Infrastructure
- **`opentelemetry`**: Use when working with:
- OpenTelemetry modules (`sentry-opentelemetry-*`)
Expand Down Expand Up @@ -63,3 +71,4 @@ Use the `fetch_rules` tool to include these rules when working on specific areas
- new module/integration/sample → `new_module`
- Cache/offline/network → `offline`
- System test/e2e/sample → `e2e_tests`
- Feature flag/addFeatureFlag/flag evaluation → `feature_flags`
Loading