feature(flink-query): 新增 Flink 相关查询接口

This commit is contained in:
2023-05-05 00:13:13 +08:00
parent 88c1714238
commit 22dd6df3f3
19 changed files with 1753 additions and 6 deletions

View File

@@ -0,0 +1,36 @@
package com.lanyuanxiaoyao.service.flink;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import cn.hutool.http.HttpUtil;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.eclipsecollections.EclipseCollectionsModule;
import com.lanyuanxiaoyao.service.configuration.entity.flink.FlinkTaskManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 测试 Flink 解析
*
* @author lanyuanxiaoyao
* @date 2023-05-04
*/
public class TestJsonParse {
private static final Logger logger = LoggerFactory.getLogger(TestJsonParse.class);
public static void main(String[] args) throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new EclipseCollectionsModule());
mapper.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.setDefaultPropertyInclusion(JsonInclude.Include.NON_EMPTY);
String url = "b5s120.hdp.dc:8088/proxy/application_1672368973318_1814";
String body = HttpUtil.get(StrUtil.format("http://{}/v1/taskmanagers/container_1672368973318_1814_01_000002", url));
logger.info("{}", mapper.writeValueAsString(mapper.readValue(body, FlinkTaskManager.class)));
}
}

View File

@@ -0,0 +1,99 @@
### Config
# {
# "refresh-interval": 3000,
# "timezone-name": "China Time",
# "timezone-offset": 28800000,
# "flink-version": "1.13.3",
# "flink-revision": "a4700e3 @ 2021-10-11T23:52:36+02:00",
# "features": {
# "web-submit": false
# }
# }
GET http://{{url}}/v1/config
### Jobmnager config
# [{key: xxx, value: xxx}]
GET http://{{url}}/v1/jobmanager/config
### jobs
# {
# "jobs": [
# {
# "id": "320c6e7438afebea43fa0f0160319717",
# "status": "RUNNING"
# }
# ]
# }
GET http://{{url}}/v1/jobs
### jobs overview
# {
# "jobs": [
# {
# "jid": "320c6e7438afebea43fa0f0160319717",
# "name": "conf_center (ID: 1542097983881048064)",
# "state": "RUNNING",
# "start-time": 1680699756563,
# "end-time": -1,
# "duration": 2503052502,
# "last-modification": 1680699770420,
# "tasks": {
# "total": 8,
# "created": 0,
# "scheduled": 0,
# "deploying": 0,
# "running": 8,
# "finished": 0,
# "canceling": 0,
# "canceled": 0,
# "failed": 0,
# "reconciling": 0,
# "initializing": 0
# }
# }
# ]
# }
GET http://{{url}}/v1/jobs/overview
###
GET http://{{url}}/v1/jobs/320c6e7438afebea43fa0f0160319717
###
GET http://{{url}}/v1/jobs/320c6e7438afebea43fa0f0160319717/config
###
GET http://{{url}}/v1/jobs/320c6e7438afebea43fa0f0160319717/checkpoints
###
GET http://{{url}}/v1/jobs/320c6e7438afebea43fa0f0160319717/checkpoints/config
###
GET http://{{url}}/v1/jobs/320c6e7438afebea43fa0f0160319717/checkpoints/details/2722
###
GET http://{{url}}/v1/jobs/320c6e7438afebea43fa0f0160319717/exceptions
###
GET http://{{url}}/v1/jobs/320c6e7438afebea43fa0f0160319717/plan
###
GET http://{{url}}/v1/jobs/320c6e7438afebea43fa0f0160319717/vertices/1171dea6747ab509fdaefbe74f7195af
###
GET http://{{url}}/v1/jobs/320c6e7438afebea43fa0f0160319717/vertices/1171dea6747ab509fdaefbe74f7195af/backpressure
###
GET http://{{url}}/v1/jobs/320c6e7438afebea43fa0f0160319717/vertices/1171dea6747ab509fdaefbe74f7195af/taskmanagers
###
GET http://{{url}}/v1/overview
###
GET http://{{url}}/v1/taskmanagers
###
GET http://{{url}}/v1/taskmanagers/container_1672368973318_1814_01_000002
###
GET http://{{url}}/v1/taskmanagers/container_1672368973318_1814_01_000002/logs

View File

@@ -0,0 +1,5 @@
{
"production": {
"url": "b5s120.hdp.dc:8088/proxy/application_1672368973318_1814"
}
}