This is an automated email from the ASF dual-hosted git repository.
toulmean pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git
The following commit(s) were added to refs/heads/main by this push:
new 9828bea33 Use a config setting to set the client service name
new 0d40b4808 Merge pull request #486 from atoulme/use_service_name
9828bea33 is described below
commit 9828bea33ee8972daab3372ca674250802efe8cd
Author: Antoine Toulme <[email protected]>
AuthorDate: Wed Jan 11 00:09:50 2023 -0800
Use a config setting to set the client service name
---
.../src/main/kotlin/org/apache/tuweni/ethclient/EthereumClient.kt | 2 +-
.../main/kotlin/org/apache/tuweni/ethclient/EthereumClientConfig.kt | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git
a/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClient.kt
b/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClient.kt
index a4d5dd945..7f0fb6d19 100644
--- a/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClient.kt
+++ b/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClient.kt
@@ -107,7 +107,7 @@ class EthereumClient(
logger.info("Starting Ethereum client...")
if (config.metricsEnabled()) {
val metricsService = MetricsService(
- "tuweni",
+ config.metricsServiceName(),
port = config.metricsPort(),
networkInterface = config.metricsNetworkInterface(),
enableGrpcPush = config.metricsGrpcPushEnabled(),
diff --git
a/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClientConfig.kt
b/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClientConfig.kt
index 4602e6bb3..aead7ad2d 100644
---
a/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClientConfig.kt
+++
b/eth-client/src/main/kotlin/org/apache/tuweni/ethclient/EthereumClientConfig.kt
@@ -106,6 +106,8 @@ class EthereumClientConfig(private var config:
Configuration = Configuration.emp
fun metricsEnabled(): Boolean =
config.getConfigurationSection("metrics").getBoolean("enabled")
+ fun metricsServiceName(): String =
config.getConfigurationSection("metrics").getString("serviceName")
+
fun metricsPort(): Int =
config.getConfigurationSection("metrics").getInteger("port")
fun metricsNetworkInterface(): String =
config.getConfigurationSection("metrics").getString("networkInterface")
@@ -262,6 +264,7 @@ class EthereumClientConfig(private var config:
Configuration = Configuration.emp
metricsSection.addInteger("port", 9090, "Port to expose Prometheus
metrics", PropertyValidator.isValidPort())
metricsSection.addString("networkInterface", "0.0.0.0", "Network
interface to expose Prometheus metrics", null)
metricsSection.addBoolean("enablePrometheus", true, "Enable Prometheus
metrics reporting", null)
+ metricsSection.addString("serviceName", "tuweni", "Host service name",
null)
metricsSection.addBoolean("enableGrpcPush", true, "Enable GRPC
OpenTelemetry metrics reporting", null)
val storageSection = SchemaBuilder.create()
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]