@@ -69,6 +69,14 @@ public Optional<Class<? extends SupplementalRoutes>> getSupplementalHttpRoutesCl
69
69
return _supplementalHttpRoutesClass ;
70
70
}
71
71
72
+ public String getMetricsClientHost () {
73
+ return _metricsClientHost ;
74
+ }
75
+
76
+ public Integer getMetricsClientPort () {
77
+ return _metricsClientPort ;
78
+ }
79
+
72
80
public Duration getJvmMetricsCollectionInterval () {
73
81
return _jvmMetricsCollectionInterval ;
74
82
}
@@ -90,6 +98,8 @@ public String toString() {
90
98
.add ("HttpStatusPath" , _httpStatusPath )
91
99
.add ("SupplementalHttpRoutesClass" , _supplementalHttpRoutesClass )
92
100
.add ("AkkaConfiguration" , _akkaConfiguration )
101
+ .add ("MetricsClientHost" , _metricsClientHost )
102
+ .add ("MetricsClientPort" , _metricsClientPort )
93
103
.add ("JvmMetricsCollectorInterval" , _jvmMetricsCollectionInterval )
94
104
.toString ();
95
105
}
@@ -103,6 +113,9 @@ private AggregatorConfiguration(final Builder builder) {
103
113
_httpHealthCheckPath = builder ._httpHealthCheckPath ;
104
114
_httpStatusPath = builder ._httpStatusPath ;
105
115
_supplementalHttpRoutesClass = Optional .ofNullable (builder ._supplementalHttpRoutesClass );
116
+ _metricsClientHost = Optional .ofNullable (builder ._metricsClientHost ).orElse (
117
+ "0.0.0.0" .equals (_httpHost ) ? "localhost" : _httpHost );
118
+ _metricsClientPort = Optional .ofNullable (builder ._metricsClientPort ).orElse (_httpPort );
106
119
_jvmMetricsCollectionInterval = builder ._jvmMetricsCollectionInterval ;
107
120
_akkaConfiguration = builder ._akkaConfiguration ;
108
121
}
@@ -115,6 +128,8 @@ private AggregatorConfiguration(final Builder builder) {
115
128
private final String _httpStatusPath ;
116
129
private final int _httpPort ;
117
130
private Optional <Class <? extends SupplementalRoutes >> _supplementalHttpRoutesClass ;
131
+ private final String _metricsClientHost ;
132
+ private final int _metricsClientPort ;
118
133
private final Duration _jvmMetricsCollectionInterval ;
119
134
private final Map <String , ?> _akkaConfiguration ;
120
135
@@ -221,6 +236,31 @@ public Builder setSupplementalHttpRoutesClass(final Class<? extends Supplemental
221
236
return this ;
222
237
}
223
238
239
+ /**
240
+ * The metrics client http host address to send to. Optional. Cannot be
241
+ * empty. Defaults to the http address unless it's 0.0.0.0 in which
242
+ * case it defaults to localhost.
243
+ *
244
+ * @param value The metrics client host address to send to.
245
+ * @return This instance of <code>Builder</code>.
246
+ */
247
+ public Builder setMetricsClientHost (final String value ) {
248
+ _metricsClientHost = value ;
249
+ return this ;
250
+ }
251
+
252
+ /**
253
+ * The metrics client http port to send to. Optional. must be between
254
+ * 1 and 65535 (inclusive). Defaults to the http port.
255
+ *
256
+ * @param value The metrics client port to listen send to.
257
+ * @return This instance of <code>Builder</code>.
258
+ */
259
+ public Builder setMetricsClientPort (final Integer value ) {
260
+ _metricsClientPort = value ;
261
+ return this ;
262
+ }
263
+
224
264
/**
225
265
* Period for collecting JVM metrics. Optional. Default is 500 milliseconds.
226
266
*
@@ -269,6 +309,10 @@ public Builder setAkkaConfiguration(final Map<String, ?> value) {
269
309
@ NotEmpty
270
310
private String _httpStatusPath = "/status" ;
271
311
private Class <? extends SupplementalRoutes > _supplementalHttpRoutesClass ;
312
+ @ NotEmpty
313
+ private String _metricsClientHost ;
314
+ @ Range (min = 1 , max = 65535 )
315
+ private Integer _metricsClientPort ;
272
316
@ NotNull
273
317
private Duration _jvmMetricsCollectionInterval = Duration .ofMillis (500 );
274
318
@ NotNull
0 commit comments