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

[#9903] add system metric host management function #9904

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.navercorp.pinpoint.metric.web;


import com.navercorp.pinpoint.metric.web.config.MetricWebMysqlDaoConfiguration;
import com.navercorp.pinpoint.metric.web.config.MetricWebPinotDaoConfiguration;
import com.navercorp.pinpoint.pinot.config.PinotConfiguration;
import org.springframework.context.annotation.ComponentScan;
Expand All @@ -14,7 +15,8 @@
@Import({
WebMetricPropertySources.class,
MetricWebPinotDaoConfiguration.class,
PinotConfiguration.class
PinotConfiguration.class,
MetricWebMysqlDaoConfiguration.class
})
@Profile("metric")
public class MetricWebApp {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.navercorp.pinpoint.metric.web.config;

import com.navercorp.pinpoint.metric.collector.config.MyBatisRegistryHandler;
import com.navercorp.pinpoint.pinot.mybatis.MyBatisConfiguration;
import org.apache.ibatis.session.Configuration;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.core.io.Resource;

import javax.sql.DataSource;

@org.springframework.context.annotation.Configuration
public class MetricWebMysqlDaoConfiguration {
private final Logger logger = LogManager.getLogger(MetricWebMysqlDaoConfiguration.class);

Check warning on line 20 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java#L19-L20

Added lines #L19 - L20 were not covered by tests

@Bean
public SqlSessionFactoryBean metricSqlSessionFactory(
@Qualifier("dataSource") DataSource dataSource,
@Value("classpath*:/pinot-web/mapper/mysql/*Mapper.xml") Resource[] mappers) {

for (Resource mapper : mappers) {
logger.info("Mapper location: {}", mapper.getDescription());

Check warning on line 28 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java#L28

Added line #L28 was not covered by tests
}

SqlSessionFactoryBean sessionFactoryBean = new SqlSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource);
sessionFactoryBean.setMapperLocations(mappers);

Check warning on line 33 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java#L31-L33

Added lines #L31 - L33 were not covered by tests

Configuration config = MyBatisConfiguration.defaultConfiguration();
sessionFactoryBean.setConfiguration(config);

Check warning on line 36 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java#L35-L36

Added lines #L35 - L36 were not covered by tests

MyBatisRegistryHandler registry = registryHandler();
registry.registerTypeAlias(config.getTypeAliasRegistry());

Check warning on line 39 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java#L38-L39

Added lines #L38 - L39 were not covered by tests

sessionFactoryBean.setFailFast(true);

Check warning on line 41 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java#L41

Added line #L41 was not covered by tests

return sessionFactoryBean;

Check warning on line 43 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java#L43

Added line #L43 was not covered by tests
}

private MyBatisRegistryHandler registryHandler() {
return new WebRegistryHandler();

Check warning on line 47 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java#L47

Added line #L47 was not covered by tests
}

@Bean
public SqlSessionTemplate metricSqlSessionTemplate(
@Qualifier("metricSqlSessionFactory") SqlSessionFactory sessionFactory) {
return new SqlSessionTemplate(sessionFactory);

Check warning on line 53 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/MetricWebMysqlDaoConfiguration.java#L53

Added line #L53 was not covered by tests
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.navercorp.pinpoint.metric.collector.config.MyBatisRegistryHandler;
import com.navercorp.pinpoint.metric.common.config.CommonRegistryHandler;
import com.navercorp.pinpoint.metric.common.model.Tag;
import com.navercorp.pinpoint.metric.web.dao.model.HostExclusionSearchKey;
import com.navercorp.pinpoint.metric.web.dao.model.HostInfoSearchKey;
import com.navercorp.pinpoint.metric.web.dao.model.MetricInfoSearchKey;
import com.navercorp.pinpoint.metric.web.dao.model.MetricTagsSearchKey;
Expand Down Expand Up @@ -45,6 +46,8 @@
typeAliasRegistry.registerAlias("metricInfoSearchKey", MetricInfoSearchKey.class);
typeAliasRegistry.registerAlias("metricTagsSearchKey", MetricTagsSearchKey.class);
typeAliasRegistry.registerAlias("hostInfoSearchKey", HostInfoSearchKey.class);

typeAliasRegistry.registerAlias("hostExclusionSearchKey", HostExclusionSearchKey.class);

Check warning on line 50 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/WebRegistryHandler.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/config/WebRegistryHandler.java#L50

Added line #L50 was not covered by tests
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
package com.navercorp.pinpoint.metric.web.controller;

import com.navercorp.pinpoint.metric.web.service.SystemMetricHostExclusionService;
import com.navercorp.pinpoint.metric.web.view.SystemMetricHostGroupInfo;
import com.navercorp.pinpoint.metric.web.view.SystemMetricHostInfo;
import com.navercorp.pinpoint.pinot.tenant.TenantProvider;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ResponseStatusException;

import java.util.List;

@RestController
@RequestMapping(value = "/exclusion/systemMetric")
public class SystemMetricExclusionController {
private final Logger logger = LogManager.getLogger(this.getClass());

Check warning on line 23 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java#L23

Added line #L23 was not covered by tests

private final SystemMetricHostExclusionService systemMetricHostExclusionService;
private final TenantProvider tenantProvider;

public SystemMetricExclusionController(SystemMetricHostExclusionService systemMetricHostExclusionService, TenantProvider tenantProvider) {
this.systemMetricHostExclusionService = systemMetricHostExclusionService;
this.tenantProvider = tenantProvider;
}

Check warning on line 31 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java#L28-L31

Added lines #L28 - L31 were not covered by tests

@GetMapping(value = "/hostGroup")
public List<String> getHostGroupNameList() {
String tenantId = tenantProvider.getTenantId();
return systemMetricHostExclusionService.getHostGroupNameList(tenantId);

Check warning on line 36 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java#L35-L36

Added lines #L35 - L36 were not covered by tests
}

@GetMapping(value = "/hostGroup", params = {"hostGroupName"})
public SystemMetricHostGroupInfo getHostGroupExclusionInfo(@RequestParam("hostGroupName") String hostGroupName) {
String tenantId = tenantProvider.getTenantId();
return systemMetricHostExclusionService.getHostGroupInfo(tenantId, hostGroupName);

Check warning on line 42 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java#L41-L42

Added lines #L41 - L42 were not covered by tests
}

@GetMapping(value = "/hostGroup/host")
public List<SystemMetricHostInfo> getHostExclusionInfoList(@RequestParam("hostGroupName") String hostGroupName,
@RequestParam(value = "orderBy", defaultValue = "hostName") String orderBy) {
String tenantId = tenantProvider.getTenantId();
return systemMetricHostExclusionService.getHostInfoList(tenantId, hostGroupName, orderBy);

Check warning on line 49 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java#L48-L49

Added lines #L48 - L49 were not covered by tests
}

@PostMapping(value = "/hostGroup")
public String insertHostGroupExclusion(@RequestParam("hostGroupName") String hostGroupName) {
logger.debug("add hostGroup exclusion - hostGroupName: [{}]", hostGroupName);

Check warning on line 54 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java#L54

Added line #L54 was not covered by tests
try {
systemMetricHostExclusionService.insertHostGroupExclusion(hostGroupName);
return "OK";
} catch (Exception e) {
logger.error("error while adding hostGroup exclusion", e);
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage());

Check warning on line 60 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java#L56-L60

Added lines #L56 - L60 were not covered by tests
}
}

@DeleteMapping(value = "/hostGroup")
public String deleteHostGroupExclusion(@RequestParam("hostGroupName") String hostGroupName) {
logger.debug("delete host group exclusion - hostGroupName: [{}]", hostGroupName);

Check warning on line 66 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java#L66

Added line #L66 was not covered by tests
try {
systemMetricHostExclusionService.deleteHostGroupExclusion(hostGroupName);
return "OK";
} catch (Exception e) {
logger.error("error while deleting hostGroup exclusion", e);
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage());

Check warning on line 72 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java#L68-L72

Added lines #L68 - L72 were not covered by tests
}
}

@PostMapping(value = "/hostGroup/host")
public String insertHostExclusion(@RequestParam("hostGroupName") String hostGroupName,
@RequestParam("hostName") String hostName) {
logger.debug("add host exclusion - hostGroupName: [{}], hostName: [{}]", hostGroupName, hostName);

Check warning on line 79 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java#L79

Added line #L79 was not covered by tests
try {
systemMetricHostExclusionService.insertHostExclusion(hostGroupName, hostName);
return "OK";
} catch (Exception e) {
logger.error("error while adding host exclusion", e);
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage());

Check warning on line 85 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java#L81-L85

Added lines #L81 - L85 were not covered by tests
}
}

@DeleteMapping(value = "/hostGroup/host")
public String deleteHostExclusion(@RequestParam("hostGroupName") String hostGroupName,
@RequestParam("hostName") String hostName) {
logger.debug("delete host exclusion - hostGroupName: [{}], hostName: [{}]", hostGroupName, hostName);

Check warning on line 92 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java#L92

Added line #L92 was not covered by tests
try {
systemMetricHostExclusionService.deleteHostExclusion(hostGroupName, hostName);
return "OK";
} catch (Exception e) {
logger.error("error while deleting host exclusion", e);
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage());

Check warning on line 98 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java#L94-L98

Added lines #L94 - L98 were not covered by tests
}
}


