Skip to content

Commit

Permalink
refactor: remove meta-dal module
Browse files Browse the repository at this point in the history
  • Loading branch information
霄鸿 committed Apr 23, 2024
1 parent 0c407e2 commit af4e0be
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 362 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
* @author jsy1001de
Expand All @@ -30,15 +32,15 @@ public class LogPluginUtil {
public static void addSpmCols(CustomPluginConf conf) {

Boolean spm = checkSpmConditions(conf);
Set<String> spmSets =
new HashSet<>(Arrays.asList("total", "success", "fail", "cost", "successPercent"));

List<CollectMetric> newCollectMetrics = new ArrayList<>();
int cols = 0;
if (!CollectionUtils.isEmpty(conf.collectMetrics)) {
for (CollectMetric collectMetric : conf.collectMetrics) {
if (null == collectMetric.spm || Boolean.FALSE == collectMetric.spm) {
if (spm == Boolean.TRUE
&& Arrays.asList("total", "success", "fail", "cost", "successPercent")
.contains(collectMetric.tableName)) {
if (spm == Boolean.TRUE && spmSets.contains(collectMetric.tableName)) {
spmSets.remove(collectMetric.tableName);
continue;
}
newCollectMetrics.add(collectMetric);
Expand All @@ -49,12 +51,11 @@ public static void addSpmCols(CustomPluginConf conf) {
continue;
}
newCollectMetrics.add(collectMetric);
cols++;
}
}

// add spm metrics
if (spm == Boolean.TRUE && cols == 0) {
if (spm == Boolean.TRUE && !spmSets.isEmpty()) {
SpmCols spmCols = conf.spmCols;

List<String> tags = new ArrayList<>();
Expand All @@ -67,15 +68,27 @@ public static void addSpmCols(CustomPluginConf conf) {
});
}

newCollectMetrics.add(genTotalCollectMetric(spmCols, tags));
newCollectMetrics.add(genSuccessCollectMetric(spmCols, tags));
newCollectMetrics.add(genFailCollectMetric(spmCols, tags));
newCollectMetrics.add(genCostCollectMetric(spmCols, tags));
newCollectMetrics.add(genSuccessPercentCollectMetric(tags));
for (String apmMetric : spmSets) {
switch (apmMetric) {
case "total":
newCollectMetrics.add(genTotalCollectMetric(spmCols, tags));
break;
case "success":
newCollectMetrics.add(genSuccessCollectMetric(spmCols, tags));
break;
case "fail":
newCollectMetrics.add(genFailCollectMetric(spmCols, tags));
break;
case "cost":
newCollectMetrics.add(genCostCollectMetric(spmCols, tags));
break;
case "successPercent":
newCollectMetrics.add(genSuccessPercentCollectMetric(tags));
break;
}
}
}

conf.setCollectMetrics(newCollectMetrics);

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ public class ParaCheckUtil {
private static final Pattern PATTERN_CLUSTER = Pattern.compile("^[a-z][a-z0-9\\-]{1,20}");

private static final Pattern PATTERN_APPLICATION = Pattern.compile("^[a-z]{1,20}");
private static Pattern PATTERN_CN_SQL =
Pattern.compile("^[\\u00b7A-Za-z0-9\\u4e00-\\u9fa5\\u3000-\\u303f\\uFF0C\\-_ ,|:\\.]*$");

private static Pattern PATTERN_CN_SQL = Pattern.compile(
"^[\\u00b7A-Za-z0-9\\u4e00-\\u9fa5\\u3000-\\u303f\\uFF0C\\-_ (:。&)()@《》<>“”‘’\\[\\]{}【】/%,|:.]*$");
private static Pattern PATTERN_SQL =
Pattern.compile("^[\\u00b7A-Za-z0-9\\u4e00-\\u9fa5\\-_ ,|:\\.]*$");
private static Pattern PATTERN_STRICT_SQL =
Expand Down
5 changes: 0 additions & 5 deletions server/meta/meta-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
<artifactId>meta-proto</artifactId>
<version>${project.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>io.holoinsight.server</groupId>-->
<!-- <artifactId>meta-dal</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down

This file was deleted.

28 changes: 0 additions & 28 deletions server/meta/meta-dal/pom.xml

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions server/meta/meta-dal/src/main/resources/mybatis/mybatis-config.xml

This file was deleted.

Loading

0 comments on commit af4e0be

Please sign in to comment.