zhangxinyu1 opened a new pull request #6770: [FLINK-10002] [Webfrontend] WebUI shows jm/tm logs more friendly. URL: https://github.com/apache/flink/pull/6770 ## What is the purpose of the change This commit makes WebUI show jm/tm logs more friendly. WebUI can show historical logs by inputing a filename and a offset range to read of the file, shown as follows.     This pr adds 8 new REST APIs: - For JobManager `/jobmanager/log/:range` Return logs of current log file in the range. `/jobmanager/logs/:filename/:range` Return logs of historical log file in the range. `/jobmanager/loglist` Return the list of historical log filename. `/jobmanager/stdout/:range` Return the stdout data in the range - For TaskManager `/taskmanagers/:taskmanagerid/log/:range` Return logs of current log file in the range. `/taskmanagers/:taskmanagerid/logs/:filename/:range` Return logs of historical log file in the range. `/taskmanagers/:taskmanagerid/loglist` Return the list of historical log filename. `/taskmanagers/:taskmanagerid/stdout/:range` Return the stdout data in the range ## Brief change log This pr mainly add 8 APIs in both legacy (WebRuntimeMonitor) and new (WebMonitorEndpoint) REST API. Besides, some related frontend codes are changed. - For legacy REST API: 1. In `WebRuntimeMonitor.java`, paths `/jobmanager/log/:range`, `/jobmanager/stdout/:range` and `/jobmanager/logs/:filename/:range` are handled by `StaticFileServerHandler`. Therefore, `StaticFileServerHandler.java` is also changed to handle these three paths. 2. `JobManagerLogListHandler` and `TaskManagerLogListHandler` are added to deal with the path `/jobmanager/loglist` and `/taskmanagers/:taskmanagerid/loglist` to get the historical log file names. Besides, a new method `requestTaskManagerLogList()` is added to `TaskManagerGateway` to send a new TaskManagerMessage `LogListRequest` to request taskmanager’s log file list. TaskManager deal with this request by a new method `handleRequestTaskManagerLogList()`. 3. There are three paths `/taskmanagers/:taskmanagerid/log/:range`, `/taskmanagers/:taskmanagerid/logs/:filename/:range` and `/taskmanagers/:taskmanagerid/stdout/:range` added to `TaskManagerLogHandler.java`. At the same time, `TaskManagerGateway`, `ActorTaskManagerGateWay`, `TaskManagerMessages` and `TaskManager` are changed to handle these three paths. 4. `FileOffsetRange.java` is designed to identify a range of log files, which includes a start offset and an end offset. - For new REST API: 1. In LogFileHandlerSpecification, paths `/jobmanager/log/:range` and `/jobmanager/logs/:filename/:range` are added. In `StdoutFileHandlerSpecification,` `/jobmanager/stdout/:range` is added. These three paths are also handled by `StaticFileServerHandler` which is same with the legacy REST API. 2. `LogListHandler` and `TaskManagerLogListHandler` are added to deal with the path `/jobmanager/loglist` and `/taskmanagers/:taskmanagerid/loglist`. This `TaskManagerLogListHandler` is different from the `TaskManagerLogListHandler` in legacy REST API. To get the historical log list, a new method `requestTaskManagerLogList()` is added to `ResourceManagerGateway`. Its related classes and interfaces, such as `ResourceManager`, `TaskExecutorGateway` and `TaskExecutor`, are also changed. 3. To deal with `/taskmanagers/:taskmanagerid/log/:range`, `/taskmanagers/:taskmanagerid/logs/:filename/:range` and `/taskmanagers/:taskmanagerid/stdout/:range`, `AbstractTaskManagerFileHandler` is changed. The mainly difference is that filename and range are also a part of cache key. When loading task manager file, filename and range are also parameters. ## Verifying this change This change added tests and can be verified as follows: - Added integration tests for all new paths in `WebFrontendITCase.java` ## Does this pull request potentially affect one of the following parts: - Dependencies (does it add or upgrade a dependency): no - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no - The serializers: no - The runtime per-record code paths (performance sensitive): no - Anything that affects deployment or recovery: no - The S3 file system connector: no ## Documentation - Does this pull request introduce a new feature? yes - If yes, how is the feature documented? JavaDocs
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
