Skip to content

Commit 1c4c7f4

Browse files
authored
Add configuration for monitoring service. (#86)
1 parent 5f345cd commit 1c4c7f4

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/main/java/com/arpnetworking/clusteraggregator/GuiceModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private MetricsFactory provideMetricsFactory() {
152152

153153
return new TsdMetricsFactory.Builder()
154154
.setClusterName(_configuration.getMonitoringCluster())
155-
.setServiceName("cluster_aggregator")
155+
.setServiceName(_configuration.getMonitoringService())
156156
.setSinks(Collections.singletonList(sink))
157157
.build();
158158
}

src/main/java/com/arpnetworking/clusteraggregator/configuration/ClusterAggregatorConfiguration.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ public String getMonitoringCluster() {
4949
return _monitoringCluster;
5050
}
5151

52+
public String getMonitoringService() {
53+
return _monitoringService;
54+
}
55+
5256
public int getHttpPort() {
5357
return _httpPort;
5458
}
@@ -130,6 +134,7 @@ public String toString() {
130134
return MoreObjects.toStringHelper(this)
131135
.add("id", Integer.toHexString(System.identityHashCode(this)))
132136
.add("MonitoringCluster", _monitoringCluster)
137+
.add("MonitoringService", _monitoringService)
133138
.add("HttpHost", _httpHost)
134139
.add("HttpPort", _httpPort)
135140
.add("HttpHealthCheckPath", _httpHealthCheckPath)
@@ -153,6 +158,7 @@ public String toString() {
153158

154159
private ClusterAggregatorConfiguration(final Builder builder) {
155160
_monitoringCluster = builder._monitoringCluster;
161+
_monitoringService = builder._monitoringService;
156162
_httpHost = builder._httpHost;
157163
_httpPort = builder._httpPort;
158164
_httpHealthCheckPath = builder._httpHealthCheckPath;
@@ -175,6 +181,7 @@ private ClusterAggregatorConfiguration(final Builder builder) {
175181
}
176182

177183
private final String _monitoringCluster;
184+
private final String _monitoringService;
178185
private final File _logDirectory;
179186
private final String _httpHost;
180187
private final int _httpPort;
@@ -219,6 +226,18 @@ public Builder setMonitoringCluster(final String value) {
219226
return this;
220227
}
221228

229+
/**
230+
* The monitoring service. Optional. Cannot be null or empty. Default
231+
* is cluster_aggregator.
232+
*
233+
* @param value The monitoring service.
234+
* @return This instance of <code>Builder</code>.
235+
*/
236+
public Builder setMonitoringService(final String value) {
237+
_monitoringService = value;
238+
return this;
239+
}
240+
222241
/**
223242
* The http host address to bind to. Cannot be null or empty.
224243
*
@@ -446,6 +465,9 @@ public Builder setCalculateClusterAggregations(final Boolean value) {
446465
private String _monitoringCluster;
447466
@NotNull
448467
@NotEmpty
468+
private String _monitoringService = "cluster_aggregator";
469+
@NotNull
470+
@NotEmpty
449471
private String _httpHost = "0.0.0.0";
450472
@NotNull
451473
@Range(min = 1, max = 65535)

0 commit comments

Comments
 (0)