diff --git a/server/agg/agg-dispatcher/src/main/java/io/holoinsight/server/agg/v1/dispatcher/AggDispatcher.java b/server/agg/agg-dispatcher/src/main/java/io/holoinsight/server/agg/v1/dispatcher/AggDispatcher.java index 7751d588d..68184149f 100644 --- a/server/agg/agg-dispatcher/src/main/java/io/holoinsight/server/agg/v1/dispatcher/AggDispatcher.java +++ b/server/agg/agg-dispatcher/src/main/java/io/holoinsight/server/agg/v1/dispatcher/AggDispatcher.java @@ -74,6 +74,7 @@ public void init() { properties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, AggValuesSerdes.S.class.getName()); properties.put(ProducerConfig.BATCH_SIZE_CONFIG, 64 * 1024); properties.put(ProducerConfig.LINGER_MS_CONFIG, 100); + properties.put(ProducerConfig.MAX_REQUEST_SIZE_CONFIG, 2097152); properties.put(ProducerConfig.MAX_BLOCK_MS_CONFIG, 3000); properties.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, aggProperties.getProducerCompressionType()); diff --git a/server/common/common-service/src/main/java/io/holoinsight/server/common/service/impl/AlertSubscribeServiceImpl.java b/server/common/common-service/src/main/java/io/holoinsight/server/common/service/impl/AlertSubscribeServiceImpl.java index 5bdd2acae..229a80f7f 100644 --- a/server/common/common-service/src/main/java/io/holoinsight/server/common/service/impl/AlertSubscribeServiceImpl.java +++ b/server/common/common-service/src/main/java/io/holoinsight/server/common/service/impl/AlertSubscribeServiceImpl.java @@ -6,16 +6,16 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import io.holoinsight.server.common.dao.converter.AlarmSubscribeConverter; -import io.holoinsight.server.common.dao.mapper.AlarmSubscribeMapper; import io.holoinsight.server.common.dao.entity.AlarmSubscribe; import io.holoinsight.server.common.dao.entity.dto.AlarmSubscribeDTO; import io.holoinsight.server.common.dao.entity.dto.AlarmSubscribeInfo; +import io.holoinsight.server.common.dao.mapper.AlarmSubscribeMapper; import io.holoinsight.server.common.service.AlertSubscribeService; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import javax.annotation.Resource; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -32,11 +32,9 @@ public class AlertSubscribeServiceImpl extends ServiceImpl implements AlertSubscribeService { - @Resource + @Autowired private AlarmSubscribeConverter alarmSubscribeConverter; - @Resource - private AlarmSubscribeMapper alarmSubscribeMapper; public Boolean saveDataBatch(AlarmSubscribeDTO alarmSubscribeDTO, String creator, String tenant, String workspace) { @@ -56,7 +54,9 @@ public Boolean saveDataBatch(AlarmSubscribeDTO alarmSubscribeDTO, String creator alarmSubscribeInfo.stream().map(AlarmSubscribeInfo::getId).collect(Collectors.toList()); ids.removeAll(updateIds); // 删除 - this.removeBatchByIds(ids); + if (!CollectionUtils.isEmpty(ids)) { + ids.forEach(id -> this.baseMapper.deleteById(id)); + } List alarmSubscribeList = new ArrayList<>(); alarmSubscribeDTO.getAlarmSubscribe().forEach(e -> { @@ -88,7 +88,7 @@ public AlarmSubscribeDTO queryByUniqueId(QueryWrapper queryWrapp String uniqueId) { AlarmSubscribeDTO alarmSubscribeDTO = new AlarmSubscribeDTO(); alarmSubscribeDTO.setUniqueId(uniqueId); - List list = this.alarmSubscribeMapper.selectList(queryWrapper); + List list = this.baseMapper.selectList(queryWrapper); if (!CollectionUtils.isEmpty(list)) { alarmSubscribeDTO.setEnvType(list.get(0).getEnvType()); } @@ -98,7 +98,7 @@ public AlarmSubscribeDTO queryByUniqueId(QueryWrapper queryWrapp @Override public List queryByMap(QueryWrapper queryWrapper) { - List list = this.alarmSubscribeMapper.selectList(queryWrapper); + List list = this.baseMapper.selectList(queryWrapper); return alarmSubscribeConverter.dosToDTOs(list); } diff --git a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/GaeaCollectConfigService.java b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/GaeaCollectConfigService.java index 3908033c1..4dfc10947 100644 --- a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/GaeaCollectConfigService.java +++ b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/GaeaCollectConfigService.java @@ -18,6 +18,8 @@ public interface GaeaCollectConfigService extends IService { GaeaCollectConfigDTO findById(Long id); + GaeaCollectConfigDTO findByTableName(String tenant, String workspace, String tableName); + List findByRefId(String refId); GaeaCollectConfigDTO upsert(GaeaCollectConfigDTO gaeaCollectConfigDTO); diff --git a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/GaeaCollectConfigServiceImpl.java b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/GaeaCollectConfigServiceImpl.java index 45e849af3..8181a365d 100644 --- a/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/GaeaCollectConfigServiceImpl.java +++ b/server/home/home-service/src/main/java/io/holoinsight/server/home/biz/service/impl/GaeaCollectConfigServiceImpl.java @@ -3,14 +3,16 @@ */ package io.holoinsight.server.home.biz.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import io.holoinsight.server.common.MD5Hash; import io.holoinsight.server.home.biz.service.GaeaCollectConfigService; import io.holoinsight.server.home.dal.converter.GaeaCollectConfigConverter; import io.holoinsight.server.home.dal.mapper.GaeaCollectConfigMapper; import io.holoinsight.server.home.dal.model.GaeaCollectConfig; import io.holoinsight.server.home.dal.model.dto.GaeaCollectConfigDTO; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.mapstruct.factory.Mappers; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -39,6 +41,20 @@ public GaeaCollectConfigDTO findById(Long id) { return gaeaCollectConfigConverter.doToDTO(getById(id)); } + @Override + public GaeaCollectConfigDTO findByTableName(String tenant, String workspace, String tableName) { + QueryWrapper wrapper = new QueryWrapper<>(); + + wrapper.eq("tenant", tenant); + if (StringUtils.isNotBlank(workspace)) { + wrapper.eq("workspace", workspace); + } + wrapper.eq("table_name", tableName); + wrapper.eq("deleted", 0); + wrapper.last("LIMIT 1"); + return gaeaCollectConfigConverter.doToDTO(this.getOne(wrapper)); + } + @Override public List findByRefId(String refId) { Map columnMap = new HashMap<>(); diff --git a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlarmSubscribeFacadeImpl.java b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlarmSubscribeFacadeImpl.java index fc331fecc..12ff3f5f9 100644 --- a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlarmSubscribeFacadeImpl.java +++ b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/controller/AlarmSubscribeFacadeImpl.java @@ -106,10 +106,10 @@ public void checkParameter() { ParaCheckUtil.checkParaNotNull(alarmSubscribeDTO, "alarmSubscribeDTO"); MonitorScope ms = RequestContext.getContext().ms; MonitorUser mu = RequestContext.getContext().mu; - if (StringUtils.isNotEmpty(alarmSubscribeDTO.getUniqueId())) { + String uniqueId = alarmSubscribeDTO.getUniqueId(); + if (StringUtils.isNotEmpty(uniqueId)) { ParaCheckUtil.checkParaBoolean( - parameterSecurityService.checkRuleTenantAndWorkspace(alarmSubscribeDTO.getUniqueId(), - tenant(), workspace()), + parameterSecurityService.checkRuleTenantAndWorkspace(uniqueId, tenant(), workspace()), "uniqueId do not belong to this tenant " + tenant() + " or workspace " + workspace()); } if (!CollectionUtils.isEmpty(alarmSubscribeDTO.getAlarmSubscribe())) { diff --git a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/security/custom/AlarmRuleLevelAuthorizationChecker.java b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/security/custom/AlarmRuleLevelAuthorizationChecker.java index 2bbafc69e..82d3a2ed3 100644 --- a/server/home/home-web/src/main/java/io/holoinsight/server/home/web/security/custom/AlarmRuleLevelAuthorizationChecker.java +++ b/server/home/home-web/src/main/java/io/holoinsight/server/home/web/security/custom/AlarmRuleLevelAuthorizationChecker.java @@ -6,26 +6,25 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.google.common.reflect.TypeToken; import io.holoinsight.server.common.J; -import io.holoinsight.server.common.dao.entity.MetricInfo; -import io.holoinsight.server.common.dao.entity.dto.MetricInfoDTO; -import io.holoinsight.server.common.service.RequestContextAdapter; +import io.holoinsight.server.common.MonitorPageRequest; import io.holoinsight.server.common.RequestContext; -import io.holoinsight.server.common.dao.mapper.AlarmRuleMapper; -import io.holoinsight.server.common.dao.mapper.AlertTemplateMapper; +import io.holoinsight.server.common.dao.emuns.TimeFilterEnum; import io.holoinsight.server.common.dao.entity.AlarmRule; import io.holoinsight.server.common.dao.entity.AlertTemplate; import io.holoinsight.server.common.dao.entity.dto.AlarmRuleDTO; import io.holoinsight.server.common.dao.entity.dto.AlertRuleExtra; import io.holoinsight.server.common.dao.entity.dto.AlertSilenceConfig; +import io.holoinsight.server.common.dao.entity.dto.MetricInfoDTO; import io.holoinsight.server.common.dao.entity.dto.NotificationConfig; import io.holoinsight.server.common.dao.entity.dto.NotificationTemplate; import io.holoinsight.server.common.dao.entity.dto.alarm.AlarmRuleConf; import io.holoinsight.server.common.dao.entity.dto.alarm.TimeFilter; -import io.holoinsight.server.common.dao.emuns.TimeFilterEnum; -import io.holoinsight.server.common.MonitorPageRequest; import io.holoinsight.server.common.dao.entity.dto.alarm.trigger.CompareConfig; import io.holoinsight.server.common.dao.entity.dto.alarm.trigger.DataSource; import io.holoinsight.server.common.dao.entity.dto.alarm.trigger.Trigger; +import io.holoinsight.server.common.dao.mapper.AlarmRuleMapper; +import io.holoinsight.server.common.dao.mapper.AlertTemplateMapper; +import io.holoinsight.server.common.service.RequestContextAdapter; import io.holoinsight.server.home.web.common.ParaCheckUtil; import io.holoinsight.server.home.web.security.LevelAuthorizationCheckResult; import io.holoinsight.server.home.web.security.LevelAuthorizationMetaData; @@ -86,13 +85,14 @@ public class AlarmRuleLevelAuthorizationChecker extends AbstractQueryChecker private static final Set silenceModes = new HashSet<>(Arrays.asList("default", "gradual", "fixed")); - private static final Set aggregators = new HashSet<>(Arrays.asList("sum", "avg", "mix", - "max", "count", "none", "SUM", "AVG", "MIX", "MAX", "COUNT", "NONE")); + private static final Set aggregators = new HashSet<>(Arrays.asList("sum", "avg", "min", + "max", "count", "none", "SUM", "AVG", "MIN", "MAX", "COUNT", "NONE")); private static final Set metricTypes = new HashSet<>(Arrays.asList("app", "cache", "log", "oss", "trace", "system", "metric", "service", "function", "pg", "mongodb", "db", "miniProgram", "mysql")); - private static final Set products = new HashSet<>(Arrays.asList("JVM", "Function", - "OceanBase", "Tbase", "PortCheck", "System", "MiniProgram", "Spanner", "IoT", "APM")); + private static final Set products = new HashSet<>( + Arrays.asList("JVM", "Function", "OceanBase", "Tbase", "PortCheck", "System", "MiniProgram", + "Spanner", "IoT", "APM", "Mysql", "SLB", "SOFAMQX", "Postgres", "Gateway")); @Override public LevelAuthorizationCheckResult check(LevelAuthorizationMetaData levelAuthMetaData, diff --git a/server/registry/registry-model/src/main/java/io/holoinsight/server/registry/model/Output.java b/server/registry/registry-model/src/main/java/io/holoinsight/server/registry/model/Output.java index 5951bee3c..bac2ee7ae 100644 --- a/server/registry/registry-model/src/main/java/io/holoinsight/server/registry/model/Output.java +++ b/server/registry/registry-model/src/main/java/io/holoinsight/server/registry/model/Output.java @@ -3,6 +3,7 @@ */ package io.holoinsight.server.registry.model; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; import lombok.ToString; @@ -22,6 +23,7 @@ public class Output { */ private String type; private Gateway gateway; + private SLSGateway sls; @ToString @Getter @@ -32,4 +34,16 @@ public static class Gateway { */ private String metricName; } + + @ToString + @Getter + @Setter + @AllArgsConstructor + public static class SLSGateway { + private String endpoint; + private String project; + private String logstore; + private String ak; + private String sk; + } }