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

[PLAT-8190] Add Config.MaxReportedThreads #144

Merged
merged 1 commit into from
Apr 7, 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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Changelog

## TBD

* Adds the `MaxReportedThreads` configuration property (Android only.)
[#144](https://github.com/bugsnag/bugsnag-unreal/pull/144)
* Updates the bugsnag-android dependency from v5.19.2 to [v5.22.0](https://github.com/bugsnag/bugsnag-android/blob/master/CHANGELOG.md#5220-2022-03-31)
* Updates the bugsnag-cocoa dependency from v6.16.1 to [v6.16.6](https://github.com/bugsnag/bugsnag-cocoa/blob/master/CHANGELOG.md#6166-2022-04-06)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ jobject FAndroidPlatformConfiguration::Parse(JNIEnv* Env,
jniCallWithObjects(Env, jConfig, Cache->ConfigSetMaxBreadcrumbs, Config->GetMaxBreadcrumbs());
jniCallWithObjects(Env, jConfig, Cache->ConfigSetMaxPersistedEvents, Config->GetMaxPersistedEvents());
jniCallWithObjects(Env, jConfig, Cache->ConfigSetMaxPersistedSessions, Config->GetMaxPersistedSessions());
jniCallWithObjects(Env, jConfig, Cache->ConfigSetMaxReportedThreads, Config->GetMaxReportedThreads());
jniCallWithBool(Env, jConfig, Cache->ConfigSetPersistUser, Config->GetPersistUser());
if (Config->GetRedactedKeys().Num())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ bool FAndroidPlatformJNI::LoadReferenceCache(JNIEnv* env, JNIReferenceCache* cac
CacheInstanceJavaMethod(env, cache->ConfigSetMaxBreadcrumbs, cache->ConfigClass, "setMaxBreadcrumbs", "(I)V");
CacheInstanceJavaMethod(env, cache->ConfigSetMaxPersistedEvents, cache->ConfigClass, "setMaxPersistedEvents", "(I)V");
CacheInstanceJavaMethod(env, cache->ConfigSetMaxPersistedSessions, cache->ConfigClass, "setMaxPersistedSessions", "(I)V");
CacheInstanceJavaMethod(env, cache->ConfigSetMaxReportedThreads, cache->ConfigClass, "setMaxReportedThreads", "(I)V");
CacheInstanceJavaMethod(env, cache->ConfigSetPersistenceDirectory, cache->ConfigClass, "setPersistenceDirectory", "(Ljava/io/File;)V");
CacheInstanceJavaMethod(env, cache->ConfigSetPersistUser, cache->ConfigClass, "setPersistUser", "(Z)V");
CacheInstanceJavaMethod(env, cache->ConfigSetProjectPackages, cache->ConfigClass, "setProjectPackages", "(Ljava/util/Set;)V");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ typedef struct
jmethodID ConfigSetMaxBreadcrumbs;
jmethodID ConfigSetMaxPersistedEvents;
jmethodID ConfigSetMaxPersistedSessions;
jmethodID ConfigSetMaxReportedThreads;
jmethodID ConfigSetPersistenceDirectory;
jmethodID ConfigSetPersistUser;
jmethodID ConfigSetProjectPackages;
Expand Down
15 changes: 15 additions & 0 deletions Plugins/Bugsnag/Source/Bugsnag/Public/BugsnagConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,20 @@ class BUGSNAG_API FBugsnagConfiguration final : public IBugsnagFeatureFlagStore,
*/
void SetMaxPersistedSessions(uint32 Value) { MaxPersistedSessions = Value; };

/**
* The maximum number of Android JVM threads that will be reported with an event.
*
* Once the threshold is reached, all remaining threads will be omitted.
*
* By default, up to 200 threads are reported.
*/
uint32 GetMaxReportedThreads() const { return MaxReportedThreads; }

/**
* @param Value The maximum number of threads.
*/
void SetMaxReportedThreads(uint32 Value) { MaxReportedThreads = Value; }

/**
* Whether User information should be persisted to disk between application runs.
*
Expand Down Expand Up @@ -557,6 +571,7 @@ class BUGSNAG_API FBugsnagConfiguration final : public IBugsnagFeatureFlagStore,
uint32 MaxBreadcrumbs = 50;
uint32 MaxPersistedEvents = 32;
uint32 MaxPersistedSessions = 128;
uint32 MaxReportedThreads = 200;
bool bPersistUser = true;
FBugsnagUser User;
TOptional<FString> ReleaseStage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class NotifyScenario : public Scenario
return true;
});

Configuration->SetMaxReportedThreads(3);

// sent in event payload
Configuration->SetProjectPackages({TEXT("com.example.package")});
}
Expand Down
1 change: 1 addition & 0 deletions features/handled_errors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Feature: Reporting handled errors
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Unreal Bugsnag Notifier" notifier
And the error payload field "events.0.threads" is a non-empty array
And on Android, the error payload field "events.0.threads" is an array with 4 elements
And the error payload field "notifier.dependencies.0.name" is not null
And the error payload field "notifier.dependencies.0.url" is not null
And the error payload field "notifier.dependencies.0.version" is not null
Expand Down