Search before asking
Description
Flink Agents currently relies on the default thread names for both Java and Python asynchronous execution:
- The JDK 21 Java implementation creates its executor with
Executors.newFixedThreadPool(numAsyncThreads), so worker threads have generic names such as pool-N-thread-M.
- The Python implementation creates a
ThreadPoolExecutor without thread_name_prefix, so worker threads have generic names such as ThreadPoolExecutor-N_M.
These names make it difficult to identify Flink Agents async workers in TaskManager thread dumps, profiler output, and monitoring tools. A TaskManager process may contain many unrelated executor pools, and the current names do not indicate whether a thread belongs to the Flink Agents Java async executor, the Python async executor, or another component. Idle workers are especially difficult to attribute because their stacks contain only generic ThreadPoolExecutor frames.
Both executors should use descriptive, collision-resistant thread names. The naming convention should:
- clearly identify the thread as a Flink Agents async worker;
- distinguish Java and Python executor threads;
- distinguish different executor instances and workers within the same process; and
- remain useful in thread dumps and profiler output without changing execution behavior.
For example, names could follow conventions similar to:
- Java:
flink-agents-java-async-<pool-id>-thread-<worker-id>
- Python:
flink-agents-python-async-<pool-id>_<worker-id>
The exact convention can be decided during implementation. Java can provide a custom ThreadFactory when constructing the fixed thread pool, while Python can provide a unique thread_name_prefix to ThreadPoolExecutor.
Tests should verify that tasks submitted to each executor run on threads with the expected descriptive prefix and that names remain distinct across multiple executor instances.
Are you willing to submit a PR?
Search before asking
Description
Flink Agents currently relies on the default thread names for both Java and Python asynchronous execution:
Executors.newFixedThreadPool(numAsyncThreads), so worker threads have generic names such aspool-N-thread-M.ThreadPoolExecutorwithoutthread_name_prefix, so worker threads have generic names such asThreadPoolExecutor-N_M.These names make it difficult to identify Flink Agents async workers in TaskManager thread dumps, profiler output, and monitoring tools. A TaskManager process may contain many unrelated executor pools, and the current names do not indicate whether a thread belongs to the Flink Agents Java async executor, the Python async executor, or another component. Idle workers are especially difficult to attribute because their stacks contain only generic
ThreadPoolExecutorframes.Both executors should use descriptive, collision-resistant thread names. The naming convention should:
For example, names could follow conventions similar to:
flink-agents-java-async-<pool-id>-thread-<worker-id>flink-agents-python-async-<pool-id>_<worker-id>The exact convention can be decided during implementation. Java can provide a custom
ThreadFactorywhen constructing the fixed thread pool, while Python can provide a uniquethread_name_prefixtoThreadPoolExecutor.Tests should verify that tasks submitted to each executor run on threads with the expected descriptive prefix and that names remain distinct across multiple executor instances.
Are you willing to submit a PR?