Skip to content

Commit

Permalink
[pinpoint-apm#6156] Cleanup properties
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Nov 14, 2019
1 parent 2e813b4 commit 1c48ae5
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
@Configuration
public class SpanReceiverConfiguration implements DataReceiverGroupConfiguration {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
private final Logger logger = LoggerFactory.getLogger(SpanReceiverConfiguration.class);

@Value("${collector.receiver.span.tcp:false}")
private boolean isTcpEnable;
Expand Down
2 changes: 1 addition & 1 deletion collector/src/main/resources/hbase.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hbase.client.host=localhost
hbase.client.host=${pinpoint.zookeeper.address}
hbase.client.port=2181

# hbase default:/hbase
Expand Down
6 changes: 4 additions & 2 deletions collector/src/main/resources/pinpoint-collector.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pinpoint.zookeeper.address=localhost

# base data receiver config ---------------------------------------------------------------------
collector.receiver.base.ip=0.0.0.0
collector.receiver.base.port=9994
Expand Down Expand Up @@ -99,7 +101,7 @@ statistics.flushPeriod=1000
#2. We recommend using the cluster.web.tcp.port option. However, in cases where the collector is unable to establish connection to the web, you may reverse this and make the web establish connection to the collector.
# In this case, you must set cluster.connect.address (pinpoint-web.properties); and cluster.listen.ip, cluster.listen.port (pinpoint-collector.properties) accordingly.
cluster.enable=true
cluster.zookeeper.address=localhost
cluster.zookeeper.address=${pinpoint.zookeeper.address}
cluster.zookeeper.sessiontimeout=30000
cluster.listen.ip=
cluster.listen.port=-1
Expand All @@ -112,7 +114,7 @@ collector.spanEvent.sequence.limit=10000

# Flink configuration
flink.cluster.enable=false
flink.cluster.zookeeper.address=localhost
flink.cluster.zookeeper.address=${pinpoint.zookeeper.address}
flink.cluster.zookeeper.sessiontimeout=3000

# gRPC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@
*/
public class PropertiesVerificationTest {

private static final String LOCAL_HOST = "localhost";
private static final String HBASE_CLIENT_HOST_VALUE = "${pinpoint.zookeeper.address}";

@Test
public void checkHbasePropertiesTest() throws Exception {
Properties properties = PropertyUtils.loadPropertyFromClassPath("hbase.properties");

String clientHost = properties.getProperty("hbase.client.host");
Assert.assertEquals("localhost", clientHost);
Assert.assertEquals(HBASE_CLIENT_HOST_VALUE, clientHost);

String clientPort = properties.getProperty("hbase.client.port");
Assert.assertEquals("2181", clientPort);
Expand Down Expand Up @@ -61,11 +64,14 @@ public void checkCollectionPropertiesTest() throws Exception {
String l4Ip = properties.getProperty("collector.l4.ip");
Assert.assertTrue(StringUtils.isEmpty(l4Ip));

String pinpointZKAddress = properties.getProperty("pinpoint.zookeeper.address");
Assert.assertEquals(LOCAL_HOST, pinpointZKAddress);

String zookeeperAddress = properties.getProperty("cluster.zookeeper.address");
Assert.assertEquals("localhost", zookeeperAddress);
Assert.assertEquals(HBASE_CLIENT_HOST_VALUE, zookeeperAddress);

zookeeperAddress = properties.getProperty("flink.cluster.zookeeper.address");
Assert.assertEquals("localhost", zookeeperAddress);
Assert.assertEquals(HBASE_CLIENT_HOST_VALUE, zookeeperAddress);

String clusterListenIp = properties.getProperty("cluster.listen.ip");
Assert.assertTrue(StringUtils.isEmpty(clusterListenIp));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public LoggingEvent(Logger logger) {
public void visit(Field field, Object value) {
if (logger.isDebugEnabled()) {
final Value annotation = field.getAnnotation(Value.class);
logger.debug("{} {} @Value({}) = {}", field.getType().getSimpleName(), field.getName(), annotation.value(), value);
logger.debug("{} {} @Value(\"{}\") = {}", field.getType().getSimpleName(), field.getName(), annotation.value(), value);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion web/src/main/resources/hbase.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hbase.client.host=localhost
hbase.client.host=${pinpoint.zookeeper.address}
hbase.client.port=2181

# hbase default:/hbase
Expand Down
4 changes: 3 additions & 1 deletion web/src/main/resources/pinpoint-web.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pinpoint.zookeeper.address=localhost

# -------------------------------------------------------------------------------------------------
# The cluster related options are used to establish connections between the agent, collector, and web in order to send/receive data between them in real time.
# You may enable additional features using this option (Ex : RealTime Active Thread Chart).
Expand All @@ -13,7 +15,7 @@
# In this case, you must set cluster.connect.address (pinpoint-web.properties); and cluster.listen.ip, cluster.listen.port (pinpoint-collector.properties) accordingly.
cluster.enable=true
cluster.web.tcp.port=9997
cluster.zookeeper.address=localhost
cluster.zookeeper.address=${pinpoint.zookeeper.address}
cluster.zookeeper.sessiontimeout=30000
cluster.zookeeper.retry.interval=60000
# Option to import collector cluster data periodically to prevent data mismatch. (default enable:false, interval:10m)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@
*/
public class PropertiesVerificationTest {

private static final String LOCAL_HOST = "localhost";
private static final String HBASE_CLIENT_HOST_VALUE = "${pinpoint.zookeeper.address}";

@Test
public void checkHbasePropertiesTest() throws Exception {
Properties properties = PropertyUtils.loadPropertyFromClassPath("hbase.properties");

String clientHost = properties.getProperty("hbase.client.host");
Assert.assertEquals("localhost", clientHost);
Assert.assertEquals(HBASE_CLIENT_HOST_VALUE, clientHost);

String clientPort = properties.getProperty("hbase.client.port");
Assert.assertEquals("2181", clientPort);
Expand All @@ -43,8 +46,11 @@ public void checkHbasePropertiesTest() throws Exception {
public void checkWebPropertiesTest() throws Exception {
Properties properties = PropertyUtils.loadPropertyFromClassPath("pinpoint-web.properties");

String pinpointZKAddress = properties.getProperty("pinpoint.zookeeper.address");
Assert.assertEquals(LOCAL_HOST, pinpointZKAddress);

String zookeeperAddress = properties.getProperty("cluster.zookeeper.address");
Assert.assertEquals("localhost", zookeeperAddress);
Assert.assertEquals(HBASE_CLIENT_HOST_VALUE, zookeeperAddress);

String connectAddress = properties.getProperty("cluster.connect.address");
Assert.assertTrue(StringUtils.isEmpty(connectAddress));
Expand Down

0 comments on commit 1c48ae5

Please sign in to comment.