Skip to content

Commit

Permalink
create metricinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
saimu.msm committed Aug 2, 2023
1 parent f5afb33 commit 0c84cad
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public class MetricInfo {

public boolean deleted;

public String storageTenant;

@TableField(value = "`gmt_create`")
public Date gmtCreate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public class MetricInfoDTO {
public String ref;
public String extInfo;

public String storageTenant;

public Date gmtCreate;

public Date gmtModified;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/

-- ----------------------------
-- Table structure for metric_info
-- ----------------------------
ALTER TABLE `metric_info`
ADD COLUMN `storage_tenant` VARCHAR(200) NULL AFTER `ext_info`;
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public List<MetricInfo> buildEntity(IntegrationProductDTO integrationProduct) {
if (!CollectionUtils.isEmpty(model.getMetricInfoList())) {
metricInfoList.addAll(model.getMetricInfoList());
}
List<MetricInfo> list = getMetricInfoList(model.getMetric(), model.getTags());
List<MetricInfo> list =
getMetricInfoList(model.getMetric(), model.getTags(), model.getMetricInfoTemplate());
if (!CollectionUtils.isEmpty(list)) {
metricInfoList.addAll(list);
}
Expand All @@ -50,7 +51,8 @@ public List<MetricInfo> buildEntity(IntegrationProductDTO integrationProduct) {
return metricInfoList;
}

protected abstract List<MetricInfo> getMetricInfoList(String metric, List<String> tags);
protected abstract List<MetricInfo> getMetricInfoList(String metric, List<String> tags,
MetricInfo metricInfoTemplate);


public List<MetricInfoModel> getMetricInfoModel(String product) {
Expand All @@ -68,6 +70,7 @@ public static class MetricInfoModel {
public String metric;
public List<String> tags = new ArrayList<>();
public List<MetricInfo> metricInfoList = new ArrayList<>();
public MetricInfo metricInfoTemplate;
}

public MetricInfo genMetricInfo(String tenant, String workspace, String organization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public List<MetricInfo> buildEntity(IntegrationProductDTO integrationProduct) {
}

@Override
protected List<MetricInfo> getMetricInfoList(String metric, List<String> tags) {
protected List<MetricInfo> getMetricInfoList(String metric, List<String> tags,
MetricInfo metricInfoTemplate) {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
public class JvmMetricCrawlerBuilder extends AbstractMetricCrawlerBuilder {

@Override
protected List<MetricInfo> getMetricInfoList(String metric, List<String> tags) {
protected List<MetricInfo> getMetricInfoList(String metric, List<String> tags,
MetricInfo metricInfoTemplate) {
List<MetricInfo> metricInfoList = new ArrayList<>();

metricInfoList.add(genMetricInfo(GLOBAL_TENANT, GLOBAL_WORKSPACE, GLOBAL_ORGANIZATION, "jvm",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
@MetricCrawler(code = "io.holoinsight.plugin.MysqlPlugin")
public class MysqlMetricCrawlerBuilder extends AbstractMetricCrawlerBuilder {
@Override
protected List<MetricInfo> getMetricInfoList(String metric, List<String> tags) {
protected List<MetricInfo> getMetricInfoList(String metric, List<String> tags,
MetricInfo metricInfoTemplate) {

List<MetricInfo> metricInfoList = new ArrayList<>();
Map<String, List<IntegrationMetricDTO>> listMap = J.fromJson(metricData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
public class PortCheckMetricCrawlerBuilder extends AbstractMetricCrawlerBuilder {

@Override
protected List<MetricInfo> getMetricInfoList(String metric, List<String> tags) {
protected List<MetricInfo> getMetricInfoList(String metric, List<String> tags,
MetricInfo metricInfoTemplate) {
List<MetricInfo> metricInfoList = new ArrayList<>();

metricInfoList.add(genMetricInfo(GLOBAL_TENANT, GLOBAL_WORKSPACE, GLOBAL_ORGANIZATION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
public class SystemMetricCrawlerBuilder extends AbstractMetricCrawlerBuilder {

@Override
protected List<MetricInfo> getMetricInfoList(String metric, List<String> tags) {
protected List<MetricInfo> getMetricInfoList(String metric, List<String> tags,
MetricInfo metricInfoTemplate) {
List<MetricInfo> metricInfoList = new ArrayList<>();
metricInfoList.add(genMetricInfo(GLOBAL_TENANT, GLOBAL_WORKSPACE, GLOBAL_ORGANIZATION, "system",
"CPU", "cpu_util", "k8s_pod_cpu_util", "cpu 使用率", PERCENT_UNIT, 60, tags));
Expand Down

0 comments on commit 0c84cad

Please sign in to comment.