Skip to content

Commit 3837599

Browse files
authored
Merge branch 'main' into feat/log-buffer-hard-limit
2 parents e557583 + f6f288f commit 3837599

File tree

148 files changed

+3262
-95
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+3262
-95
lines changed

.craft.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,4 @@ targets:
6464
maven:io.sentry:sentry-apollo-4:
6565
maven:io.sentry:sentry-reactor:
6666
maven:io.sentry:sentry-ktor-client:
67+
maven:io.sentry:sentry-async-profiler:

.cursor/rules/feature_flags.mdc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
alwaysApply: false
3+
description: Feature Flags
4+
---
5+
# Java SDK Feature Flags
6+
7+
There is a scope based and a span based API for tracking feature flag evaluations.
8+
9+
## Scope Based API
10+
11+
The `addFeatureFlag` method can be used to track feature flag evaluations. It exists on `Sentry` static API as well as `IScopes` and `IScope`.
12+
13+
The `maxFeatureFlags` option controls how many flags are tracked per scope and also how many are sent to Sentry as part of events.
14+
Scope based feature flags can also be disabled by setting the value to 0. Defaults to 100 feature flag evaluations.
15+
16+
Order of feature flag evaluations is important as we only keep track of the last {maxFeatureFlag} items.
17+
18+
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.
19+
20+
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.
21+
22+
## Span Based API
23+
24+
tbd

.cursor/rules/overview_dev.mdc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ Use the `fetch_rules` tool to include these rules when working on specific areas
3434
- Rate limiting, cache rotation
3535
- Android vs JVM caching differences
3636

37+
- **`feature_flags`**: Use when working with:
38+
- Feature flag tracking and evaluation
39+
- `addFeatureFlag()`, `getFeatureFlags()` methods
40+
- `FeatureFlagBuffer`, `FeatureFlag` protocol
41+
- `maxFeatureFlags` option and buffer management
42+
- Feature flag merging across scope types
43+
- Scope-based vs span-based feature flag APIs
44+
3745
### Integration & Infrastructure
3846
- **`opentelemetry`**: Use when working with:
3947
- OpenTelemetry modules (`sentry-opentelemetry-*`)
@@ -63,3 +71,4 @@ Use the `fetch_rules` tool to include these rules when working on specific areas
6371
- new module/integration/sample → `new_module`
6472
- Cache/offline/network → `offline`
6573
- System test/e2e/sample → `e2e_tests`
74+
- Feature flag/addFeatureFlag/flag evaluation → `feature_flags`

.github/workflows/agp-matrix.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060

6161
- name: Create AVD and generate snapshot for caching
6262
if: steps.avd-cache.outputs.cache-hit != 'true'
63-
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # pin@v2
63+
uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # pin@v2
6464
with:
6565
api-level: 30
6666
target: aosp_atd
@@ -79,7 +79,7 @@ jobs:
7979

8080
# We tried to use the cache action to cache gradle stuff, but it made tests slower and timeout
8181
- name: Run instrumentation tests
82-
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # pin@v2
82+
uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # pin@v2
8383
with:
8484
api-level: 30
8585
target: aosp_atd

.github/workflows/generate-javadocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
run: |
2727
./gradlew aggregateJavadocs
2828
- name: Deploy
29-
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8 # [email protected].3
29+
uses: JamesIves/github-pages-deploy-action@4a3abc783e1a24aeb44c16e869ad83caf6b4cc23 # [email protected].4
3030
with:
3131
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3232
BRANCH: gh-pages

.github/workflows/integration-tests-ui-critical.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696

9797
- name: Create AVD and generate snapshot for caching
9898
if: steps.avd-cache.outputs.cache-hit != 'true'
99-
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # pin@v2
99+
uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # pin@v2
100100
with:
101101
api-level: ${{ matrix.api-level }}
102102
target: ${{ matrix.target }}
@@ -120,7 +120,7 @@ jobs:
120120
version: ${{env.MAESTRO_VERSION}}
121121

122122
- name: Run tests
123-
uses: reactivecircus/android-emulator-runner@1dcd0090116d15e7c562f8db72807de5e036a4ed # pin@v2.34.0
123+
uses: reactivecircus/android-emulator-runner@b530d96654c385303d652368551fb075bc2f0b6b # pin@v2.35.0
124124
with:
125125
api-level: ${{ matrix.api-level }}
126126
target: ${{ matrix.target }}

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,44 @@
22

33
## Unreleased
44

