Skip to content

Commit

Permalink
WIP:feature support k8s monitor, http monitor nacos, service&http_mic…
Browse files Browse the repository at this point in the history
…ro monitor msa (#421)

  [collector] bugfix: Solve imprecise cyclicJob execution interval problem.
1.wheelTimer tickDuration from 10s changed to 1s,ticksPerWheel remain unchanged.
2.now support second level job interval.

  [manager] elasticsearch support ssl as an option

  [monitor]
1.K8sClient monitor k8s
2.http monitor nacos
3.service&http_micro monitor msa

  [collector]fix pmd problem
  • Loading branch information
cuipiheqiuqiu authored and tomsun28 committed Nov 13, 2022
1 parent 6f6c0e3 commit 58354b6
Show file tree
Hide file tree
Showing 40 changed files with 3,208 additions and 12 deletions.
11 changes: 11 additions & 0 deletions collector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
<version>1.0</version>
<scope>provided</scope>
</dependency>
<!-- validation -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- etcd -->
<dependency>
<groupId>io.etcd</groupId>
Expand Down Expand Up @@ -148,6 +153,12 @@
<artifactId>snmp4j</artifactId>
<version>3.6.7</version>
</dependency>
<!-- k8s client -->
<dependency>
<groupId>io.kubernetes</groupId>
<artifactId>client-java</artifactId>
<version>10.0.1</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -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<String> 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<String, ServicePodModel> podMap, List<String> 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<String> fields, List<String> aliasFields ,List<String> jsonScript, HttpProtocol http,
Map<String,List<String>> 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<String,List<String>> tempcloums,String kv){

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
@Slf4j
public class HttpCollectImpl extends AbstractCollect {

private HttpCollectImpl() {}
public HttpCollectImpl() {}

public static HttpCollectImpl getInstance() {
return Singleton.INSTANCE;
Expand Down Expand Up @@ -397,7 +397,7 @@ private void parseResponseByDefault(String resp, List<String> 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();
Expand All @@ -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();
Expand Down
Loading

0 comments on commit 58354b6

Please sign in to comment.