Skip to content

Commit

Permalink
[#3647] Prometheus based limits check uses always port 9090
Browse files Browse the repository at this point in the history
  • Loading branch information
harism authored and sophokles73 committed Jun 21, 2024
1 parent 6a05ee3 commit a4f0e2f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,14 @@ public interface PrometheusBasedResourceLimitCheckOptions {
*/
@WithDefault("1000")
int connectTimeout();

/**
* Gets the TCP port of the server that this client is configured to connect to.
* <p>
* The default value of this property is 9090.
*
* @return The port number.
*/
@WithDefault("9090")
int port();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2021 Contributors to the Eclipse Foundation
* Copyright (c) 2019 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand All @@ -10,6 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/

package org.eclipse.hono.adapter.resourcelimits;

import org.eclipse.hono.client.amqp.config.AuthenticatingClientConfigProperties;
Expand Down Expand Up @@ -68,7 +69,7 @@ public PrometheusBasedResourceLimitChecksConfig() {
*/
public PrometheusBasedResourceLimitChecksConfig(final PrometheusBasedResourceLimitCheckOptions options) {
super(options.clientOptions());
setPort(9090);
setPort(options.port());
this.cacheMaxSize = options.cacheMaxSize();
this.cacheMinSize = options.cacheMinSize();
this.cacheTimeout = options.cacheTimeout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@ void testResourceLimitCheckOptionsBinding() {
// client options
assertThat(props.isHostConfigured()).isTrue();
assertThat(props.getHost()).isEqualTo("prometheus");
assertThat(props.getPort()).isEqualTo(888);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ hono:
cacheMinSize: 5555
cacheTimeout: 555
connectTimeout: 777
host: "prometheus"
queryTimeout: 2222
host: "prometheus"
port: 888

0 comments on commit a4f0e2f

Please sign in to comment.