Skip to content

Commit

Permalink
refactor: optimize home-dal (#865)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsy1001de authored Jun 18, 2024
1 parent 0fe1648 commit 3ad1bd1
Show file tree
Hide file tree
Showing 199 changed files with 748 additions and 1,030 deletions.
2 changes: 1 addition & 1 deletion scripts/docker/bin/app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fi


# GC
JAVA_OPTS="$JAVA_OPTS -XX:CMSInitiatingOccupancyFraction=65 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:+CMSScavengeBeforeRemark -XX:CMSMaxAbortablePrecleanTime=5000 -XX:CMSScheduleRemarkEdenPenetration=50 -XX:+CMSParallelInitialMarkEnabled -XX:PermSize=256m -XX:MaxPermSize=256m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=3"
JAVA_OPTS="$JAVA_OPTS -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:+CMSScavengeBeforeRemark -XX:CMSMaxAbortablePrecleanTime=5000 -XX:CMSScheduleRemarkEdenPenetration=50 -XX:+CMSParallelInitialMarkEnabled -XX:PermSize=256m -XX:MaxPermSize=256m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=256m -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=3"
JAVA_OPTS="$JAVA_OPTS -Xloggc:/home/admin/logs/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintAdaptiveSizePolicy -XX:+PrintTenuringDistribution -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100m -verbose:gc -XX:+DisableExplicitGC"

# other
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import io.holoinsight.server.apm.common.constants.Const;
import io.holoinsight.server.apm.common.utils.TimeUtils;
import io.holoinsight.server.apm.engine.model.SlowSqlDO;
import io.holoinsight.server.common.trace.TraceAgentConfiguration;
import io.holoinsight.server.common.dao.entity.dto.TraceAgentConfigurationDTO;
import io.holoinsight.server.common.trace.TraceAgentConfigurationScheduler;
import io.opentelemetry.proto.trace.v1.Span;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
Expand Down Expand Up @@ -46,10 +46,10 @@ public List<SlowSqlDO> analysis(Span span, Map<String, String> spanAttrMap,
- TimeUtils.unixNano2MS(span.getStartTimeUnixNano());
long slowSqlThreshold = Const.SLOW_SQL_THRESHOLD;
// Get slow sql dynamic threshold from cache
TraceAgentConfiguration configuration =
TraceAgentConfigurationDTO configuration =
agentConfigurationScheduler.getValue(tenant, service, getExtendInfo(spanAttrMap));
if (configuration != null) {
slowSqlThreshold = Long.parseLong(configuration.getConfiguration()
slowSqlThreshold = Long.parseLong((String) configuration.getConfiguration()
.getOrDefault(Const.SLOW_SQL_THRESHOLD_CONFIG, String.valueOf(slowSqlThreshold)));
}
if (latency < slowSqlThreshold) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.converter;
package io.holoinsight.server.common.dao.converter;

import io.holoinsight.server.home.dal.model.DisplayMenu;
import io.holoinsight.server.home.dal.model.dto.DisplayMenuDTO;
import io.holoinsight.server.home.dal.transformer.DisplayMenuConfigMapper;
import io.holoinsight.server.common.dao.entity.DisplayMenu;
import io.holoinsight.server.common.dao.entity.dto.DisplayMenuDTO;
import io.holoinsight.server.common.dao.transformer.DisplayMenuConfigMapper;
import org.mapstruct.Mapper;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.converter;
package io.holoinsight.server.common.dao.converter;

import io.holoinsight.server.home.dal.model.DisplayTemplate;
import io.holoinsight.server.home.dal.model.dto.DisplayTemplateDTO;
import io.holoinsight.server.common.dao.entity.DisplayTemplate;
import io.holoinsight.server.common.dao.entity.dto.DisplayTemplateDTO;
import io.holoinsight.server.common.dao.transformer.MapJsonMapper;
import org.mapstruct.Mapper;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.converter;
package io.holoinsight.server.common.dao.converter;

import io.holoinsight.server.home.dal.model.IntegrationGenerated;
import io.holoinsight.server.home.dal.model.dto.IntegrationGeneratedDTO;
import io.holoinsight.server.common.dao.entity.IntegrationGenerated;
import io.holoinsight.server.common.dao.entity.dto.IntegrationGeneratedDTO;
import io.holoinsight.server.common.dao.transformer.MapJsonMapper;
import org.mapstruct.Mapper;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.converter;
package io.holoinsight.server.common.dao.converter;

import io.holoinsight.server.common.J;
import io.holoinsight.server.home.dal.model.IntegrationPlugin;
import io.holoinsight.server.home.dal.model.dto.GaeaCollectConfigDTO.CollectRange;
import io.holoinsight.server.home.dal.model.dto.IntegrationPluginDTO;
import io.holoinsight.server.home.dal.transformer.GaeaCollectRangeMapper;
import io.holoinsight.server.home.dal.transformer.JsonObjectMapper;
import io.holoinsight.server.common.dao.entity.GaeaCollectRange;
import io.holoinsight.server.common.dao.entity.IntegrationPlugin;
import io.holoinsight.server.common.dao.entity.dto.IntegrationPluginDTO;
import io.holoinsight.server.common.dao.transformer.GaeaCollectRangeMapper;
import io.holoinsight.server.common.dao.transformer.JsonObjectMapper;
import io.holoinsight.server.common.dao.transformer.MapJsonMapper;
import org.apache.commons.lang3.StringUtils;
import org.mapstruct.Mapper;
Expand All @@ -25,7 +25,7 @@ public interface IntegrationPluginConverter {

List<IntegrationPluginDTO> dosToDTOs(Iterable<IntegrationPlugin> integrationPlugins);

default String map(CollectRange value) {
default String map(GaeaCollectRange value) {
if (value == null) {
return StringUtils.EMPTY;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.converter;
package io.holoinsight.server.common.dao.converter;

import io.holoinsight.server.home.dal.model.IntegrationProduct;
import io.holoinsight.server.home.dal.model.dto.IntegrationProductDTO;
import io.holoinsight.server.home.dal.transformer.FormJsonMapper;
import io.holoinsight.server.common.dao.entity.IntegrationProduct;
import io.holoinsight.server.common.dao.entity.dto.IntegrationProductDTO;
import io.holoinsight.server.common.dao.transformer.IntegrationFormJsonMapper;
import io.holoinsight.server.common.dao.transformer.MapJsonMapper;
import io.holoinsight.server.home.dal.transformer.MetricJsonMapper;
import io.holoinsight.server.common.dao.transformer.MetricJsonMapper;
import org.mapstruct.Mapper;

import java.util.List;

@Mapper(componentModel = "spring",
uses = {MetricJsonMapper.class, MapJsonMapper.class, FormJsonMapper.class})
uses = {MetricJsonMapper.class, MapJsonMapper.class, IntegrationFormJsonMapper.class})
public interface IntegrationProductConverter {

IntegrationProductDTO doToDTO(IntegrationProduct IntegrationProduct);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.converter;
package io.holoinsight.server.common.dao.converter;

import java.util.List;

import io.holoinsight.server.common.dao.transformer.JsonObjectMapper;
import org.mapstruct.Mapper;

import io.holoinsight.server.home.dal.model.MarketplacePlugin;
import io.holoinsight.server.home.dal.model.dto.MarketplacePluginDTO;
import io.holoinsight.server.home.dal.transformer.JsonObjectMapper;
import io.holoinsight.server.common.dao.entity.MarketplacePlugin;
import io.holoinsight.server.common.dao.entity.dto.MarketplacePluginDTO;

@Mapper(componentModel = "spring", uses = {JsonObjectMapper.class})
public interface MarketplacePluginConverter {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.converter;
package io.holoinsight.server.common.dao.converter;

import java.util.List;

import io.holoinsight.server.common.dao.transformer.IntegrationFormJsonMapper;
import org.mapstruct.Mapper;

import io.holoinsight.server.home.dal.model.MarketplaceProduct;
import io.holoinsight.server.home.dal.model.dto.MarketplaceProductDTO;
import io.holoinsight.server.home.dal.transformer.FormJsonMapper;
import io.holoinsight.server.home.dal.transformer.MetricJsonMapper;
import io.holoinsight.server.common.dao.entity.MarketplaceProduct;
import io.holoinsight.server.common.dao.entity.dto.MarketplaceProductDTO;
import io.holoinsight.server.common.dao.transformer.MetricJsonMapper;

@Mapper(componentModel = "spring", uses = {MetricJsonMapper.class, FormJsonMapper.class})
@Mapper(componentModel = "spring", uses = {MetricJsonMapper.class, IntegrationFormJsonMapper.class})
public interface MarketplaceProductConverter {

MarketplaceProductDTO doToDTO(MarketplaceProduct MarketplaceProduct);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.converter;
package io.holoinsight.server.common.dao.converter;

import io.holoinsight.server.home.dal.model.MetaTable;
import io.holoinsight.server.home.dal.model.dto.MetaTableDTO;
import io.holoinsight.server.home.dal.transformer.MetaTableConfigMapper;
import io.holoinsight.server.home.dal.transformer.MetaTableSchemaMapper;
import io.holoinsight.server.common.dao.entity.MetaTable;
import io.holoinsight.server.common.dao.entity.dto.MetaTableDTO;
import io.holoinsight.server.common.dao.transformer.MetaTableConfigMapper;
import io.holoinsight.server.common.dao.transformer.MetaTableSchemaMapper;
import org.mapstruct.Mapper;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.converter;
package io.holoinsight.server.common.dao.converter;

import io.holoinsight.server.common.dao.entity.TenantOps;
import io.holoinsight.server.common.dao.entity.dto.TenantOpsDTO;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.model.dto;
package io.holoinsight.server.common.dao.emuns;

/**
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.model.dto;
package io.holoinsight.server.common.dao.entity;


import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.model;
package io.holoinsight.server.common.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.model;
package io.holoinsight.server.common.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.model;
package io.holoinsight.server.common.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.model;
package io.holoinsight.server.common.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/

package io.holoinsight.server.common.dao.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
* @author jsy1001de
* @version 1.0: GaeaCollectRange.java, Date: 2024-06-14 Time: 14:20
*/

@Data
@NoArgsConstructor
@AllArgsConstructor
public class GaeaCollectRange implements Serializable {
private static final long serialVersionUID = -2140563386879600142L;

public String type;
public CloudMonitorRange cloudmonitor;

public boolean isEqual(GaeaCollectRange originalRecord) {
if ((originalRecord == null)
|| (this.cloudmonitor == null && originalRecord.cloudmonitor != null)
|| (this.cloudmonitor != null && originalRecord.cloudmonitor == null)) {
return false;
}
return this.cloudmonitor.isEqual(originalRecord.cloudmonitor);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.model;
package io.holoinsight.server.common.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.model;
package io.holoinsight.server.common.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.model;
package io.holoinsight.server.common.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.model;
package io.holoinsight.server.common.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.model;
package io.holoinsight.server.common.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.model;
package io.holoinsight.server.common.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import javax.persistence.Table;
import java.util.Date;

/**
Expand All @@ -16,7 +16,7 @@
* @version 1.0: MetaTable.java, v 0.1 2022年03月22日 11:34 上午 jinsong.yjs Exp $
*/
@Data
@Table(name = "meta_table")
@TableName("meta_table")
public class MetaTable {

@TableId(type = IdType.AUTO)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/
package io.holoinsight.server.home.dal.model;
package io.holoinsight.server.common.dao.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import javax.persistence.Column;

@Data
@TableName("trace_agent_configuration_properties")
public class TraceAgentConfProp {
private String type;
private String language;
@Column(name = "prop_key")
private String propKey;
private String name;
@Column(name = "c_name")
private String cName;
private String description;
@Column(name = "c_description")
private String cDescription;
@Column(name = "check_expression")
private String checkExpression;


}
Loading

0 comments on commit 3ad1bd1

Please sign in to comment.