@DeleteMapping(value = "/unusedGroups")
public String deleteUnusedGroupExclusions() {
logger.debug("delete exclusions from unused groups");
String tenantId = tenantProvider.getTenantId();

Check warning on line 106 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java#L105-L106

Added lines #L105 - L106 were not covered by tests
try {
systemMetricHostExclusionService.deleteUnusedGroupExclusions(tenantId);
return "OK";
} catch (Exception e) {
logger.error("error while deleting exclusions from unused groups", e);
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage());

Check warning on line 112 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/controller/SystemMetricExclusionController.java#L108-L112

Added lines #L108 - L112 were not covered by tests
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.navercorp.pinpoint.metric.web.dao;

import java.util.List;

public interface SystemMetricHostExclusionDao {

List<String> selectExcludedHostGroupNameList();

void insertHostGroupExclusion(String hostGroupName);

void deleteHostGroupExclusion(String hostGroupName);

List<String> selectExcludedHostNameList(String hostGroupName);

void insertHostExclusion(String hostGroupName, String hostName);

void deleteHostExclusion(String hostGroupName, String hostName);

void deleteHostExclusions(String hostGroupName);

List<String> selectGroupNameListFromHostExclusion();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2023 NAVER Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.navercorp.pinpoint.metric.web.dao.model;

import java.util.Objects;

public class HostExclusionSearchKey {
private final String hostGroupName;
private final String hostName;

public HostExclusionSearchKey(String hostGroupName, String hostName) {
this.hostGroupName = Objects.requireNonNull(hostGroupName, "hostGroupName");
this.hostName = Objects.requireNonNull(hostName, "hostName");
}

Check warning on line 28 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/model/HostExclusionSearchKey.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/model/HostExclusionSearchKey.java#L25-L28

Added lines #L25 - L28 were not covered by tests

public String getHostGroupName() {
return hostGroupName;

Check warning on line 31 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/model/HostExclusionSearchKey.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/model/HostExclusionSearchKey.java#L31

Added line #L31 was not covered by tests
}

public String getHostName() {
return hostName;

Check warning on line 35 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/model/HostExclusionSearchKey.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/model/HostExclusionSearchKey.java#L35

Added line #L35 was not covered by tests
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package com.navercorp.pinpoint.metric.web.dao.mysql;

import com.navercorp.pinpoint.metric.web.dao.SystemMetricHostExclusionDao;
import com.navercorp.pinpoint.metric.web.dao.model.HostExclusionSearchKey;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Objects;

@Primary
@Repository
public class MysqlSystemMetricHostExclusionDao implements SystemMetricHostExclusionDao {

private static final String NAMESPACE = MysqlSystemMetricHostExclusionDao.class.getName() + ".";

Check warning on line 17 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java#L17

Added line #L17 was not covered by tests

private final SqlSessionTemplate sqlMetricSessionTemplate;

public MysqlSystemMetricHostExclusionDao(@Qualifier("metricSqlSessionTemplate") SqlSessionTemplate sqlMetricSessionTemplate) {
this.sqlMetricSessionTemplate = Objects.requireNonNull(sqlMetricSessionTemplate, "sqlSessionTemplate");
}

Check warning on line 23 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java#L21-L23

Added lines #L21 - L23 were not covered by tests

@Override
public List<String> selectExcludedHostGroupNameList() {
return sqlMetricSessionTemplate.selectList(NAMESPACE + "selectExcludedHostGroupNames");

Check warning on line 27 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java#L27

Added line #L27 was not covered by tests
}

@Override
public void insertHostGroupExclusion(String hostGroupName) {
sqlMetricSessionTemplate.insert(NAMESPACE + "insertHostGroupExclusion", hostGroupName);
}

Check warning on line 33 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java#L32-L33

Added lines #L32 - L33 were not covered by tests

@Override
public void deleteHostGroupExclusion(String hostGroupName) {
sqlMetricSessionTemplate.delete(NAMESPACE + "deleteHostGroupExclusion", hostGroupName);
}

Check warning on line 38 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java#L37-L38

Added lines #L37 - L38 were not covered by tests

@Override
public List<String> selectExcludedHostNameList(String hostGroupName) {
return sqlMetricSessionTemplate.selectList(NAMESPACE + "selectExcludedHostNames", hostGroupName);

Check warning on line 42 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java#L42

Added line #L42 was not covered by tests
}

@Override
public void insertHostExclusion(String hostGroupName, String hostName) {
sqlMetricSessionTemplate.insert(NAMESPACE + "insertHostExclusion", new HostExclusionSearchKey(hostGroupName, hostName));
}

Check warning on line 48 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java#L47-L48

Added lines #L47 - L48 were not covered by tests

@Override
public void deleteHostExclusion(String hostGroupName, String hostName) {
sqlMetricSessionTemplate.delete(NAMESPACE + "deleteHostExclusion", new HostExclusionSearchKey(hostGroupName, hostName));
}

Check warning on line 53 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java#L52-L53

Added lines #L52 - L53 were not covered by tests

@Override
public void deleteHostExclusions(String hostGroupName) {
sqlMetricSessionTemplate.delete(NAMESPACE + "deleteHostExclusions", hostGroupName);
}

Check warning on line 58 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java#L57-L58

Added lines #L57 - L58 were not covered by tests

@Override
public List<String> selectGroupNameListFromHostExclusion() {
return sqlMetricSessionTemplate.selectList(NAMESPACE + "selectGroupNamesFromHostExclusion");

Check warning on line 62 in metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java

View check run for this annotation

Codecov / codecov/patch

metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/web/dao/mysql/MysqlSystemMetricHostExclusionDao.java#L62

Added line #L62 was not covered by tests
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.navercorp.pinpoint.metric.web.service;

import com.navercorp.pinpoint.metric.web.view.SystemMetricHostGroupInfo;
import com.navercorp.pinpoint.metric.web.view.SystemMetricHostInfo;

import java.util.List;

public interface SystemMetricHostExclusionService {

List<String> getHostGroupNameList(String tenantId);

SystemMetricHostGroupInfo getHostGroupInfo(String tenantId, String hostGroupName);

List<SystemMetricHostInfo> getHostInfoList(String tenantId, String hostGroupName, String orderBy);

void insertHostGroupExclusion(String hostGroupName);

void deleteHostGroupExclusion(String hostGroupName);

void insertHostExclusion(String hostGroupName, String hostName);

void deleteHostExclusion(String hostGroupName, String hostName);

void deleteUnusedGroupExclusions(String tenantId);
}