Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: optimize home-dal #865

Merged
merged 5 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
@@ -0,0 +1,25 @@
/*
* Copyright 2022 Holoinsight Project Authors. Licensed under Apache-2.0.
*/

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

import io.holoinsight.server.common.dao.entity.MonitorInstance;
import io.holoinsight.server.common.dao.entity.dto.MonitorInstanceDTO;
import io.holoinsight.server.common.dao.transformer.MonitorInstanceCfgMapper;
import org.mapstruct.Mapper;

import java.util.List;

/**
* @author jsy1001de
* @version 1.0: MonitorInstanceConfigConverter.java, Date: 2024-06-03 Time: 11:05
*/
@Mapper(componentModel = "spring", uses = {MonitorInstanceCfgMapper.class})
public interface MonitorInstanceConfigConverter {
MonitorInstanceDTO doToDTO(MonitorInstance monitorInstance);

MonitorInstance dtoToDO(MonitorInstanceDTO monitorInstanceDTO);

List<MonitorInstanceDTO> dosToDTOs(Iterable<MonitorInstance> monitorInstances);
}
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
Loading
Loading