5+
### Features
6+
7+
- Add feature flags API ([#4812](https://github.com/getsentry/sentry-java/pull/4812)) and ([#4831](https://github.com/getsentry/sentry-java/pull/4831))
8+
- You may now keep track of your feature flag evaluations and have them show up in Sentry.
9+
- Top level API (`Sentry.addFeatureFlag("my-feature-flag", true);`) writes to scopes and the current span (if there is one)
10+
- It is also possible to use API on `IScope`, `IScopes`, `ISpan` and `ITransaction` directly
11+
- Feature flag evaluations tracked on scope(s) will be added to any errors reported to Sentry.
12+
- The SDK keeps the latest 100 evaluations from scope(s), replacing old entries as new evaluations are added.
13+
- For feature flag evaluations tracked on spans:
14+
- Only 10 evaluations are tracked per span, existing flags are updated but new ones exceeding the limit are ignored
15+
- Spans do not inherit evaluations from their parent
16+
517
### Fixes
618

719
- Removed SentryExecutorService limit for delayed scheduled tasks ([#4846](https://github.com/getsentry/sentry-java/pull/4846))
820
- Fix visual artifacts for the Canvas strategy on some devices ([#4861](https://github.com/getsentry/sentry-java/pull/4861))
21+
- [Config] Trim whitespace on properties path ([#4880](https://github.com/getsentry/sentry-java/pull/4880))
22+
- Only set `DefaultReplayBreadcrumbConverter` if replay is available ([#4888](https://github.com/getsentry/sentry-java/pull/4888))
23+
- Session Replay: Cache connection status instead of using blocking calls ([#4891](https://github.com/getsentry/sentry-java/pull/4891))
24+
- Fix log count in client reports ([#4869](https://github.com/getsentry/sentry-java/pull/4869))
25+
- Fix profilerId propagation ([#4833](https://github.com/getsentry/sentry-java/pull/4833))
26+
- Fix profiling init for Spring and Spring Boot w Agent auto-init ([#4815](https://github.com/getsentry/sentry-java/pull/4815))
27+
- Copy active span on scope clone ([#4878](https://github.com/getsentry/sentry-java/pull/4878))
928

1029
### Improvements
1130

1231
- Fallback to distinct-id as user.id logging attribute when user is not set ([#4847](https://github.com/getsentry/sentry-java/pull/4847))
1332
- Report Timber.tag() as `timber.tag` log attribute ([#4845](https://github.com/getsentry/sentry-java/pull/4845))
1433
- Session Replay: Add screenshot strategy serialization to RRWeb events ([#4851](https://github.com/getsentry/sentry-java/pull/4851))
34+
- Report discarded log bytes ([#4871](https://github.com/getsentry/sentry-java/pull/4871))
35+
- Log why a properties file was not loaded ([#4879](https://github.com/getsentry/sentry-java/pull/4879))
1536

1637
### Dependencies
1738

1839
- Bump Native SDK from v0.11.3 to v0.12.1 ([#4859](https://github.com/getsentry/sentry-java/pull/4859))
1940
- [changelog](https://github.com/getsentry/sentry-native/blob/master/CHANGELOG.md#0121)
2041
- [diff](https://github.com/getsentry/sentry-native/compare/0.11.3...0.12.1)
42+
- Bump Spring Boot 4 to RC2 ([#4886](https://github.com/getsentry/sentry-java/pull/4886))
2143

2244
## 8.25.0
2345

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ retrofit = "2.9.0"
3131
slf4j = "1.7.30"
3232
springboot2 = "2.7.18"
3333
springboot3 = "3.5.0"
34-
springboot4 = "4.0.0-RC1"
34+
springboot4 = "4.0.0-RC2"
3535
# Android
3636
targetSdk = "34"
3737
compileSdk = "34"

sentry-android-core/src/main/java/io/sentry/android/core/AndroidContinuousProfiler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ private void start() {
190190
}
191191

192192
// If device is offline, we don't start the profiler, to avoid flooding the cache
193+
// TODO .getConnectionStatus() may be blocking, investigate if this can be done async
193194
if (scopes.getOptions().getConnectionStatusProvider().getConnectionStatus() == DISCONNECTED) {
194195
logger.log(SentryLevel.WARNING, "Device is offline. Stopping profiler.");
195196
// Let's stop and reset profiler id, as the profile is now broken anyway

sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,21 +146,24 @@ static void initializeIntegrationsAndProcessors(
146146
final @NotNull SentryAndroidOptions options,
147147
final @NotNull Context context,
148148
final @NotNull io.sentry.util.LoadClass loadClass,
149-
final @NotNull ActivityFramesTracker activityFramesTracker) {
149+
final @NotNull ActivityFramesTracker activityFramesTracker,
150+
final boolean isReplayAvailable) {
150151
initializeIntegrationsAndProcessors(
151152
options,
152153
context,
153154
new BuildInfoProvider(new AndroidLogger()),
154155
loadClass,
155-
activityFramesTracker);
156+
activityFramesTracker,
157+
isReplayAvailable);
156158
}
157159

158160
static void initializeIntegrationsAndProcessors(
159161
final @NotNull SentryAndroidOptions options,
160162
final @NotNull Context context,
161163
final @NotNull BuildInfoProvider buildInfoProvider,
162164
final @NotNull io.sentry.util.LoadClass loadClass,
163-
final @NotNull ActivityFramesTracker activityFramesTracker) {
165+
final @NotNull ActivityFramesTracker activityFramesTracker,
166+
final boolean isReplayAvailable) {
164167

165168
if (options.getCacheDirPath() != null
166169
&& options.getEnvelopeDiskCache() instanceof NoOpEnvelopeCache) {
@@ -254,8 +257,9 @@ static void initializeIntegrationsAndProcessors(
254257
options.setCompositePerformanceCollector(new DefaultCompositePerformanceCollector(options));
255258
}
256259

257-
if (options.getReplayController().getBreadcrumbConverter()
258-
instanceof NoOpReplayBreadcrumbConverter) {
260+
if (isReplayAvailable
261+
&& options.getReplayController().getBreadcrumbConverter()
262+
instanceof NoOpReplayBreadcrumbConverter) {
259263
options
260264
.getReplayController()
261265
.setBreadcrumbConverter(new DefaultReplayBreadcrumbConverter(options));

0 commit comments

Comments
 (0)