From b23fd78da272921b24ea3ca6dc3f7d8e2e04c52e Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Wed, 23 Oct 2024 00:37:26 +0200 Subject: [PATCH] Add metrics related services to the Besu context for acceptance tests (#7797) Signed-off-by: Fabio Di Fabio --- .../acceptance/dsl/node/ThreadBesuNodeRunner.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java index d4334fd93c..42c0df73c7 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java @@ -54,6 +54,7 @@ import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.cache.BonsaiCachedMer import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration; import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive; import org.hyperledger.besu.evm.internal.EvmConfiguration; +import org.hyperledger.besu.metrics.MetricCategoryRegistryImpl; import org.hyperledger.besu.metrics.MetricsSystemModule; import org.hyperledger.besu.metrics.ObservableMetricsSystem; import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration; @@ -71,6 +72,7 @@ import org.hyperledger.besu.plugin.services.StorageService; import org.hyperledger.besu.plugin.services.TransactionPoolValidatorService; import org.hyperledger.besu.plugin.services.TransactionSelectionService; import org.hyperledger.besu.plugin.services.TransactionSimulationService; +import org.hyperledger.besu.plugin.services.metrics.MetricCategoryRegistry; import org.hyperledger.besu.plugin.services.storage.rocksdb.RocksDBPlugin; import org.hyperledger.besu.services.BesuConfigurationImpl; import org.hyperledger.besu.services.BesuEventsImpl; @@ -396,6 +398,12 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner { retval.init(blockchain, transactionSimulator); return retval; } + + @Provides + @Singleton + MetricCategoryRegistryImpl provideMetricCategoryRegistry() { + return new MetricCategoryRegistryImpl(); + } } @Module @@ -476,6 +484,8 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner { final RpcEndpointServiceImpl rpcEndpointServiceImpl, final BesuConfiguration commonPluginConfiguration, final PermissioningServiceImpl permissioningService, + final MetricCategoryRegistryImpl metricCategoryRegistry, + final MetricsSystem metricsSystem, final @Named("ExtraCLIOptions") List extraCLIOptions, final @Named("RequestedPlugins") List requestedPlugins) { final CommandLine commandLine = new CommandLine(CommandSpec.create()); @@ -492,6 +502,8 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner { TransactionSimulationService.class, transactionSimulationServiceImpl); besuPluginContext.addService(BlockchainService.class, blockchainServiceImpl); besuPluginContext.addService(BesuConfiguration.class, commonPluginConfiguration); + besuPluginContext.addService(MetricCategoryRegistry.class, metricCategoryRegistry); + besuPluginContext.addService(MetricsSystem.class, metricsSystem); final Path pluginsPath; final String pluginDir = System.getProperty("besu.plugins.dir");