-
Notifications
You must be signed in to change notification settings - Fork 50
feat!: 1633 use descriptive thread names #1704
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
base: main
Are you sure you want to change the base?
feat!: 1633 use descriptive thread names #1704
Conversation
Signed-off-by: jarebudev <[email protected]>
Signed-off-by: jarebudev <[email protected]>
Signed-off-by: jarebudev <[email protected]>
Signed-off-by: jarebudev <[email protected]>
Summary of ChangesHello @jarebudev, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the debugging experience by implementing a mechanism to assign meaningful, descriptive names to the various threads utilized throughout the SDK. By centralizing thread creation through a configurable factory, developers can more easily identify and monitor specific background processes, which is crucial for diagnosing concurrency issues and understanding application behavior. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces descriptive thread names for better debuggability, which is a great improvement. The new ConfigurableThreadFactory is a clean and reusable component that simplifies thread creation logic across the codebase. The changes are well-implemented and include corresponding unit tests. I have one suggestion to improve the robustness of the new thread factory.
| public ConfigurableThreadFactory(String namePrefix, boolean daemon) { | ||
| this.namePrefix = namePrefix; | ||
| this.daemon = daemon; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For improved robustness, it's a good practice to validate constructor parameters. The namePrefix should not be null or empty to prevent creating threads with malformed names (e.g., -1). Adding a check will make this utility class safer to use in the future.
You could also add a corresponding test case to verify this behavior:
@Test
void shouldThrowOnNullOrEmptyPrefix() {
assertThatThrownBy(() -> new ConfigurableThreadFactory(null))
.isInstanceOf(IllegalArgumentException.class);
assertThatThrownBy(() -> new ConfigurableThreadFactory(""))
.isInstanceOf(IllegalArgumentException.class);
} public ConfigurableThreadFactory(String namePrefix, boolean daemon) {
if (namePrefix == null || namePrefix.isEmpty()) {
throw new IllegalArgumentException("Thread name prefix cannot be null or empty.");
}
this.namePrefix = namePrefix;
this.daemon = daemon;
}
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1704 +/- ##
============================================
+ Coverage 91.93% 93.26% +1.32%
- Complexity 517 522 +5
============================================
Files 51 52 +1
Lines 1265 1276 +11
Branches 112 112
============================================
+ Hits 1163 1190 +27
+ Misses 64 50 -14
+ Partials 38 36 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice



This PR
Enables threads (daemon and non-daemon) to be named as required to aid debugging.
Related Issues
Resolves #1633
Notes
Follow-up Tasks
How to test