Permalink
Browse files

Allow d2 clients to configure http.poolStatsNamePrefix in d2.src

RB=1102528
BUG=REVIEW-6411,SI-4296
G=dmrc-reviewers,si-core-reviewers
R=ssheng,cxu
A=cxu,jaddona
  • Loading branch information...
FreCap committed Sep 15, 2017
1 parent e219ed9 commit 6e570cc96fb5664e4111661966b9e96d241b29bb
View
@@ -1,5 +1,8 @@
15.0.2
-------
(RB=1102528)
Allow d2 clients to configure http.poolStatsNamePrefix from D2 zookeeper's service config
(RB=1100491)
FilterChainCallback and RestLiCallback code refactoring.
@@ -46,6 +46,12 @@
"doc": "Maximum waiters waiting on the HTTP connection pool.",
"optional": true
},
{
"name": "poolStatsNamePrefix",
"type": "string",
"doc": "Custom prefix of the name of the pool stats.",
"optional": true
},
{
"name": "tcpNoDelay",
"type": "boolean",
@@ -117,6 +117,10 @@
{
prop.put(PropertyKeys.HTTP_POOL_MIN_SIZE, config.getMinPoolSize().toString());
}
if (config.hasPoolStatsNamePrefix())
{
prop.put(PropertyKeys.HTTP_POOL_STATS_NAME_PREFIX, config.getPoolStatsNamePrefix());
}
if (config.hasMaxConcurrentConnections())
{
prop.put(PropertyKeys.HTTP_MAX_CONCURRENT_CONNECTIONS, config.getMaxConcurrentConnections().toString());
@@ -222,6 +226,10 @@ public static D2TransportClientProperties toConfig(Map<String, Object> propertie
{
config.setMinPoolSize(coerce(properties.get(PropertyKeys.HTTP_POOL_MIN_SIZE), Integer.class));
}
if (properties.containsKey(PropertyKeys.HTTP_POOL_STATS_NAME_PREFIX))
{
config.setPoolStatsNamePrefix(coerce(properties.get(PropertyKeys.HTTP_POOL_STATS_NAME_PREFIX), String.class));
}
if (properties.containsKey(PropertyKeys.HTTP_MAX_CONCURRENT_CONNECTIONS))
{
config.setMaxConcurrentConnections(coerce(properties.get(PropertyKeys.HTTP_MAX_CONCURRENT_CONNECTIONS), Integer.class));
@@ -40,6 +40,7 @@
HTTP_USE_RESPONSE_COMPRESSION(PropertyKeys.HTTP_USE_RESPONSE_COMPRESSION),
HTTP_POOL_WAITER_SIZE(PropertyKeys.HTTP_POOL_WAITER_SIZE),
HTTP_POOL_MIN_SIZE(PropertyKeys.HTTP_POOL_MIN_SIZE),
HTTP_POOL_STATS_NAME_PREFIX(PropertyKeys.HTTP_POOL_STATS_NAME_PREFIX),
HTTP_REQUEST_CONTENT_ENCODINGS(PropertyKeys.HTTP_REQUEST_CONTENT_ENCODINGS),
HTTP_PROTOCOL_VERSION(PropertyKeys.HTTP_PROTOCOL_VERSION);
@@ -132,6 +132,7 @@
public static final String HTTP_QUERY_POST_THRESHOLD = HttpClientFactory.HTTP_QUERY_POST_THRESHOLD;
public static final String HTTP_POOL_STRATEGY = HttpClientFactory.HTTP_POOL_STRATEGY;
public static final String HTTP_POOL_MIN_SIZE = HttpClientFactory.HTTP_POOL_MIN_SIZE;
public static final String HTTP_POOL_STATS_NAME_PREFIX = HttpClientFactory.HTTP_POOL_STATS_NAME_PREFIX;
public static final String HTTP_MAX_HEADER_SIZE = HttpClientFactory.HTTP_MAX_HEADER_SIZE;
public static final String HTTP_MAX_CHUNK_SIZE = HttpClientFactory.HTTP_MAX_CHUNK_SIZE;
public static final String HTTP_MAX_CONCURRENT_CONNECTIONS = HttpClientFactory.HTTP_MAX_CONCURRENT_CONNECTIONS;
@@ -56,6 +56,7 @@ public void testTransportClientPropertiesConverter()
final Integer maxChunkSize = 4096;
final poolStrategyType poolStrategy = poolStrategyType.LRU;
final Integer minPoolSize = 5;
final String poolStatsNamePrefix = "poolStats";
final Integer maxConcurrentConnections = 1000;
final Boolean tcpNoDelay = true;
final HttpProtocolVersionType protocolVersion = HttpProtocolVersionType.HTTP_1_1;
@@ -81,6 +82,7 @@ public void testTransportClientPropertiesConverter()
transportClientProperties.put(PropertyKeys.HTTP_MAX_CHUNK_SIZE, maxChunkSize.toString());
transportClientProperties.put(PropertyKeys.HTTP_POOL_STRATEGY, poolStrategy.name());
transportClientProperties.put(PropertyKeys.HTTP_POOL_MIN_SIZE, minPoolSize.toString());
transportClientProperties.put(PropertyKeys.HTTP_POOL_STATS_NAME_PREFIX, poolStatsNamePrefix);
transportClientProperties.put(PropertyKeys.HTTP_MAX_CONCURRENT_CONNECTIONS, maxConcurrentConnections.toString());
transportClientProperties.put(PropertyKeys.HTTP_TCP_NO_DELAY, tcpNoDelay.toString());
transportClientProperties.put(PropertyKeys.HTTP_PROTOCOL_VERSION, protocolVersion.name());
@@ -105,6 +107,7 @@ public void testTransportClientPropertiesConverter()
.setMaxChunkSize(maxChunkSize)
.setPoolStrategy(poolStrategy)
.setMinPoolSize(minPoolSize)
.setPoolStatsNamePrefix(poolStatsNamePrefix)
.setMaxConcurrentConnections(maxConcurrentConnections)
.setProtocolVersion(protocolVersion)
.setTcpNoDelay(tcpNoDelay)

0 comments on commit 6e570cc

Please sign in to comment.