feat(cloud): 增加prometheus动态获取实例端口
This commit is contained in:
140
.idea/httpRequests/http-requests-log.http
generated
140
.idea/httpRequests/http-requests-log.http
generated
@@ -1,3 +1,73 @@
|
||||
GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@132.126.207.130:35690/hudi_services/service_cloud_query/cloud/targets
|
||||
Connection: Keep-Alive
|
||||
User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)
|
||||
Cookie: JSESSIONID=82403D318FAEAAA09F215DA39DCB41FE
|
||||
Accept-Encoding: br,deflate,gzip,x-gzip
|
||||
|
||||
<> 2024-01-31T105823.200.json
|
||||
|
||||
###
|
||||
|
||||
GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@132.126.207.130:35690/hudi_services/service_cloud_query/cloud/targets
|
||||
Connection: Keep-Alive
|
||||
User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)
|
||||
Cookie: JSESSIONID=82403D318FAEAAA09F215DA39DCB41FE
|
||||
Accept-Encoding: br,deflate,gzip,x-gzip
|
||||
|
||||
<> 2024-01-31T105819.404.json
|
||||
|
||||
###
|
||||
|
||||
GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@132.126.207.130:35690/hudi_services/service_cloud_query/cloud/targets
|
||||
Connection: Keep-Alive
|
||||
User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)
|
||||
Cookie: JSESSIONID=3809A2F1A78D12F02D47F709504B0FDC
|
||||
Accept-Encoding: br,deflate,gzip,x-gzip
|
||||
|
||||
<> 2024-01-31T105750.404.json
|
||||
|
||||
###
|
||||
|
||||
GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@132.126.207.130:35690/hudi_services/service_cloud_query/cloud/targets
|
||||
Connection: Keep-Alive
|
||||
User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)
|
||||
Cookie: JSESSIONID=3809A2F1A78D12F02D47F709504B0FDC
|
||||
Accept-Encoding: br,deflate,gzip,x-gzip
|
||||
|
||||
<> 2024-01-31T105744.404.json
|
||||
|
||||
###
|
||||
|
||||
GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@132.126.207.130:35690/hudi_services/service_cloud_query/cloud/services?service_name=service-gateway
|
||||
Connection: Keep-Alive
|
||||
User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)
|
||||
Cookie: JSESSIONID=D3453177E948A070A4BCC930DCDDE188
|
||||
Accept-Encoding: br,deflate,gzip,x-gzip
|
||||
|
||||
<> 2024-01-31T104803.200.json
|
||||
|
||||
###
|
||||
|
||||
GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@132.126.207.130:35690/hudi_services/service_cloud_query/cloud/services?service_name=center-gateway-new
|
||||
Connection: Keep-Alive
|
||||
User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)
|
||||
Cookie: JSESSIONID=A489280C82FB7E8BA81909F8812DA0FB
|
||||
Accept-Encoding: br,deflate,gzip,x-gzip
|
||||
|
||||
<> 2024-01-31T104754.200.json
|
||||
|
||||
###
|
||||
|
||||
GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@132.126.207.130:35690/hudi_services/service_web/cloud/list
|
||||
Connection: Keep-Alive
|
||||
User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)
|
||||
Cookie: JSESSIONID=1B7C9D76DE2F888A0F0AB4EAF3CFFC19
|
||||
Accept-Encoding: br,deflate,gzip,x-gzip
|
||||
|
||||
<> 2024-01-31T104721.200.json
|
||||
|
||||
###
|
||||
|
||||
GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@b12s25.hdp.dc:36781/queue/clear/compaction-queue-pre
|
||||
Connection: Keep-Alive
|
||||
User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)
|
||||
@@ -392,73 +462,3 @@ Accept-Encoding: br,deflate,gzip,x-gzip
|
||||
|
||||
###
|
||||
|
||||
GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@132.126.207.130:35690/hudi_services/service_scheduler/schedule/schedule_times
|
||||
Connection: Keep-Alive
|
||||
User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)
|
||||
Cookie: JSESSIONID=0C3AEB91AD103B11FD674356CB0FCC2B
|
||||
Accept-Encoding: br,deflate,gzip,x-gzip
|
||||
|
||||
<> 2024-01-15T144539.200.json
|
||||
|
||||
###
|
||||
|
||||
GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@132.126.207.130:35690/hudi_services/service_scheduler/schedule/schedule_times
|
||||
Connection: Keep-Alive
|
||||
User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)
|
||||
Cookie: JSESSIONID=0C3AEB91AD103B11FD674356CB0FCC2B
|
||||
Accept-Encoding: br,deflate,gzip,x-gzip
|
||||
|
||||
<> 2024-01-15T144500.200.json
|
||||
|
||||
###
|
||||
|
||||
GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@132.126.207.130:35690/hudi_services/service_scheduler/schedule/schedule_times
|
||||
Connection: Keep-Alive
|
||||
User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)
|
||||
Cookie: JSESSIONID=E854FA8E5E26010DB1870C60EF6643D1
|
||||
Accept-Encoding: br,deflate,gzip,x-gzip
|
||||
|
||||
<> 2024-01-15T144458.200.json
|
||||
|
||||
###
|
||||
|
||||
GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@132.126.207.130:35690/hudi_services/service_scheduler/schedule/schedule_times
|
||||
Connection: Keep-Alive
|
||||
User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)
|
||||
Cookie: JSESSIONID=E854FA8E5E26010DB1870C60EF6643D1
|
||||
Accept-Encoding: br,deflate,gzip,x-gzip
|
||||
|
||||
<> 2024-01-15T143420.200.json
|
||||
|
||||
###
|
||||
|
||||
GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@132.126.207.130:35690/hudi_services/service_scheduler/schedule/schedule_times
|
||||
Connection: Keep-Alive
|
||||
User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)
|
||||
Cookie: JSESSIONID=E854FA8E5E26010DB1870C60EF6643D1
|
||||
Accept-Encoding: br,deflate,gzip,x-gzip
|
||||
|
||||
<> 2024-01-15T143315.200.json
|
||||
|
||||
###
|
||||
|
||||
GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@132.126.207.130:35690/hudi_services/service_scheduler/schedule/schedule_times
|
||||
Connection: Keep-Alive
|
||||
User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)
|
||||
Cookie: JSESSIONID=E854FA8E5E26010DB1870C60EF6643D1
|
||||
Accept-Encoding: br,deflate,gzip,x-gzip
|
||||
|
||||
<> 2024-01-15T143306.200.json
|
||||
|
||||
###
|
||||
|
||||
GET http://AxhEbscwsJDbYMH2:cYxg3b4PtWoVD5SjFayWxtnSVsjzRsg4@132.126.207.130:35690/hudi_services/service_scheduler/schedule/schedule_times
|
||||
Connection: Keep-Alive
|
||||
User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)
|
||||
Cookie: JSESSIONID=E854FA8E5E26010DB1870C60EF6643D1
|
||||
Accept-Encoding: br,deflate,gzip,x-gzip
|
||||
|
||||
<> 2024-01-15T143304.200.json
|
||||
|
||||
###
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.lanyuanxiaoyao.service.cloud;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.lanyuanxiaoyao.service.cloud.entity.PrometheusTarget;
|
||||
import org.eclipse.collections.api.factory.Lists;
|
||||
import org.eclipse.collections.api.factory.Maps;
|
||||
import org.eclipse.collections.api.list.ImmutableList;
|
||||
import org.eclipse.collections.api.map.ImmutableMap;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.client.discovery.DiscoveryClient;
|
||||
@@ -49,4 +52,15 @@ public class CloudController {
|
||||
.toSortedList()
|
||||
.toImmutable();
|
||||
}
|
||||
|
||||
@GetMapping("targets")
|
||||
public ImmutableList<PrometheusTarget> prometheusTargets() {
|
||||
return Lists.immutable.ofAll(client.getServices())
|
||||
.collect(name -> {
|
||||
ImmutableList<String> targets = Lists.immutable.ofAll(client.getInstances(name))
|
||||
.collect(instance -> instance.getUri().toString());
|
||||
ImmutableMap<String, String> labels = Maps.immutable.of("application", name);
|
||||
return new PrometheusTarget(targets, labels);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.lanyuanxiaoyao.service.cloud.entity;
|
||||
|
||||
import org.eclipse.collections.api.list.ImmutableList;
|
||||
import org.eclipse.collections.api.map.ImmutableMap;
|
||||
|
||||
/**
|
||||
* Prometheus服务发现
|
||||
*
|
||||
* @author lanyuanxiaoyao
|
||||
* @date 2024-01-31
|
||||
*/
|
||||
public class PrometheusTarget {
|
||||
private final ImmutableList<String> targets;
|
||||
private final ImmutableMap<String, String> labels;
|
||||
|
||||
public PrometheusTarget(ImmutableList<String> targets, ImmutableMap<String, String> labels) {
|
||||
this.targets = targets;
|
||||
this.labels = labels;
|
||||
}
|
||||
|
||||
public ImmutableList<String> getTargets() {
|
||||
return targets;
|
||||
}
|
||||
|
||||
public ImmutableMap<String, String> getLabels() {
|
||||
return labels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PrometheusTarget{" +
|
||||
"ips=" + targets +
|
||||
", labels=" + labels +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,10 @@ GET http://132.122.116.149:35680/api/message_id?flink_job_id=1542097984132706304
|
||||
GET {{web-url}}/cloud/deploy_plan
|
||||
|
||||
### Get info query services
|
||||
GET {{services-url}}/cloud/services?service_name=center-gateway-new
|
||||
GET {{services-url}}/cloud/services?service_name=service-gateway
|
||||
|
||||
### Get Prometheus targets
|
||||
GET {{services-url}}/cloud/targets
|
||||
|
||||
### Sync status
|
||||
GET {{web-url}}/overview/sync_running_status
|
||||
|
||||
Reference in New Issue
Block a user