Skip to content

Commit

Permalink
[#noissue] Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Mar 20, 2023
1 parent 2e081b6 commit de29976
Show file tree
Hide file tree
Showing 19 changed files with 101 additions and 106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
import com.navercorp.pinpoint.common.server.cluster.zookeeper.ZookeeperClusterConfiguration;
import com.navercorp.pinpoint.common.server.config.AnnotationVisitor;
import com.navercorp.pinpoint.common.server.config.LoggingEvent;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
Expand All @@ -32,15 +31,21 @@
public class CollectorClusterConfig {
private final Logger logger = LogManager.getLogger(getClass());

@Qualifier("clusterConfiguration")
@Autowired
private ZookeeperClusterConfiguration clusterConfiguration;
private final ZookeeperClusterConfiguration clusterConfiguration;

private final String clusterListenIp;

@Value("${cluster.listen.ip:}")
private String clusterListenIp;
private final int clusterListenPort;

@Value("${cluster.listen.port:-1}")
private int clusterListenPort;

public CollectorClusterConfig(
@Qualifier("clusterConfiguration") ZookeeperClusterConfiguration clusterConfiguration,
@Value("${cluster.listen.ip:}") String clusterListenIp,
@Value("${cluster.listen.port:-1}") int clusterListenPort) {
this.clusterConfiguration = clusterConfiguration;
this.clusterListenIp = clusterListenIp;
this.clusterListenPort = clusterListenPort;
}

public boolean isClusterEnable() {
return clusterConfiguration.isEnable();
Expand All @@ -66,18 +71,11 @@ public String getClusterListenIp() {
return clusterListenIp;
}

public void setClusterListenIp(String clusterListenIp) {
this.clusterListenIp = clusterListenIp;
}

public int getClusterListenPort() {
return clusterListenPort;
}

public void setClusterListenPort(int clusterListenPort) {
this.clusterListenPort = clusterListenPort;
}

@PostConstruct
public void log() {
logger.info("{}", this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,24 @@ private BulkWriter newBulkWriter(String loggerName,
}
}

@Bean("callerBulkIncrementer")
public BulkIncrementer getCallerBulkIncrementer() {
@Bean
public BulkIncrementer callerBulkIncrementer() {
String reporterName = "callerBulkIncrementerReporter";
HbaseColumnFamily hbaseColumnFamily = HbaseColumnFamily.MAP_STATISTICS_CALLER_VER2_COUNTER;
int limitSize = bulkConfiguration.getCallerLimitSize();

return newBulkIncrementer(reporterName, hbaseColumnFamily, limitSize);
}

@Bean("callerBulkUpdater")
public BulkUpdater getCallerBulkUpdater() {
@Bean
public BulkUpdater callerBulkUpdater() {
String reporterName = "callerBulkUpdaterReporter";
return getBulkUpdater(reporterName);
}


@Bean("callerBulkWriter")
public BulkWriter newCallerBulkWriter(HbaseOperations2 hbaseTemplate,
@Bean
public BulkWriter callerBulkWriter(HbaseOperations2 hbaseTemplate,
TableNameProvider tableNameProvider,
@Qualifier("statisticsCallerRowKeyDistributor") RowKeyDistributorByHashPrefix rowKeyDistributorByHashPrefix,
@Qualifier("callerBulkIncrementer") BulkIncrementer bulkIncrementer,
Expand All @@ -90,8 +90,8 @@ public BulkWriter newCallerBulkWriter(HbaseOperations2 hbaseTemplate,
}


@Bean("calleeBulkIncrementer")
public BulkIncrementer getCalleeBulkIncrementer() {
@Bean
public BulkIncrementer calleeBulkIncrementer() {
String reporterName = "calleeBulkIncrementerReporter";
HbaseColumnFamily hbaseColumnFamily = HbaseColumnFamily.MAP_STATISTICS_CALLEE_VER2_COUNTER;
int limitSize = bulkConfiguration.getCalleeLimitSize();
Expand All @@ -100,14 +100,14 @@ public BulkIncrementer getCalleeBulkIncrementer() {
}


@Bean("calleeBulkUpdater")
public BulkUpdater getCalleeBulkUpdater() {
@Bean
public BulkUpdater calleeBulkUpdater() {
String reporterName = "calleeBulkUpdaterReporter";
return getBulkUpdater(reporterName);
}

@Bean("calleeBulkWriter")
public BulkWriter newCalleeBulkWriter(HbaseOperations2 hbaseTemplate,
@Bean
public BulkWriter calleeBulkWriter(HbaseOperations2 hbaseTemplate,
TableNameProvider tableNameProvider,
@Qualifier("statisticsCalleeRowKeyDistributor") RowKeyDistributorByHashPrefix rowKeyDistributorByHashPrefix,
@Qualifier("calleeBulkIncrementer") BulkIncrementer bulkIncrementer,
Expand All @@ -116,23 +116,23 @@ public BulkWriter newCalleeBulkWriter(HbaseOperations2 hbaseTemplate,
return newBulkWriter(loggerName, hbaseTemplate, HbaseColumnFamily.MAP_STATISTICS_CALLER_VER2_COUNTER, tableNameProvider, rowKeyDistributorByHashPrefix, bulkIncrementer, bulkUpdater);
}

@Bean("selfBulkIncrementer")
public BulkIncrementer getSelfBulkIncrementer() {
@Bean
public BulkIncrementer selfBulkIncrementer() {
String reporterName = "selfBulkIncrementerReporter";
HbaseColumnFamily hbaseColumnFamily = HbaseColumnFamily.MAP_STATISTICS_SELF_VER2_COUNTER;
int limitSize = bulkConfiguration.getSelfLimitSize();

return newBulkIncrementer(reporterName, hbaseColumnFamily, limitSize);
}

@Bean("selfBulkUpdater")
public BulkUpdater getSelfBulkUpdater() {
@Bean
public BulkUpdater selfBulkUpdater() {
String reporterName = "selfBulkUpdaterReporter";
return getBulkUpdater(reporterName);
}

@Bean("selfBulkWriter")
public BulkWriter newSelfBulkWriter(HbaseOperations2 hbaseTemplate,
@Bean
public BulkWriter selfBulkWriter(HbaseOperations2 hbaseTemplate,
TableNameProvider tableNameProvider,
@Qualifier("statisticsSelfRowKeyDistributor") RowKeyDistributorByHashPrefix rowKeyDistributorByHashPrefix,
@Qualifier("selfBulkIncrementer") BulkIncrementer bulkIncrementer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public GrpcPropertiesServerOptionBuilder newServerOption() {
return new GrpcPropertiesServerOptionBuilder();
}

@Bean("grpcAgentReceiverConfig")
public GrpcAgentDataReceiverConfiguration newAgentReceiverConfig(Environment environment) {
@Bean
public GrpcAgentDataReceiverConfiguration grpcAgentReceiverConfig(Environment environment) {
boolean enable = environment.getProperty("collector.receiver.grpc.agent.enable", boolean.class, false);

ServerOption serverOption = newServerOption().build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ public GrpcPropertiesServerOptionBuilder newServerOption() {
return new GrpcPropertiesServerOptionBuilder();
}

@Bean("grpcSpanReceiverConfig")
public GrpcSpanReceiverConfiguration newSpanReceiverConfig(Environment environment) {
@Bean
public GrpcSpanReceiverConfiguration grpcSpanReceiverConfig(Environment environment) {

boolean enable = environment.getProperty("collector.receiver.grpc.span.enable", boolean.class, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public GrpcPropertiesServerOptionBuilder newServerOption() {
}


@Bean("grpcStatReceiverConfig")
public GrpcStatReceiverConfiguration newStatReceiverConfig(
@Bean
public GrpcStatReceiverConfiguration grpcStatReceiverConfig(
Environment environment) {

boolean enable = environment.getProperty("collector.receiver.grpc.stat.enable", boolean.class, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@

@Configuration
public class HeaderServerInterceptorFactory {
@Bean("agentInterceptorList")
public List<ServerInterceptor> getAgentServerInterceptor() {
@Bean
public List<ServerInterceptor> agentInterceptorList() {
return newServerInterceptors("agent");
}

@Bean("spanInterceptorList")
public List<ServerInterceptor> getSpanServerInterceptor() {
@Bean
public List<ServerInterceptor> spanInterceptorList() {
return newServerInterceptors("span");
}

@Bean("statInterceptorList")
public List<ServerInterceptor> getStatServerInterceptor() {
@Bean
public List<ServerInterceptor> statInterceptorList() {
return newServerInterceptors("stat");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import com.navercorp.pinpoint.common.server.config.AnnotationVisitor;
import com.navercorp.pinpoint.common.server.config.LoggingEvent;
import com.navercorp.pinpoint.common.util.Assert;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -92,8 +92,8 @@ public boolean isWorkerMonitorEnable() {
return workerMonitorEnable;
}

@Bean("baseExecutorConfiguration")
public ExecutorConfiguration newExecutorConfiguration() {
@Bean
public ExecutorConfiguration baseExecutorConfiguration() {
return new ExecutorConfiguration(workerThreadSize, workerQueueSize, workerMonitorEnable);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import com.navercorp.pinpoint.common.server.config.AnnotationVisitor;
import com.navercorp.pinpoint.common.server.config.LoggingEvent;
import com.navercorp.pinpoint.common.util.Assert;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -163,8 +163,8 @@ public boolean isWorkerMonitorEnable() {
return workerMonitorEnable;
}

@Bean("spanExecutorConfiguration")
public ExecutorConfiguration newExecutorConfiguration() {
@Bean
public ExecutorConfiguration spanExecutorConfiguration() {
return new ExecutorConfiguration(workerThreadSize, workerQueueSize, workerMonitorEnable);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import com.navercorp.pinpoint.common.server.config.AnnotationVisitor;
import com.navercorp.pinpoint.common.server.config.LoggingEvent;
import com.navercorp.pinpoint.common.util.Assert;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -162,8 +162,8 @@ public boolean isWorkerMonitorEnable() {
return workerMonitorEnable;
}

@Bean("statExecutorConfiguration")
public ExecutorConfiguration newExecutorConfiguration() {
@Bean
public ExecutorConfiguration statExecutorConfiguration() {
return new ExecutorConfiguration(workerThreadSize, workerQueueSize, workerMonitorEnable);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.assertj.core.api.Assertions.assertThat;

public class HbaseApiMetaDataDaoTest {

Expand All @@ -26,7 +26,7 @@ public void testInsert() {
HbaseOperations2 mockedHbaseTemplate = mock(HbaseOperations2.class);
TableNameProvider mockedProvider = mock(TableNameProvider.class);
DistributorConfiguration givenConfiguration = new DistributorConfiguration();
RowKeyDistributorByHashPrefix givenRowKeyDistributorByHashPrefix = givenConfiguration.getMetadataRowKeyDistributor();
RowKeyDistributorByHashPrefix givenRowKeyDistributorByHashPrefix = givenConfiguration.metadataRowKeyDistributor();
HbaseApiMetaDataDao dut = new HbaseApiMetaDataDao(mockedHbaseTemplate, mockedProvider, givenRowKeyDistributorByHashPrefix);

doAnswer((invocation) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

/**
* @author Taejin Koo
Expand Down Expand Up @@ -76,22 +75,22 @@ public ZookeeperClusterConfiguration.Builder newFlinkSpanStatConfigurationBuilde
return ZookeeperClusterConfiguration.newBuilder();
}

@Bean("clusterConfiguration")
public ZookeeperClusterConfiguration newDefault(Environment environment) {
@Bean
public ZookeeperClusterConfiguration clusterConfiguration() {
ClusterEnable clusterEnable = newDefaultConfigurationEnable();
ZookeeperClusterConfiguration.Builder builder = newDefaultConfigurationBuilder();
return createConfiguration(clusterEnable, builder);
}

@Bean("flinkClusterConfiguration")
public ZookeeperClusterConfiguration newFlink(Environment environment) {
@Bean
public ZookeeperClusterConfiguration flinkClusterConfiguration() {
ClusterEnable clusterEnable = newFlinkConfigurationEnable();
ZookeeperClusterConfiguration.Builder builder = newFlinkConfigurationBuilder();
return createConfiguration(clusterEnable, builder);
}

@Bean("flinkSpanStatClusterConfiguration")
public ZookeeperClusterConfiguration newFlinkSpanStat(Environment environment) {
@Bean
public ZookeeperClusterConfiguration flinkSpanStatClusterConfiguration() {
ClusterEnable clusterEnable = newFlinkSpanStatConfigurationEnable();
ZookeeperClusterConfiguration.Builder builder = newFlinkSpanStatConfigurationBuilder();
return createConfiguration(clusterEnable, builder);
Expand All @@ -100,8 +99,7 @@ public ZookeeperClusterConfiguration newFlinkSpanStat(Environment environment) {
private ZookeeperClusterConfiguration createConfiguration(ClusterEnable clusterEnable, ZookeeperClusterConfiguration.Builder builder) {
builder.setEnable(clusterEnable.isEnable());

ZookeeperClusterConfiguration configuration = builder.build();
return configuration;
return builder.build();
}

private static class ClusterEnable {
Expand Down
Loading

0 comments on commit de29976

Please sign in to comment.