Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support setting maxCacheItems #2102

Merged
merged 4 commits into from
Mar 4, 2022
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- feat: Support enableNativeCrashHandling for iOS #2101
- Bump: Sentry Cocoa 7.10.0 #2100
- feat: Support setting maxCacheItems #2102

## 3.2.14-beta.2

Expand Down
3 changes: 3 additions & 0 deletions android/src/main/java/io/sentry/react/RNSentryModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ public void initNativeSdk(final ReadableMap rnOptions, Promise promise) {
if (rnOptions.hasKey("maxBreadcrumbs")) {
options.setMaxBreadcrumbs(rnOptions.getInt("maxBreadcrumbs"));
}
if (rnOptions.hasKey("maxCacheItems")) {
options.setMaxCacheItems(rnOptions.getInt("maxCacheItems"));
}
if (rnOptions.hasKey("environment") && rnOptions.getString("environment") != null) {
options.setEnvironment(rnOptions.getString("environment"));
}
Expand Down
1 change: 1 addition & 0 deletions sample/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Sentry.init({
console.log('onReady called with didCallNativeInit:', didCallNativeInit);
},
maxBreadcrumbs: 150, // Extend from the default 100 breadcrumbs.
maxCacheItems: 40, // Extend from the default 30.
integrations: [
new Sentry.ReactNativeTracing({
idleTimeout: 5000, // This is the default timeout
Expand Down
7 changes: 7 additions & 0 deletions src/js/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ export interface ReactNativeOptions extends BrowserOptions {
* @default true
*/
patchGlobalPromise?: boolean;

/**
* The max cache items for capping the number of envelopes.
*
* @default 30
*/
maxCacheItems?: number;
}

export interface ReactNativeWrapperOptions {
Expand Down