Skip to content

Commit

Permalink
hippo4j-monitor code naming and log optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
magestacks committed Aug 6, 2022
1 parent 6ccecf1 commit 27f1d3d
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 52 deletions.
9 changes: 0 additions & 9 deletions hippo4j-monitor/hippo4j-monitor-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.txt</include>
<include>**/*.json</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,23 @@
*/
public enum MonitorTypeEnum {

LOG, PROMETHEUS, SERVER, ES
/**
* LOG
*/
LOG,

/**
* PROMETHEUS
*/
PROMETHEUS,

/**
* SERVER
*/
SERVER,

/**
* ES
*/
ES
}
15 changes: 6 additions & 9 deletions hippo4j-monitor/hippo4j-monitor-es/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
</parent>
<artifactId>hippo4j-monitor-es</artifactId>

<properties>
<elasticsearch.version>6.5.0</elasticsearch.version>
</properties>

<dependencies>
<dependency>
<groupId>cn.hippo4j</groupId>
Expand All @@ -27,11 +31,13 @@
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version>
</dependency>

<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>${elasticsearch.version}</version>
</dependency>

<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
Expand All @@ -40,15 +46,6 @@
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.txt</include>
<include>**/*.json</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.io.FileUtil;
import com.example.monitor.base.AbstractDynamicThreadPoolMonitor;
import com.example.monitor.base.MonitorTypeEnum;
import lombok.extern.slf4j.Slf4j;
import org.elasticsearch.action.admin.indices.alias.Alias;
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
Expand Down Expand Up @@ -144,6 +145,6 @@ public void createIndex(String index, String type, String mapping, Integer shard

@Override
public String getType() {
return "es";
return MonitorTypeEnum.ES.name().toLowerCase();
}
}
9 changes: 0 additions & 9 deletions hippo4j-monitor/hippo4j-monitor-log/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.txt</include>
<include>**/*.json</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
import cn.hippo4j.common.toolkit.JSONUtil;
import cn.hippo4j.core.executor.state.ThreadPoolRunStateHandler;
import com.example.monitor.base.AbstractDynamicThreadPoolMonitor;
import com.example.monitor.base.MonitorTypeEnum;
import lombok.extern.slf4j.Slf4j;

/**
* Log monitor handler
* Log monitor handler.
*/
@Slf4j
public class LogMonitorHandler extends AbstractDynamicThreadPoolMonitor {
Expand All @@ -40,6 +41,6 @@ protected void execute(ThreadPoolRunStateInfo poolRunStateInfo) {

@Override
public String getType() {
return "log";
return MonitorTypeEnum.LOG.name().toLowerCase();
}
}
9 changes: 0 additions & 9 deletions hippo4j-monitor/hippo4j-monitor-prometheus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,6 @@
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.txt</include>
<include>**/*.json</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import cn.hippo4j.core.executor.state.ThreadPoolRunStateHandler;
import cn.hutool.core.bean.BeanUtil;
import com.example.monitor.base.AbstractDynamicThreadPoolMonitor;
import com.example.monitor.base.MonitorTypeEnum;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import io.micrometer.core.instrument.Metrics;
Expand Down Expand Up @@ -84,6 +85,6 @@ private String metricName(String name) {

@Override
public String getType() {
return "prometheus";
return MonitorTypeEnum.PROMETHEUS.name().toLowerCase();
}
}
11 changes: 1 addition & 10 deletions hippo4j-monitor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,12 @@

<modules>
<module>hippo4j-monitor-base</module>
<module>hippo4j-monitor-es</module>
<module>hippo4j-monitor-log</module>
<module>hippo4j-monitor-prometheus</module>
<module>hippo4j-monitor-es</module>
</modules>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.txt</include>
<include>**/*.json</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
<spring-cloud-starter-stream-rocketmq.version>2.2.6.RELEASE</spring-cloud-starter-stream-rocketmq.version>
<spring-cloud-starter-netflix-hystrix.version>2.2.9.RELEASE</spring-cloud-starter-netflix-hystrix.version>
<spring-cloud-starter-alibaba-nacos-config.version>2.2.5.RELEASE</spring-cloud-starter-alibaba-nacos-config.version>
<elasticsearch.version>6.5.0</elasticsearch.version>

<!-- Maven & Build -->
<java.version>1.8</java.version>
Expand Down

0 comments on commit 27f1d3d

Please sign in to comment.