diff --git a/collector/pom.xml b/collector/pom.xml
index 665e549d46d..b90785b57a2 100644
--- a/collector/pom.xml
+++ b/collector/pom.xml
@@ -49,6 +49,11 @@
1.0
provided
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
io.etcd
@@ -148,6 +153,12 @@
snmp4j
3.6.7
+
+
+ io.kubernetes
+ client-java
+ 10.0.1
+
\ No newline at end of file
diff --git a/collector/src/main/java/com/usthe/collector/collect/AbstractParseResponse.java b/collector/src/main/java/com/usthe/collector/collect/AbstractParseResponse.java
new file mode 100644
index 00000000000..c2e76adb10e
--- /dev/null
+++ b/collector/src/main/java/com/usthe/collector/collect/AbstractParseResponse.java
@@ -0,0 +1,80 @@
+package com.usthe.collector.collect;
+
+import com.usthe.common.entity.job.protocol.ServiceProtocol;
+import com.usthe.common.model.ServicePodModel;
+import com.usthe.common.entity.job.Metrics;
+import com.usthe.common.entity.job.protocol.HttpProtocol;
+import com.usthe.common.entity.message.CollectRep;
+import org.springframework.beans.factory.InitializingBean;
+
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 不同数据格式解析抽象类
+ *
+ *
+ */
+
+public interface AbstractParseResponse extends InitializingBean {
+ /**
+ * 通用解析抽象方法
+ *
+ * @param resp
+ * @param aliasFields
+ * @param http
+ * @param builder
+ * @param responseTime
+ */
+ public default void parseResponse(String resp, List aliasFields, HttpProtocol http,
+ CollectRep.MetricsData.Builder builder, Long responseTime) {
+
+ }
+
+ /**
+ * k8s解析方式
+ *
+ * @param metrics
+ * @param resp
+ * @param podMap
+ * @param aliasFields
+ * @param service
+ * @param builder
+ * @param responseTime
+ */
+ public default void parseK8sApi(Metrics metrics, Object resp, Map podMap, List aliasFields, ServiceProtocol service,
+ CollectRep.MetricsData.Builder builder, Long responseTime) {
+
+ }
+
+ /**
+ * 微服务响应体解析方法
+ * @param resp
+ * @param fields
+ * @param aliasFields
+ * @param jsonScript
+ * @param http
+ * @param tempcloums
+ * @param kv
+ */
+ public default void parseResponse(String resp,List fields, List aliasFields ,List jsonScript, HttpProtocol http,
+ Map> tempcloums,String kv){
+
+ }
+
+ /**
+ * 微服务响应体解析方法
+ * @param resp
+ * @param field
+ * @param aliasField
+ * @param jsonScript
+ * @param http
+ * @param tempcloums
+ * @param kv
+ */
+ public default void parseResponse(String resp,String field, String aliasField ,String jsonScript, HttpProtocol http,
+ Map> tempcloums,String kv){
+
+ }
+}
diff --git a/collector/src/main/java/com/usthe/collector/collect/http/HttpCollectImpl.java b/collector/src/main/java/com/usthe/collector/collect/http/HttpCollectImpl.java
index f69ed02fc2e..97615b6916b 100644
--- a/collector/src/main/java/com/usthe/collector/collect/http/HttpCollectImpl.java
+++ b/collector/src/main/java/com/usthe/collector/collect/http/HttpCollectImpl.java
@@ -86,7 +86,7 @@
@Slf4j
public class HttpCollectImpl extends AbstractCollect {
- private HttpCollectImpl() {}
+ public HttpCollectImpl() {}
public static HttpCollectImpl getInstance() {
return Singleton.INSTANCE;
@@ -397,7 +397,7 @@ private void parseResponseByDefault(String resp, List aliasFields, HttpP
* @param httpProtocol http protocol
* @return context
*/
- private HttpContext createHttpContext(HttpProtocol httpProtocol) {
+ public HttpContext createHttpContext(HttpProtocol httpProtocol) {
HttpProtocol.Authorization auth = httpProtocol.getAuthorization();
if (auth != null && DispatchConstants.DIGEST_AUTH.equals(auth.getType())) {
HttpClientContext clientContext = new HttpClientContext();
@@ -422,7 +422,7 @@ private HttpContext createHttpContext(HttpProtocol httpProtocol) {
* @param httpProtocol http参数配置
* @return 请求体
*/
- private HttpUriRequest createHttpRequest(HttpProtocol httpProtocol) {
+ public HttpUriRequest createHttpRequest(HttpProtocol httpProtocol) {
RequestBuilder requestBuilder;
// method
String httpMethod = httpProtocol.getMethod().toUpperCase();
diff --git a/collector/src/main/java/com/usthe/collector/collect/http/MicroServiceActuatorHttpCollectImpl.java b/collector/src/main/java/com/usthe/collector/collect/http/MicroServiceActuatorHttpCollectImpl.java
new file mode 100644
index 00000000000..40a5bd07b37
--- /dev/null
+++ b/collector/src/main/java/com/usthe/collector/collect/http/MicroServiceActuatorHttpCollectImpl.java
@@ -0,0 +1,353 @@
+package com.usthe.collector.collect.http;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+import com.usthe.collector.collect.AbstractParseResponse;
+import com.usthe.collector.collect.common.http.CommonHttpClient;
+
+import com.usthe.collector.collect.strategy.CollectStrategyFactory;
+import com.usthe.collector.collect.strategy.ParseStrategyFactory;
+import com.usthe.collector.dispatch.DispatchConstants;
+import com.usthe.collector.util.JsonPathParser;
+import com.usthe.common.entity.job.Configmap;
+import com.usthe.common.entity.job.Metrics;
+import com.usthe.common.entity.job.protocol.HttpProtocol;
+import com.usthe.common.entity.message.CollectRep;
+import com.usthe.common.util.AesUtil;
+import com.usthe.common.util.CommonConstants;
+import com.usthe.common.util.GsonUtil;
+import com.jayway.jsonpath.TypeRef;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.http.HttpStatus;
+import org.apache.http.client.ClientProtocolException;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.protocol.HttpContext;
+import org.apache.http.util.EntityUtils;
+
+import javax.net.ssl.SSLException;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.net.ConnectException;
+import java.net.UnknownHostException;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
+import java.util.stream.Collectors;
+
+
+
+/**
+ * msa http https collect
+ *
+ *
+ */
+@Slf4j
+public class MicroServiceActuatorHttpCollectImpl extends HttpCollectImpl {
+ public static final int SIZE = 50;
+
+
+ private MicroServiceActuatorHttpCollectImpl() {
+ super();
+ }
+
+ public static MicroServiceActuatorHttpCollectImpl getInstance() {
+ return Singleton.INSTANCE;
+ }
+
+
+ @Override
+ public void collect(CollectRep.MetricsData.Builder builder,long appId, String app, Metrics metrics) {
+ // 校验参数
+ try {
+ if (metrics == null || metrics.getHttp() == null) {
+ throw new Exception("Http/Https collect must has http params");
+ }
+ } catch (Exception e) {
+ builder.setCode(CollectRep.Code.FAIL);
+ builder.setMsg(e.getMessage());
+ return;
+ }
+ List row = new ArrayList<>();
+ try{
+ HttpProtocol tempHttp = metrics.getHttp();
+ List param = metrics.getChildParam();
+ Configmap configmap = param.stream().filter(c -> DispatchConstants.CHILD_REQUESTS.equals(c.getKey())).findFirst().orElse(null);
+ List