From f2a2ffc008bfb641fb225b104e70a1281c15bef2 Mon Sep 17 00:00:00 2001 From: Adrian Sutton Date: Wed, 19 Jun 2019 06:37:33 +1000 Subject: [PATCH] Rename MetricCategory to PantheonMetricCategory (#1574) Signed-off-by: Adrian Sutton --- .../chain/DefaultMutableBlockchain.java | 16 +++--- .../ethereum/eth/manager/EthPeers.java | 4 +- .../eth/manager/MonitoredExecutors.java | 14 ++--- .../eth/manager/task/AbstractEthTask.java | 4 +- .../eth/sync/DefaultSynchronizer.java | 6 +-- .../eth/sync/PipelineChainDownloader.java | 4 +- .../sync/fastsync/FastDownloaderFactory.java | 6 +-- .../eth/sync/fastsync/FastSyncActions.java | 6 +-- .../FastSyncDownloadPipelineFactory.java | 6 +-- .../FullSyncDownloadPipelineFactory.java | 4 +- .../eth/sync/worldstate/CompleteTaskStep.java | 6 +-- .../sync/worldstate/LoadLocalDataStep.java | 4 +- .../worldstate/WorldStateDownloadProcess.java | 4 +- .../sync/worldstate/WorldStateDownloader.java | 6 +-- .../eth/transactions/PendingTransactions.java | 6 +-- .../eth/transactions/TransactionPool.java | 4 +- .../ethereum/jsonrpc/JsonRpcHttpService.java | 4 +- .../subscription/SubscriptionManager.java | 6 +-- .../internal/methods/DebugMetricsTest.java | 4 +- .../discovery/VertxPeerDiscoveryAgent.java | 4 +- .../internal/DiscoveryProtocolLogger.java | 6 +-- .../internal/PeerDiscoveryController.java | 8 +-- .../ethereum/p2p/network/NetworkRunner.java | 4 +- .../pantheon/ethereum/p2p/rlpx/RlpxAgent.java | 8 +-- .../connections/PeerConnectionEvents.java | 4 +- .../p2p/rlpx/connections/netty/DeFramer.java | 4 +- .../netty/NettyConnectionInitializer.java | 6 +-- ...untLocalConfigPermissioningController.java | 8 +-- ...odeLocalConfigPermissioningController.java | 8 +-- ...eSmartContractPermissioningController.java | 8 +-- ...nSmartContractPermissioningController.java | 8 +-- .../SyncStatusNodePermissioningProvider.java | 10 ++-- ...ocalConfigPermissioningControllerTest.java | 8 +-- ...ocalConfigPermissioningControllerTest.java | 8 +-- ...rtContractPermissioningControllerTest.java | 8 +-- ...rtContractPermissioningControllerTest.java | 8 +-- ...ncStatusNodePermissioningProviderTest.java | 10 ++-- .../pantheon/metrics/MetricsSystem.java | 19 +++---- .../pegasys/pantheon/metrics/Observation.java | 6 +-- ...egory.java => PantheonMetricCategory.java} | 8 +-- .../metrics/noop/NoOpMetricsSystem.java | 10 ++-- .../prometheus/MetricsConfiguration.java | 14 ++--- .../prometheus/PrometheusMetricsSystem.java | 51 +++++++++++-------- .../metrics/vertx/PoolMetricsAdapter.java | 8 +-- .../pantheon/metrics/StubMetricsSystem.java | 8 +-- .../metrics/noop/NoOpMetricsSystemTest.java | 11 ++-- .../PrometheusMetricsSystemTest.java | 12 ++--- .../metrics/rocksdb/RocksDBStats.java | 2 +- .../pegasys/pantheon/cli/PantheonCommand.java | 6 +-- .../pantheon/cli/PantheonCommandTest.java | 6 +-- .../kvstore/RocksDbKeyValueStorage.java | 14 ++--- 51 files changed, 215 insertions(+), 202 deletions(-) rename metrics/core/src/main/java/tech/pegasys/pantheon/metrics/{MetricCategory.java => PantheonMetricCategory.java} (86%) diff --git a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/chain/DefaultMutableBlockchain.java b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/chain/DefaultMutableBlockchain.java index 653f1da391..01fd200e0c 100644 --- a/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/chain/DefaultMutableBlockchain.java +++ b/ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/chain/DefaultMutableBlockchain.java @@ -23,8 +23,8 @@ import tech.pegasys.pantheon.ethereum.core.BlockHeader; import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.ethereum.core.Transaction; import tech.pegasys.pantheon.ethereum.core.TransactionReceipt; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.InvalidConfigurationException; import tech.pegasys.pantheon.util.Subscribers; import tech.pegasys.pantheon.util.bytes.BytesValues; @@ -69,12 +69,12 @@ public class DefaultMutableBlockchain implements MutableBlockchain { chainHeadOmmerCount = chainHeadBody.getOmmers().size(); metricsSystem.createLongGauge( - MetricCategory.BLOCKCHAIN, + PantheonMetricCategory.BLOCKCHAIN, "height", "Height of the chainhead", this::getChainHeadBlockNumber); metricsSystem.createLongGauge( - MetricCategory.BLOCKCHAIN, + PantheonMetricCategory.BLOCKCHAIN, "difficulty_total", "Total difficulty of the chainhead", () -> @@ -82,31 +82,31 @@ public class DefaultMutableBlockchain implements MutableBlockchain { .longValue()); metricsSystem.createLongGauge( - MetricCategory.BLOCKCHAIN, + PantheonMetricCategory.BLOCKCHAIN, "chain_head_timestamp", "Timestamp from the current chain head", () -> getChainHeadHeader().getTimestamp()); metricsSystem.createLongGauge( - MetricCategory.BLOCKCHAIN, + PantheonMetricCategory.BLOCKCHAIN, "chain_head_gas_used", "Gas used by the current chain head block", () -> getChainHeadHeader().getGasUsed()); metricsSystem.createLongGauge( - MetricCategory.BLOCKCHAIN, + PantheonMetricCategory.BLOCKCHAIN, "chain_head_gas_limit", "Block gas limit of the current chain head block", () -> getChainHeadHeader().getGasLimit()); metricsSystem.createIntegerGauge( - MetricCategory.BLOCKCHAIN, + PantheonMetricCategory.BLOCKCHAIN, "chain_head_transaction_count", "Number of transactions in the current chain head block", () -> chainHeadTransactionCount); metricsSystem.createIntegerGauge( - MetricCategory.BLOCKCHAIN, + PantheonMetricCategory.BLOCKCHAIN, "chain_head_ommer_count", "Number of ommers in the current chain head block", () -> chainHeadOmmerCount); diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/EthPeers.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/EthPeers.java index ccab17b472..64dc22b618 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/EthPeers.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/EthPeers.java @@ -14,8 +14,8 @@ package tech.pegasys.pantheon.ethereum.eth.manager; import tech.pegasys.pantheon.ethereum.eth.manager.EthPeer.DisconnectCallback; import tech.pegasys.pantheon.ethereum.p2p.rlpx.connections.PeerConnection; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.Subscribers; import java.time.Clock; @@ -53,7 +53,7 @@ public class EthPeers { this.protocolName = protocolName; this.clock = clock; metricsSystem.createIntegerGauge( - MetricCategory.PEERS, + PantheonMetricCategory.PEERS, "pending_peer_requests_current", "Number of peer requests currently pending because peers are busy", pendingRequests::size); diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/MonitoredExecutors.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/MonitoredExecutors.java index b13deea9b3..8a5f0cf91b 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/MonitoredExecutors.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/MonitoredExecutors.java @@ -13,8 +13,8 @@ package tech.pegasys.pantheon.ethereum.eth.manager; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import java.util.Locale; import java.util.concurrent.ExecutorService; @@ -87,31 +87,31 @@ public class MonitoredExecutors { new ThreadFactoryBuilder().setNameFormat(name + "-%d").build()); metricsSystem.createIntegerGauge( - MetricCategory.EXECUTORS, + PantheonMetricCategory.EXECUTORS, metricName + "_queue_length_current", "Current number of tasks awaiting execution", executor.getQueue()::size); metricsSystem.createIntegerGauge( - MetricCategory.EXECUTORS, + PantheonMetricCategory.EXECUTORS, metricName + "_active_threads_current", "Current number of threads executing tasks", executor::getActiveCount); metricsSystem.createIntegerGauge( - MetricCategory.EXECUTORS, + PantheonMetricCategory.EXECUTORS, metricName + "_pool_size_current", "Current number of threads in the thread pool", executor::getPoolSize); metricsSystem.createLongGauge( - MetricCategory.EXECUTORS, + PantheonMetricCategory.EXECUTORS, metricName + "_completed_tasks_total", "Total number of tasks executed", executor::getCompletedTaskCount); metricsSystem.createLongGauge( - MetricCategory.EXECUTORS, + PantheonMetricCategory.EXECUTORS, metricName + "_submitted_tasks_total", "Total number of tasks executed", executor::getTaskCount); @@ -126,7 +126,7 @@ public class MonitoredExecutors { public CountingAbortPolicy(final String metricName, final MetricsSystem metricsSystem) { this.rejectedTaskCounter = metricsSystem.createCounter( - MetricCategory.EXECUTORS, + PantheonMetricCategory.EXECUTORS, metricName + "_rejected_tasks_total", "Total number of tasks rejected by this executor"); } diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/task/AbstractEthTask.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/task/AbstractEthTask.java index 27ceb21d55..dc4315dc71 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/task/AbstractEthTask.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/task/AbstractEthTask.java @@ -16,9 +16,9 @@ import static tech.pegasys.pantheon.util.FutureUtils.completedExceptionally; import tech.pegasys.pantheon.ethereum.eth.manager.EthScheduler; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; import tech.pegasys.pantheon.metrics.OperationTimer; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.metrics.noop.NoOpMetricsSystem; import java.util.Collection; @@ -50,7 +50,7 @@ public abstract class AbstractEthTask implements EthTask { private static OperationTimer buildOperationTimer(final MetricsSystem metricsSystem) { final LabelledMetric ethTasksTimer = metricsSystem.createLabelledTimer( - MetricCategory.SYNCHRONIZER, "task", "Internal processing tasks", "taskName"); + PantheonMetricCategory.SYNCHRONIZER, "task", "Internal processing tasks", "taskName"); if (ethTasksTimer == NoOpMetricsSystem.NO_OP_LABELLED_1_OPERATION_TIMER) { return () -> new OperationTimer.TimingContext() { diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/DefaultSynchronizer.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/DefaultSynchronizer.java index dc5f44c870..83b3cf9e41 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/DefaultSynchronizer.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/DefaultSynchronizer.java @@ -27,8 +27,8 @@ import tech.pegasys.pantheon.ethereum.eth.sync.state.PendingBlocks; import tech.pegasys.pantheon.ethereum.eth.sync.state.SyncState; import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSchedule; import tech.pegasys.pantheon.ethereum.worldstate.WorldStateStorage; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.ExceptionUtils; import tech.pegasys.pantheon.util.Subscribers; @@ -98,12 +98,12 @@ public class DefaultSynchronizer implements Synchronizer { clock); metricsSystem.createLongGauge( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "best_known_block", "Height of best known block from any connected peer", () -> syncState.syncStatus().getHighestBlock()); metricsSystem.createIntegerGauge( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "in_sync", "Whether or not the local node has caught up to the best known peer", () -> getSyncStatus().isPresent() ? 0 : 1); diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/PipelineChainDownloader.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/PipelineChainDownloader.java index 5036097e00..6e1cc4379c 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/PipelineChainDownloader.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/PipelineChainDownloader.java @@ -23,8 +23,8 @@ import tech.pegasys.pantheon.ethereum.eth.sync.state.SyncTarget; import tech.pegasys.pantheon.ethereum.eth.sync.tasks.exceptions.InvalidBlockException; import tech.pegasys.pantheon.metrics.Counter; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.services.pipeline.Pipeline; import tech.pegasys.pantheon.util.ExceptionUtils; @@ -65,7 +65,7 @@ public class PipelineChainDownloader implements ChainDownloader { final LabelledMetric labelledCounter = metricsSystem.createLabelledCounter( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "chain_download_pipeline_restarts", "Number of times the chain download pipeline has been restarted", "reason"); diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastDownloaderFactory.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastDownloaderFactory.java index 054972f6b6..c4a32901f7 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastDownloaderFactory.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastDownloaderFactory.java @@ -23,8 +23,8 @@ import tech.pegasys.pantheon.ethereum.eth.sync.worldstate.WorldStateDownloader; import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSchedule; import tech.pegasys.pantheon.ethereum.mainnet.ScheduleBasedBlockHeaderFunctions; import tech.pegasys.pantheon.ethereum.worldstate.WorldStateStorage; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.services.tasks.CachingTaskCollection; import tech.pegasys.pantheon.services.tasks.FlatFileTaskCollection; @@ -123,13 +123,13 @@ public class FastDownloaderFactory { dataDirectory, NodeDataRequest::serialize, NodeDataRequest::deserialize)); metricsSystem.createLongGauge( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "world_state_pending_requests_current", "Number of pending requests for fast sync world state download", taskCollection::size); metricsSystem.createIntegerGauge( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "world_state_pending_requests_cache_size", "Pending request cache size for fast sync world state download", taskCollection::cacheSize); diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActions.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActions.java index 2bd3971f83..1efd7550d6 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActions.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActions.java @@ -26,8 +26,8 @@ import tech.pegasys.pantheon.ethereum.eth.sync.SynchronizerConfiguration; import tech.pegasys.pantheon.ethereum.eth.sync.state.SyncState; import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSchedule; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.ExceptionUtils; import java.time.Duration; @@ -66,11 +66,11 @@ public class FastSyncActions { pivotBlockSelectionCounter = metricsSystem.createCounter( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "fast_sync_pivot_block_selected_count", "Number of times a fast sync pivot block has been selected"); metricsSystem.createLongGauge( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "fast_sync_pivot_block_current", "The current fast sync pivot block", pivotBlockGauge::get); diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java index 81a3b7a54e..3f119eb571 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java @@ -34,8 +34,8 @@ import tech.pegasys.pantheon.ethereum.eth.sync.state.SyncTarget; import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSchedule; import tech.pegasys.pantheon.metrics.Counter; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.services.pipeline.Pipeline; import tech.pegasys.pantheon.services.pipeline.PipelineBuilder; @@ -67,7 +67,7 @@ public class FastSyncDownloadPipelineFactory implements DownloadPipelineFacto this.metricsSystem = metricsSystem; final LabelledMetric fastSyncValidationCounter = metricsSystem.createLabelledCounter( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "fast_sync_validation_mode", "Number of blocks validated using light vs full validation during fast sync", "validationMode"); @@ -130,7 +130,7 @@ public class FastSyncDownloadPipelineFactory implements DownloadPipelineFacto checkpointRangeSource, downloaderParallelism, metricsSystem.createLabelledCounter( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "chain_download_pipeline_processed_total", "Number of entries process by each chain download pipeline stage", "step", diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fullsync/FullSyncDownloadPipelineFactory.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fullsync/FullSyncDownloadPipelineFactory.java index 8f047e4c10..fd93395e59 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fullsync/FullSyncDownloadPipelineFactory.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fullsync/FullSyncDownloadPipelineFactory.java @@ -27,8 +27,8 @@ import tech.pegasys.pantheon.ethereum.eth.sync.ValidationPolicy; import tech.pegasys.pantheon.ethereum.eth.sync.state.SyncTarget; import tech.pegasys.pantheon.ethereum.mainnet.HeaderValidationMode; import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSchedule; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.services.pipeline.Pipeline; import tech.pegasys.pantheon.services.pipeline.PipelineBuilder; @@ -95,7 +95,7 @@ public class FullSyncDownloadPipelineFactory implements DownloadPipelineFacto checkpointRangeSource, downloaderParallelism, metricsSystem.createLabelledCounter( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "chain_download_pipeline_processed_total", "Number of entries process by each chain download pipeline stage", "step", diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/CompleteTaskStep.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/CompleteTaskStep.java index 0ec1635d59..78edf25b9d 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/CompleteTaskStep.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/CompleteTaskStep.java @@ -15,8 +15,8 @@ package tech.pegasys.pantheon.ethereum.eth.sync.worldstate; import tech.pegasys.pantheon.ethereum.core.BlockHeader; import tech.pegasys.pantheon.ethereum.worldstate.WorldStateStorage; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.services.tasks.Task; public class CompleteTaskStep { @@ -31,12 +31,12 @@ public class CompleteTaskStep { completedRequestsCounter = metricsSystem.createCounter( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "world_state_completed_requests_total", "Total number of node data requests completed as part of fast sync world state download"); retriedRequestsCounter = metricsSystem.createCounter( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "world_state_retried_requests_total", "Total number of node data requests repeated as part of fast sync world state download"); } diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/LoadLocalDataStep.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/LoadLocalDataStep.java index 7c7651f0b9..f89a6737b8 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/LoadLocalDataStep.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/LoadLocalDataStep.java @@ -14,8 +14,8 @@ package tech.pegasys.pantheon.ethereum.eth.sync.worldstate; import tech.pegasys.pantheon.ethereum.worldstate.WorldStateStorage; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.services.pipeline.Pipe; import tech.pegasys.pantheon.services.tasks.Task; import tech.pegasys.pantheon.util.bytes.BytesValue; @@ -33,7 +33,7 @@ public class LoadLocalDataStep { this.worldStateStorage = worldStateStorage; existingNodeCounter = metricsSystem.createCounter( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "world_state_existing_nodes_total", "Total number of node data requests completed using existing data"); } diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/WorldStateDownloadProcess.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/WorldStateDownloadProcess.java index 52da694bc9..9aa49ea242 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/WorldStateDownloadProcess.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/WorldStateDownloadProcess.java @@ -19,8 +19,8 @@ import tech.pegasys.pantheon.ethereum.core.BlockHeader; import tech.pegasys.pantheon.ethereum.eth.manager.EthScheduler; import tech.pegasys.pantheon.metrics.Counter; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.services.pipeline.Pipe; import tech.pegasys.pantheon.services.pipeline.Pipeline; import tech.pegasys.pantheon.services.pipeline.PipelineBuilder; @@ -196,7 +196,7 @@ public class WorldStateDownloadProcess { final int bufferCapacity = hashCountPerRequest * 2; final LabelledMetric outputCounter = metricsSystem.createLabelledCounter( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "world_state_pipeline_processed_total", "Number of entries processed by each world state download pipeline stage", "step", diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/WorldStateDownloader.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/WorldStateDownloader.java index 21186e723f..c0f171962b 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/WorldStateDownloader.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/WorldStateDownloader.java @@ -16,8 +16,8 @@ import tech.pegasys.pantheon.ethereum.core.BlockHeader; import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.ethereum.eth.manager.EthContext; import tech.pegasys.pantheon.ethereum.worldstate.WorldStateStorage; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.services.tasks.CachingTaskCollection; import java.time.Clock; @@ -66,13 +66,13 @@ public class WorldStateDownloader { this.metricsSystem = metricsSystem; metricsSystem.createIntegerGauge( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "world_state_node_requests_since_last_progress_current", "Number of world state requests made since the last time new data was returned", downloadStateValue(WorldDownloadState::getRequestsSinceLastProgress)); metricsSystem.createIntegerGauge( - MetricCategory.SYNCHRONIZER, + PantheonMetricCategory.SYNCHRONIZER, "world_state_inflight_requests_current", "Number of in progress requests for world state data", downloadStateValue(WorldDownloadState::getOutstandingTaskCount)); diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/transactions/PendingTransactions.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/transactions/PendingTransactions.java index 3779c3f3bf..31e052a0ce 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/transactions/PendingTransactions.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/transactions/PendingTransactions.java @@ -20,8 +20,8 @@ import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.ethereum.core.Transaction; import tech.pegasys.pantheon.metrics.Counter; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.Subscribers; import java.time.Clock; @@ -87,7 +87,7 @@ public class PendingTransactions { this.clock = clock; final LabelledMetric transactionAddedCounter = metricsSystem.createLabelledCounter( - MetricCategory.TRANSACTION_POOL, + PantheonMetricCategory.TRANSACTION_POOL, "transactions_added_total", "Count of transactions added to the transaction pool", "source"); @@ -96,7 +96,7 @@ public class PendingTransactions { transactionRemovedCounter = metricsSystem.createLabelledCounter( - MetricCategory.TRANSACTION_POOL, + PantheonMetricCategory.TRANSACTION_POOL, "transactions_removed_total", "Count of transactions removed from the transaction pool", "source", diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/transactions/TransactionPool.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/transactions/TransactionPool.java index 2ba6ad4d7e..2ae54830a7 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/transactions/TransactionPool.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/transactions/TransactionPool.java @@ -34,8 +34,8 @@ import tech.pegasys.pantheon.ethereum.mainnet.TransactionValidator.TransactionIn import tech.pegasys.pantheon.ethereum.mainnet.ValidationResult; import tech.pegasys.pantheon.metrics.Counter; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import java.util.Collection; import java.util.HashSet; @@ -83,7 +83,7 @@ public class TransactionPool implements BlockAddedObserver { duplicateTransactionCounter = metricsSystem.createLabelledCounter( - MetricCategory.TRANSACTION_POOL, + PantheonMetricCategory.TRANSACTION_POOL, "transactions_duplicates_total", "Total number of duplicate transactions received", "source"); diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java index d39cfd5492..08c3942649 100755 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java @@ -31,10 +31,10 @@ import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponseType; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcUnauthorizedResponse; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; import tech.pegasys.pantheon.metrics.OperationTimer; import tech.pegasys.pantheon.metrics.OperationTimer.TimingContext; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.NetworkUtility; import java.net.InetSocketAddress; @@ -122,7 +122,7 @@ public class JsonRpcHttpService { this.dataDir = dataDir; requestTimer = metricsSystem.createLabelledTimer( - MetricCategory.RPC, + PantheonMetricCategory.RPC, "request_time", "Time taken to process a JSON-RPC request", "methodName"); diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/subscription/SubscriptionManager.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/subscription/SubscriptionManager.java index 879672eb31..debf7b690a 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/subscription/SubscriptionManager.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/subscription/SubscriptionManager.java @@ -19,8 +19,8 @@ import tech.pegasys.pantheon.ethereum.jsonrpc.websocket.subscription.request.Uns import tech.pegasys.pantheon.ethereum.jsonrpc.websocket.subscription.response.SubscriptionResponse; import tech.pegasys.pantheon.metrics.Counter; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import java.util.List; import java.util.Map; @@ -55,13 +55,13 @@ public class SubscriptionManager extends AbstractVerticle { public SubscriptionManager(final MetricsSystem metricsSystem) { subscribeCounter = metricsSystem.createLabelledCounter( - MetricCategory.RPC, + PantheonMetricCategory.RPC, "subscription_subscribe_total", "Total number of subscriptions", "type"); unsubscribeCounter = metricsSystem.createLabelledCounter( - MetricCategory.RPC, + PantheonMetricCategory.RPC, "subscription_unsubscribe_total", "Total number of unsubscriptions", "type"); diff --git a/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugMetricsTest.java b/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugMetricsTest.java index ed4f209349..474436e7a7 100644 --- a/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugMetricsTest.java +++ b/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugMetricsTest.java @@ -16,8 +16,8 @@ import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import static tech.pegasys.pantheon.metrics.MetricCategory.PEERS; -import static tech.pegasys.pantheon.metrics.MetricCategory.RPC; +import static tech.pegasys.pantheon.metrics.PantheonMetricCategory.PEERS; +import static tech.pegasys.pantheon.metrics.PantheonMetricCategory.RPC; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; diff --git a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/VertxPeerDiscoveryAgent.java b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/VertxPeerDiscoveryAgent.java index 200e27c9b0..6562b6a28d 100644 --- a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/VertxPeerDiscoveryAgent.java +++ b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/VertxPeerDiscoveryAgent.java @@ -22,8 +22,8 @@ import tech.pegasys.pantheon.ethereum.p2p.discovery.internal.PeerDiscoveryContro import tech.pegasys.pantheon.ethereum.p2p.discovery.internal.TimerUtil; import tech.pegasys.pantheon.ethereum.p2p.discovery.internal.VertxTimerUtil; import tech.pegasys.pantheon.ethereum.p2p.permissions.PeerPermissions; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.NetworkUtility; import java.io.IOException; @@ -64,7 +64,7 @@ public class VertxPeerDiscoveryAgent extends PeerDiscoveryAgent { this.vertx = vertx; metricsSystem.createIntegerGauge( - MetricCategory.NETWORK, + PantheonMetricCategory.NETWORK, "vertx_eventloop_pending_tasks", "The number of pending tasks in the Vertx event loop", pendingTaskCounter(vertx.nettyEventLoopGroup())); diff --git a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/DiscoveryProtocolLogger.java b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/DiscoveryProtocolLogger.java index e7e0e087b7..4bd66b07c7 100644 --- a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/DiscoveryProtocolLogger.java +++ b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/DiscoveryProtocolLogger.java @@ -15,8 +15,8 @@ package tech.pegasys.pantheon.ethereum.p2p.discovery.internal; import tech.pegasys.pantheon.ethereum.p2p.peers.Peer; import tech.pegasys.pantheon.metrics.Counter; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -30,13 +30,13 @@ public class DiscoveryProtocolLogger { public DiscoveryProtocolLogger(final MetricsSystem metricsSystem) { outgoingMessageCounter = metricsSystem.createLabelledCounter( - MetricCategory.NETWORK, + PantheonMetricCategory.NETWORK, "discovery_messages_outbound", "Total number of P2P discovery messages sent", "name"); incomingMessageCounter = metricsSystem.createLabelledCounter( - MetricCategory.NETWORK, + PantheonMetricCategory.NETWORK, "discovery_messages_inbound", "Total number of P2P discovery messages received", "name"); diff --git a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PeerDiscoveryController.java b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PeerDiscoveryController.java index 52db816755..38f869d27c 100644 --- a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PeerDiscoveryController.java +++ b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PeerDiscoveryController.java @@ -30,8 +30,8 @@ import tech.pegasys.pantheon.ethereum.p2p.peers.PeerId; import tech.pegasys.pantheon.ethereum.p2p.permissions.PeerPermissions; import tech.pegasys.pantheon.metrics.Counter; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.Subscribers; import tech.pegasys.pantheon.util.bytes.BytesValue; @@ -172,21 +172,21 @@ public class PeerDiscoveryController { this.peerPermissions = new PeerDiscoveryPermissions(localPeer, peerPermissions); metricsSystem.createIntegerGauge( - MetricCategory.NETWORK, + PantheonMetricCategory.NETWORK, "discovery_inflight_interactions_current", "Current number of inflight discovery interactions", inflightInteractions::size); interactionCounter = metricsSystem.createLabelledCounter( - MetricCategory.NETWORK, + PantheonMetricCategory.NETWORK, "discovery_interaction_count", "Total number of discovery interactions initiated", "type"); interactionRetryCounter = metricsSystem.createLabelledCounter( - MetricCategory.NETWORK, + PantheonMetricCategory.NETWORK, "discovery_interaction_retry_count", "Total number of interaction retries performed", "type"); diff --git a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/network/NetworkRunner.java b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/network/NetworkRunner.java index 28205fb04f..936952705d 100644 --- a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/network/NetworkRunner.java +++ b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/network/NetworkRunner.java @@ -17,8 +17,8 @@ import tech.pegasys.pantheon.ethereum.p2p.rlpx.wire.SubProtocol; import tech.pegasys.pantheon.ethereum.p2p.rlpx.wire.messages.DisconnectMessage.DisconnectReason; import tech.pegasys.pantheon.metrics.Counter; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import java.util.ArrayList; import java.util.Arrays; @@ -55,7 +55,7 @@ public class NetworkRunner implements AutoCloseable { this.subProtocols = subProtocols; inboundMessageCounter = metricsSystem.createLabelledCounter( - MetricCategory.NETWORK, + PantheonMetricCategory.NETWORK, "p2p_messages_inbound", "Count of each P2P message received inbound.", "protocol", diff --git a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/RlpxAgent.java b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/RlpxAgent.java index 6de371fc79..4826f4a91e 100644 --- a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/RlpxAgent.java +++ b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/RlpxAgent.java @@ -33,8 +33,8 @@ import tech.pegasys.pantheon.ethereum.p2p.rlpx.connections.netty.NettyConnection import tech.pegasys.pantheon.ethereum.p2p.rlpx.wire.Capability; import tech.pegasys.pantheon.ethereum.p2p.rlpx.wire.messages.DisconnectMessage.DisconnectReason; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.FutureUtils; import tech.pegasys.pantheon.util.Subscribers; import tech.pegasys.pantheon.util.bytes.BytesValue; @@ -90,15 +90,15 @@ public class RlpxAgent { // Setup metrics connectedPeersCounter = metricsSystem.createCounter( - MetricCategory.PEERS, "connected_total", "Total number of peers connected"); + PantheonMetricCategory.PEERS, "connected_total", "Total number of peers connected"); metricsSystem.createGauge( - MetricCategory.PEERS, + PantheonMetricCategory.PEERS, "peer_count_current", "Number of peers currently connected", () -> (double) getConnectionCount()); metricsSystem.createIntegerGauge( - MetricCategory.NETWORK, + PantheonMetricCategory.NETWORK, "peers_limit", "Maximum P2P peer connections that can be established", () -> maxPeers); diff --git a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/connections/PeerConnectionEvents.java b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/connections/PeerConnectionEvents.java index e92ed815c5..1fff9ac1d4 100644 --- a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/connections/PeerConnectionEvents.java +++ b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/connections/PeerConnectionEvents.java @@ -21,8 +21,8 @@ import tech.pegasys.pantheon.ethereum.p2p.rlpx.wire.MessageData; import tech.pegasys.pantheon.ethereum.p2p.rlpx.wire.messages.DisconnectMessage.DisconnectReason; import tech.pegasys.pantheon.metrics.Counter; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.Subscribers; import java.util.Map; @@ -37,7 +37,7 @@ public class PeerConnectionEvents implements PeerConnectionEventDispatcher { public PeerConnectionEvents(final MetricsSystem metricsSystem) { disconnectCounter = metricsSystem.createLabelledCounter( - MetricCategory.PEERS, + PantheonMetricCategory.PEERS, "disconnected_total", "Total number of peers disconnected", "initiator", diff --git a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/connections/netty/DeFramer.java b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/connections/netty/DeFramer.java index 1c6b23f48d..60f9dddd8c 100644 --- a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/connections/netty/DeFramer.java +++ b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/connections/netty/DeFramer.java @@ -35,8 +35,8 @@ import tech.pegasys.pantheon.ethereum.p2p.rlpx.wire.messages.WireMessageCodes; import tech.pegasys.pantheon.ethereum.rlp.RLPException; import tech.pegasys.pantheon.metrics.Counter; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import java.io.IOException; import java.net.InetSocketAddress; @@ -86,7 +86,7 @@ final class DeFramer extends ByteToMessageDecoder { this.connectionEventDispatcher = connectionEventDispatcher; this.outboundMessagesCounter = metricsSystem.createLabelledCounter( - MetricCategory.NETWORK, + PantheonMetricCategory.NETWORK, "p2p_messages_outbound", "Count of each P2P message sent outbound.", "protocol", diff --git a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/connections/netty/NettyConnectionInitializer.java b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/connections/netty/NettyConnectionInitializer.java index e361a7204b..a86ff6a525 100644 --- a/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/connections/netty/NettyConnectionInitializer.java +++ b/ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/connections/netty/NettyConnectionInitializer.java @@ -24,8 +24,8 @@ import tech.pegasys.pantheon.ethereum.p2p.rlpx.ConnectCallback; import tech.pegasys.pantheon.ethereum.p2p.rlpx.connections.ConnectionInitializer; import tech.pegasys.pantheon.ethereum.p2p.rlpx.connections.PeerConnection; import tech.pegasys.pantheon.ethereum.p2p.rlpx.connections.PeerConnectionEventDispatcher; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.Subscribers; import java.net.InetSocketAddress; @@ -80,13 +80,13 @@ public class NettyConnectionInitializer implements ConnectionInitializer { this.metricsSystem = metricsSystem; metricsSystem.createIntegerGauge( - MetricCategory.NETWORK, + PantheonMetricCategory.NETWORK, "netty_workers_pending_tasks", "The number of pending tasks in the Netty workers event loop", pendingTaskCounter(workers)); metricsSystem.createIntegerGauge( - MetricCategory.NETWORK, + PantheonMetricCategory.NETWORK, "netty_boss_pending_tasks", "The number of pending tasks in the Netty boss event loop", pendingTaskCounter(boss)); diff --git a/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/AccountLocalConfigPermissioningController.java b/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/AccountLocalConfigPermissioningController.java index 6a3657877d..deca839301 100644 --- a/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/AccountLocalConfigPermissioningController.java +++ b/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/AccountLocalConfigPermissioningController.java @@ -17,8 +17,8 @@ import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.ethereum.core.Transaction; import tech.pegasys.pantheon.ethereum.permissioning.account.TransactionPermissioningProvider; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.bytes.BytesValue; import java.io.IOException; @@ -62,17 +62,17 @@ public class AccountLocalConfigPermissioningController implements TransactionPer readAccountsFromConfig(configuration); this.checkCounter = metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "account_local_check_count", "Number of times the account local permissioning provider has been checked"); this.checkCounterPermitted = metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "account_local_check_count_permitted", "Number of times the account local permissioning provider has been checked and returned permitted"); this.checkCounterUnpermitted = metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "account_local_check_count_unpermitted", "Number of times the account local permissioning provider has been checked and returned unpermitted"); } diff --git a/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/NodeLocalConfigPermissioningController.java b/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/NodeLocalConfigPermissioningController.java index 3a4bf90ce7..367441d218 100644 --- a/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/NodeLocalConfigPermissioningController.java +++ b/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/NodeLocalConfigPermissioningController.java @@ -16,8 +16,8 @@ import tech.pegasys.pantheon.ethereum.p2p.peers.EnodeURL; import tech.pegasys.pantheon.ethereum.permissioning.node.NodePermissioningProvider; import tech.pegasys.pantheon.ethereum.permissioning.node.NodeWhitelistUpdatedEvent; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.Subscribers; import tech.pegasys.pantheon.util.bytes.BytesValue; @@ -80,17 +80,17 @@ public class NodeLocalConfigPermissioningController implements NodePermissioning this.checkCounter = metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "node_local_check_count", "Number of times the node local permissioning provider has been checked"); this.checkCounterPermitted = metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "node_local_check_count_permitted", "Number of times the node local permissioning provider has been checked and returned permitted"); this.checkCounterUnpermitted = metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "node_local_check_count_unpermitted", "Number of times the node local permissioning provider has been checked and returned unpermitted"); } diff --git a/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/NodeSmartContractPermissioningController.java b/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/NodeSmartContractPermissioningController.java index 8d2c0546cd..01ad0d5f0d 100644 --- a/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/NodeSmartContractPermissioningController.java +++ b/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/NodeSmartContractPermissioningController.java @@ -22,8 +22,8 @@ import tech.pegasys.pantheon.ethereum.transaction.CallParameter; import tech.pegasys.pantheon.ethereum.transaction.TransactionSimulator; import tech.pegasys.pantheon.ethereum.transaction.TransactionSimulatorResult; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.bytes.BytesValue; import tech.pegasys.pantheon.util.bytes.BytesValues; @@ -77,17 +77,17 @@ public class NodeSmartContractPermissioningController implements NodePermissioni this.checkCounter = metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "node_smart_contract_check_count", "Number of times the node smart contract permissioning provider has been checked"); this.checkCounterPermitted = metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "node_smart_contract_check_count_permitted", "Number of times the node smart contract permissioning provider has been checked and returned permitted"); this.checkCounterUnpermitted = metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "node_smart_contract_check_count_unpermitted", "Number of times the node smart contract permissioning provider has been checked and returned unpermitted"); } diff --git a/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/TransactionSmartContractPermissioningController.java b/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/TransactionSmartContractPermissioningController.java index d360578d4e..5853311b95 100644 --- a/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/TransactionSmartContractPermissioningController.java +++ b/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/TransactionSmartContractPermissioningController.java @@ -23,8 +23,8 @@ import tech.pegasys.pantheon.ethereum.transaction.CallParameter; import tech.pegasys.pantheon.ethereum.transaction.TransactionSimulator; import tech.pegasys.pantheon.ethereum.transaction.TransactionSimulatorResult; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.bytes.BytesValue; import tech.pegasys.pantheon.util.bytes.BytesValues; @@ -84,17 +84,17 @@ public class TransactionSmartContractPermissioningController this.checkCounter = metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "transaction_smart_contract_check_count", "Number of times the transaction smart contract permissioning provider has been checked"); this.checkCounterPermitted = metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "transaction_smart_contract_check_count_permitted", "Number of times the transaction smart contract permissioning provider has been checked and returned permitted"); this.checkCounterUnpermitted = metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "transaction_smart_contract_check_count_unpermitted", "Number of times the transaction smart contract permissioning provider has been checked and returned unpermitted"); } diff --git a/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/node/provider/SyncStatusNodePermissioningProvider.java b/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/node/provider/SyncStatusNodePermissioningProvider.java index 4034b0dfd3..f4e56f4616 100644 --- a/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/node/provider/SyncStatusNodePermissioningProvider.java +++ b/ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/node/provider/SyncStatusNodePermissioningProvider.java @@ -19,8 +19,8 @@ import tech.pegasys.pantheon.ethereum.core.Synchronizer; import tech.pegasys.pantheon.ethereum.p2p.peers.EnodeURL; import tech.pegasys.pantheon.ethereum.permissioning.node.NodePermissioningProvider; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import java.util.Collection; import java.util.HashSet; @@ -47,23 +47,23 @@ public class SyncStatusNodePermissioningProvider implements NodePermissioningPro this.fixedNodes.addAll(fixedNodes); metricsSystem.createIntegerGauge( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "sync_status_node_sync_reached", "Whether the sync status permissioning provider has realised sync yet", () -> hasReachedSync ? 1 : 0); this.checkCounter = metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "sync_status_node_check_count", "Number of times the sync status permissioning provider has been checked"); this.checkCounterPermitted = metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "sync_status_node_check_count_permitted", "Number of times the sync status permissioning provider has been checked and returned permitted"); this.checkCounterUnpermitted = metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "sync_status_node_check_count_unpermitted", "Number of times the sync status permissioning provider has been checked and returned unpermitted"); } diff --git a/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/AccountLocalConfigPermissioningControllerTest.java b/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/AccountLocalConfigPermissioningControllerTest.java index c0bfb7154c..991ad85d92 100644 --- a/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/AccountLocalConfigPermissioningControllerTest.java +++ b/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/AccountLocalConfigPermissioningControllerTest.java @@ -26,8 +26,8 @@ import static org.mockito.Mockito.when; import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.ethereum.core.Transaction; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import java.io.IOException; import java.nio.charset.StandardCharsets; @@ -58,19 +58,19 @@ public class AccountLocalConfigPermissioningControllerTest { public void before() { when(metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "account_local_check_count", "Number of times the account local permissioning provider has been checked")) .thenReturn(checkCounter); when(metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "account_local_check_count_permitted", "Number of times the account local permissioning provider has been checked and returned permitted")) .thenReturn(checkPermittedCounter); when(metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "account_local_check_count_unpermitted", "Number of times the account local permissioning provider has been checked and returned unpermitted")) .thenReturn(checkUnpermittedCounter); diff --git a/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/NodeLocalConfigPermissioningControllerTest.java b/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/NodeLocalConfigPermissioningControllerTest.java index 98389c4406..79297a755d 100644 --- a/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/NodeLocalConfigPermissioningControllerTest.java +++ b/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/NodeLocalConfigPermissioningControllerTest.java @@ -29,8 +29,8 @@ import static tech.pegasys.pantheon.ethereum.permissioning.NodeLocalConfigPermis import tech.pegasys.pantheon.ethereum.p2p.peers.EnodeURL; import tech.pegasys.pantheon.ethereum.permissioning.node.NodeWhitelistUpdatedEvent; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import java.io.IOException; import java.net.URI; @@ -74,19 +74,19 @@ public class NodeLocalConfigPermissioningControllerTest { bootnodesList.clear(); when(metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "node_local_check_count", "Number of times the node local permissioning provider has been checked")) .thenReturn(checkCounter); when(metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "node_local_check_count_permitted", "Number of times the node local permissioning provider has been checked and returned permitted")) .thenReturn(checkPermittedCounter); when(metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "node_local_check_count_unpermitted", "Number of times the node local permissioning provider has been checked and returned unpermitted")) .thenReturn(checkUnpermittedCounter); diff --git a/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/NodeSmartContractPermissioningControllerTest.java b/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/NodeSmartContractPermissioningControllerTest.java index 366cfda343..cb2a1c81a9 100644 --- a/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/NodeSmartContractPermissioningControllerTest.java +++ b/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/NodeSmartContractPermissioningControllerTest.java @@ -31,8 +31,8 @@ import tech.pegasys.pantheon.ethereum.p2p.peers.EnodeURL; import tech.pegasys.pantheon.ethereum.transaction.TransactionSimulator; import tech.pegasys.pantheon.ethereum.worldstate.WorldStateArchive; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import java.io.IOException; @@ -68,19 +68,19 @@ public class NodeSmartContractPermissioningControllerTest { final Address contractAddress = Address.fromHexString(contractAddressString); when(metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "node_smart_contract_check_count", "Number of times the node smart contract permissioning provider has been checked")) .thenReturn(checkCounter); when(metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "node_smart_contract_check_count_permitted", "Number of times the node smart contract permissioning provider has been checked and returned permitted")) .thenReturn(checkPermittedCounter); when(metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "node_smart_contract_check_count_unpermitted", "Number of times the node smart contract permissioning provider has been checked and returned unpermitted")) .thenReturn(checkUnpermittedCounter); diff --git a/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/TransactionSmartContractPermissioningControllerTest.java b/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/TransactionSmartContractPermissioningControllerTest.java index 9fe0053d4a..7d83df8375 100644 --- a/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/TransactionSmartContractPermissioningControllerTest.java +++ b/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/TransactionSmartContractPermissioningControllerTest.java @@ -33,8 +33,8 @@ import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSchedule; import tech.pegasys.pantheon.ethereum.transaction.TransactionSimulator; import tech.pegasys.pantheon.ethereum.worldstate.WorldStateArchive; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.util.bytes.BytesValue; import java.io.IOException; @@ -72,19 +72,19 @@ public class TransactionSmartContractPermissioningControllerTest { final Address contractAddress = Address.fromHexString(contractAddressString); when(metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "transaction_smart_contract_check_count", "Number of times the transaction smart contract permissioning provider has been checked")) .thenReturn(checkCounter); when(metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "transaction_smart_contract_check_count_permitted", "Number of times the transaction smart contract permissioning provider has been checked and returned permitted")) .thenReturn(checkPermittedCounter); when(metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "transaction_smart_contract_check_count_unpermitted", "Number of times the transaction smart contract permissioning provider has been checked and returned unpermitted")) .thenReturn(checkUnpermittedCounter); diff --git a/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/node/provider/SyncStatusNodePermissioningProviderTest.java b/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/node/provider/SyncStatusNodePermissioningProviderTest.java index fd3b119536..6de0adee51 100644 --- a/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/node/provider/SyncStatusNodePermissioningProviderTest.java +++ b/ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/node/provider/SyncStatusNodePermissioningProviderTest.java @@ -24,8 +24,8 @@ import tech.pegasys.pantheon.ethereum.core.Synchronizer; import tech.pegasys.pantheon.ethereum.core.Synchronizer.SyncStatusListener; import tech.pegasys.pantheon.ethereum.p2p.peers.EnodeURL; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import java.util.ArrayList; import java.util.Collection; @@ -74,17 +74,17 @@ public class SyncStatusNodePermissioningProviderTest { ArgumentCaptor.forClass(IntSupplier.class); when(metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "sync_status_node_check_count", "Number of times the sync status permissioning provider has been checked")) .thenReturn(checkCounter); when(metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "sync_status_node_check_count_permitted", "Number of times the sync status permissioning provider has been checked and returned permitted")) .thenReturn(checkPermittedCounter); when(metricsSystem.createCounter( - MetricCategory.PERMISSIONING, + PantheonMetricCategory.PERMISSIONING, "sync_status_node_check_count_unpermitted", "Number of times the sync status permissioning provider has been checked and returned unpermitted")) .thenReturn(checkUnpermittedCounter); @@ -92,7 +92,7 @@ public class SyncStatusNodePermissioningProviderTest { this.syncStatusListener = captor.getValue(); verify(metricsSystem) .createIntegerGauge( - eq(MetricCategory.PERMISSIONING), + eq(PantheonMetricCategory.PERMISSIONING), eq("sync_status_node_sync_reached"), eq("Whether the sync status permissioning provider has realised sync yet"), syncGaugeCallbackCaptor.capture()); diff --git a/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/MetricsSystem.java b/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/MetricsSystem.java index b444af6a32..0efe0cf3d3 100644 --- a/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/MetricsSystem.java +++ b/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/MetricsSystem.java @@ -20,25 +20,26 @@ import java.util.stream.Stream; public interface MetricsSystem { default Counter createCounter( - final MetricCategory category, final String name, final String help) { + final PantheonMetricCategory category, final String name, final String help) { return createLabelledCounter(category, name, help, new String[0]).labels(); } LabelledMetric createLabelledCounter( - MetricCategory category, String name, String help, String... labelNames); + PantheonMetricCategory category, String name, String help, String... labelNames); default OperationTimer createTimer( - final MetricCategory category, final String name, final String help) { + final PantheonMetricCategory category, final String name, final String help) { return createLabelledTimer(category, name, help, new String[0]).labels(); } LabelledMetric createLabelledTimer( - MetricCategory category, String name, String help, String... labelNames); + PantheonMetricCategory category, String name, String help, String... labelNames); - void createGauge(MetricCategory category, String name, String help, DoubleSupplier valueSupplier); + void createGauge( + PantheonMetricCategory category, String name, String help, DoubleSupplier valueSupplier); default void createIntegerGauge( - final MetricCategory category, + final PantheonMetricCategory category, final String name, final String help, final IntSupplier valueSupplier) { @@ -46,16 +47,16 @@ public interface MetricsSystem { } default void createLongGauge( - final MetricCategory category, + final PantheonMetricCategory category, final String name, final String help, final LongSupplier valueSupplier) { createGauge(category, name, help, () -> (double) valueSupplier.getAsLong()); } - Stream streamObservations(MetricCategory category); + Stream streamObservations(PantheonMetricCategory category); default Stream streamObservations() { - return Stream.of(MetricCategory.values()).flatMap(this::streamObservations); + return Stream.of(PantheonMetricCategory.values()).flatMap(this::streamObservations); } } diff --git a/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/Observation.java b/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/Observation.java index 6fe1efd9c1..2385b18d96 100644 --- a/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/Observation.java +++ b/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/Observation.java @@ -18,13 +18,13 @@ import java.util.Objects; import com.google.common.base.MoreObjects; public class Observation { - private final MetricCategory category; + private final PantheonMetricCategory category; private final String metricName; private final List labels; private final Object value; public Observation( - final MetricCategory category, + final PantheonMetricCategory category, final String metricName, final Object value, final List labels) { @@ -34,7 +34,7 @@ public class Observation { this.labels = labels; } - public MetricCategory getCategory() { + public PantheonMetricCategory getCategory() { return category; } diff --git a/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/MetricCategory.java b/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/PantheonMetricCategory.java similarity index 86% rename from metrics/core/src/main/java/tech/pegasys/pantheon/metrics/MetricCategory.java rename to metrics/core/src/main/java/tech/pegasys/pantheon/metrics/PantheonMetricCategory.java index f203b0b03c..fb5e6fa686 100644 --- a/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/MetricCategory.java +++ b/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/PantheonMetricCategory.java @@ -15,7 +15,7 @@ package tech.pegasys.pantheon.metrics; import java.util.EnumSet; import java.util.Set; -public enum MetricCategory { +public enum PantheonMetricCategory { BIG_QUEUE("big_queue"), BLOCKCHAIN("blockchain"), EXECUTORS("executors"), @@ -31,17 +31,17 @@ public enum MetricCategory { TRANSACTION_POOL("transaction_pool"); // Why not BIG_QUEUE and ROCKSDB? They hurt performance under load. - public static final Set DEFAULT_METRIC_CATEGORIES = + public static final Set DEFAULT_METRIC_CATEGORIES = EnumSet.complementOf(EnumSet.of(BIG_QUEUE, KVSTORE_ROCKSDB, KVSTORE_ROCKSDB_STATS)); private final String name; private final boolean pantheonSpecific; - MetricCategory(final String name) { + PantheonMetricCategory(final String name) { this(name, true); } - MetricCategory(final String name, final boolean pantheonSpecific) { + PantheonMetricCategory(final String name, final boolean pantheonSpecific) { this.name = name; this.pantheonSpecific = pantheonSpecific; } diff --git a/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/noop/NoOpMetricsSystem.java b/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/noop/NoOpMetricsSystem.java index e478e093f6..19dbc361e1 100644 --- a/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/noop/NoOpMetricsSystem.java +++ b/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/noop/NoOpMetricsSystem.java @@ -14,11 +14,11 @@ package tech.pegasys.pantheon.metrics.noop; import tech.pegasys.pantheon.metrics.Counter; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; import tech.pegasys.pantheon.metrics.Observation; import tech.pegasys.pantheon.metrics.OperationTimer; import tech.pegasys.pantheon.metrics.OperationTimer.TimingContext; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import java.util.function.DoubleSupplier; import java.util.stream.Stream; @@ -42,7 +42,7 @@ public class NoOpMetricsSystem implements MetricsSystem { @Override public LabelledMetric createLabelledCounter( - final MetricCategory category, + final PantheonMetricCategory category, final String name, final String help, final String... labelNames) { @@ -64,7 +64,7 @@ public class NoOpMetricsSystem implements MetricsSystem { @Override public LabelledMetric createLabelledTimer( - final MetricCategory category, + final PantheonMetricCategory category, final String name, final String help, final String... labelNames) { @@ -82,13 +82,13 @@ public class NoOpMetricsSystem implements MetricsSystem { @Override public void createGauge( - final MetricCategory category, + final PantheonMetricCategory category, final String name, final String help, final DoubleSupplier valueSupplier) {} @Override - public Stream streamObservations(final MetricCategory category) { + public Stream streamObservations(final PantheonMetricCategory category) { return Stream.empty(); } diff --git a/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/prometheus/MetricsConfiguration.java b/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/prometheus/MetricsConfiguration.java index cfee72626f..b9de976fc9 100644 --- a/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/prometheus/MetricsConfiguration.java +++ b/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/prometheus/MetricsConfiguration.java @@ -12,9 +12,9 @@ */ package tech.pegasys.pantheon.metrics.prometheus; -import static tech.pegasys.pantheon.metrics.MetricCategory.DEFAULT_METRIC_CATEGORIES; +import static tech.pegasys.pantheon.metrics.PantheonMetricCategory.DEFAULT_METRIC_CATEGORIES; -import tech.pegasys.pantheon.metrics.MetricCategory; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import java.util.Arrays; import java.util.Collection; @@ -35,7 +35,7 @@ public class MetricsConfiguration { private final boolean enabled; private final int port; private final String host; - private final Set metricCategories; + private final Set metricCategories; private final boolean pushEnabled; private final int pushPort; private final String pushHost; @@ -51,7 +51,7 @@ public class MetricsConfiguration { final boolean enabled, final int port, final String host, - final Set metricCategories, + final Set metricCategories, final boolean pushEnabled, final int pushPort, final String pushHost, @@ -82,7 +82,7 @@ public class MetricsConfiguration { return host; } - public Set getMetricCategories() { + public Set getMetricCategories() { return metricCategories; } @@ -166,7 +166,7 @@ public class MetricsConfiguration { private boolean enabled = false; private int port = DEFAULT_METRICS_PORT; private String host = DEFAULT_METRICS_HOST; - private Set metricCategories = DEFAULT_METRIC_CATEGORIES; + private Set metricCategories = DEFAULT_METRIC_CATEGORIES; private boolean pushEnabled = false; private int pushPort = DEFAULT_METRICS_PUSH_PORT; private String pushHost = DEFAULT_METRICS_PUSH_HOST; @@ -191,7 +191,7 @@ public class MetricsConfiguration { return this; } - public Builder metricCategories(final Set metricCategories) { + public Builder metricCategories(final Set metricCategories) { this.metricCategories = metricCategories; return this; } diff --git a/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/prometheus/PrometheusMetricsSystem.java b/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/prometheus/PrometheusMetricsSystem.java index d4f58dc5f0..4f2a6101fa 100644 --- a/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/prometheus/PrometheusMetricsSystem.java +++ b/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/prometheus/PrometheusMetricsSystem.java @@ -16,10 +16,10 @@ import static java.util.Arrays.asList; import static java.util.Collections.singleton; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; import tech.pegasys.pantheon.metrics.Observation; import tech.pegasys.pantheon.metrics.OperationTimer; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.metrics.noop.NoOpMetricsSystem; import java.util.ArrayList; @@ -49,14 +49,16 @@ import io.prometheus.client.hotspot.ThreadExports; public class PrometheusMetricsSystem implements MetricsSystem { private static final String PANTHEON_PREFIX = "pantheon_"; - private final Map> collectors = new ConcurrentHashMap<>(); + private final Map> collectors = + new ConcurrentHashMap<>(); private final CollectorRegistry registry = new CollectorRegistry(true); private final Map> cachedCounters = new ConcurrentHashMap<>(); private final Map> cachedTimers = new ConcurrentHashMap<>(); - private final EnumSet enabledCategories = EnumSet.allOf(MetricCategory.class); + private final EnumSet enabledCategories = + EnumSet.allOf(PantheonMetricCategory.class); PrometheusMetricsSystem() {} @@ -66,14 +68,14 @@ public class PrometheusMetricsSystem implements MetricsSystem { } final PrometheusMetricsSystem metricsSystem = new PrometheusMetricsSystem(); metricsSystem.enabledCategories.retainAll(metricsConfiguration.getMetricCategories()); - if (metricsSystem.enabledCategories.contains(MetricCategory.PROCESS)) { + if (metricsSystem.enabledCategories.contains(PantheonMetricCategory.PROCESS)) { metricsSystem.collectors.put( - MetricCategory.PROCESS, + PantheonMetricCategory.PROCESS, singleton(new StandardExports().register(metricsSystem.registry))); } - if (metricsSystem.enabledCategories.contains(MetricCategory.JVM)) { + if (metricsSystem.enabledCategories.contains(PantheonMetricCategory.JVM)) { metricsSystem.collectors.put( - MetricCategory.JVM, + PantheonMetricCategory.JVM, asList( new MemoryPoolsExports().register(metricsSystem.registry), new BufferPoolsExports().register(metricsSystem.registry), @@ -86,7 +88,7 @@ public class PrometheusMetricsSystem implements MetricsSystem { @Override public LabelledMetric createLabelledCounter( - final MetricCategory category, + final PantheonMetricCategory category, final String name, final String help, final String... labelNames) { @@ -106,7 +108,7 @@ public class PrometheusMetricsSystem implements MetricsSystem { @Override public LabelledMetric createLabelledTimer( - final MetricCategory category, + final PantheonMetricCategory category, final String name, final String help, final String... labelNames) { @@ -135,7 +137,7 @@ public class PrometheusMetricsSystem implements MetricsSystem { @Override public void createGauge( - final MetricCategory category, + final PantheonMetricCategory category, final String name, final String help, final DoubleSupplier valueSupplier) { @@ -146,13 +148,14 @@ public class PrometheusMetricsSystem implements MetricsSystem { } } - public void addCollector(final MetricCategory category, final Collector metric) { + public void addCollector(final PantheonMetricCategory category, final Collector metric) { if (enabledCategories.contains(category)) { addCollectorUnchecked(category, metric); } } - private void addCollectorUnchecked(final MetricCategory category, final Collector metric) { + private void addCollectorUnchecked( + final PantheonMetricCategory category, final Collector metric) { metric.register(registry); collectors .computeIfAbsent(category, key -> Collections.newSetFromMap(new ConcurrentHashMap<>())) @@ -160,20 +163,22 @@ public class PrometheusMetricsSystem implements MetricsSystem { } @Override - public Stream streamObservations(final MetricCategory category) { + public Stream streamObservations(final PantheonMetricCategory category) { return collectors.getOrDefault(category, Collections.emptySet()).stream() .flatMap(collector -> collector.collect().stream()) .flatMap(familySamples -> convertSamplesToObservations(category, familySamples)); } private Stream convertSamplesToObservations( - final MetricCategory category, final MetricFamilySamples familySamples) { + final PantheonMetricCategory category, final MetricFamilySamples familySamples) { return familySamples.samples.stream() .map(sample -> createObservationFromSample(category, sample, familySamples)); } private Observation createObservationFromSample( - final MetricCategory category, final Sample sample, final MetricFamilySamples familySamples) { + final PantheonMetricCategory category, + final Sample sample, + final MetricFamilySamples familySamples) { if (familySamples.type == Type.HISTOGRAM) { return convertHistogramSampleNamesToLabels(category, sample, familySamples); } @@ -188,7 +193,9 @@ public class PrometheusMetricsSystem implements MetricsSystem { } private Observation convertHistogramSampleNamesToLabels( - final MetricCategory category, final Sample sample, final MetricFamilySamples familySamples) { + final PantheonMetricCategory category, + final Sample sample, + final MetricFamilySamples familySamples) { final List labelValues = new ArrayList<>(sample.labelValues); if (sample.name.endsWith("_bucket")) { labelValues.add(labelValues.size() - 1, "bucket"); @@ -203,7 +210,9 @@ public class PrometheusMetricsSystem implements MetricsSystem { } private Observation convertSummarySampleNamesToLabels( - final MetricCategory category, final Sample sample, final MetricFamilySamples familySamples) { + final PantheonMetricCategory category, + final Sample sample, + final MetricFamilySamples familySamples) { final List labelValues = new ArrayList<>(sample.labelValues); if (sample.name.endsWith("_sum")) { labelValues.add("sum"); @@ -219,16 +228,18 @@ public class PrometheusMetricsSystem implements MetricsSystem { labelValues); } - public static String convertToPrometheusName(final MetricCategory category, final String name) { + public static String convertToPrometheusName( + final PantheonMetricCategory category, final String name) { return prometheusPrefix(category) + name; } - private String convertFromPrometheusName(final MetricCategory category, final String metricName) { + private String convertFromPrometheusName( + final PantheonMetricCategory category, final String metricName) { final String prefix = prometheusPrefix(category); return metricName.startsWith(prefix) ? metricName.substring(prefix.length()) : metricName; } - private static String prometheusPrefix(final MetricCategory category) { + private static String prometheusPrefix(final PantheonMetricCategory category) { return category.isPantheonSpecific() ? PANTHEON_PREFIX + category.getName() + "_" : category.getName() + "_"; diff --git a/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/vertx/PoolMetricsAdapter.java b/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/vertx/PoolMetricsAdapter.java index 9fb778da96..5e8486c356 100644 --- a/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/vertx/PoolMetricsAdapter.java +++ b/metrics/core/src/main/java/tech/pegasys/pantheon/metrics/vertx/PoolMetricsAdapter.java @@ -13,8 +13,8 @@ package tech.pegasys.pantheon.metrics.vertx; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import io.vertx.core.spi.metrics.PoolMetrics; @@ -29,7 +29,7 @@ final class PoolMetricsAdapter implements PoolMetrics { submittedCounter = metricsSystem .createLabelledCounter( - MetricCategory.NETWORK, + PantheonMetricCategory.NETWORK, "vertx_worker_pool_submitted_total", "Total number of tasks submitted to the Vertx worker pool", "poolType", @@ -39,7 +39,7 @@ final class PoolMetricsAdapter implements PoolMetrics { completedCounter = metricsSystem .createLabelledCounter( - MetricCategory.NETWORK, + PantheonMetricCategory.NETWORK, "vertx_worker_pool_completed_total", "Total number of tasks completed by the Vertx worker pool", "poolType", @@ -49,7 +49,7 @@ final class PoolMetricsAdapter implements PoolMetrics { rejectedCounter = metricsSystem .createLabelledCounter( - MetricCategory.NETWORK, + PantheonMetricCategory.NETWORK, "vertx_worker_pool_rejected_total", "Total number of tasks rejected by the Vertx worker pool", "poolType", diff --git a/metrics/core/src/test-support/java/tech/pegasys/pantheon/metrics/StubMetricsSystem.java b/metrics/core/src/test-support/java/tech/pegasys/pantheon/metrics/StubMetricsSystem.java index 23b9fa8544..468af9d951 100644 --- a/metrics/core/src/test-support/java/tech/pegasys/pantheon/metrics/StubMetricsSystem.java +++ b/metrics/core/src/test-support/java/tech/pegasys/pantheon/metrics/StubMetricsSystem.java @@ -29,7 +29,7 @@ public class StubMetricsSystem implements MetricsSystem { @Override public LabelledMetric createLabelledCounter( - final MetricCategory category, + final PantheonMetricCategory category, final String name, final String help, final String... labelNames) { @@ -50,7 +50,7 @@ public class StubMetricsSystem implements MetricsSystem { @Override public LabelledMetric createLabelledTimer( - final MetricCategory category, + final PantheonMetricCategory category, final String name, final String help, final String... labelNames) { @@ -59,7 +59,7 @@ public class StubMetricsSystem implements MetricsSystem { @Override public void createGauge( - final MetricCategory category, + final PantheonMetricCategory category, final String name, final String help, final DoubleSupplier valueSupplier) { @@ -75,7 +75,7 @@ public class StubMetricsSystem implements MetricsSystem { } @Override - public Stream streamObservations(final MetricCategory category) { + public Stream streamObservations(final PantheonMetricCategory category) { throw new UnsupportedOperationException("Observations aren't actually recorded"); } diff --git a/metrics/core/src/test/java/tech/pegasys/pantheon/metrics/noop/NoOpMetricsSystemTest.java b/metrics/core/src/test/java/tech/pegasys/pantheon/metrics/noop/NoOpMetricsSystemTest.java index e35497ad23..098fb67147 100644 --- a/metrics/core/src/test/java/tech/pegasys/pantheon/metrics/noop/NoOpMetricsSystemTest.java +++ b/metrics/core/src/test/java/tech/pegasys/pantheon/metrics/noop/NoOpMetricsSystemTest.java @@ -17,9 +17,9 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import tech.pegasys.pantheon.metrics.Counter; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; import tech.pegasys.pantheon.metrics.OperationTimer; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import org.junit.Test; @@ -30,7 +30,8 @@ public class NoOpMetricsSystemTest { @Test public void labelCountsMatchOnCounter() { final LabelledMetric labeledCounter = - metricsSystem.createLabelledCounter(MetricCategory.PROCESS, "name", "help", "label1"); + metricsSystem.createLabelledCounter( + PantheonMetricCategory.PROCESS, "name", "help", "label1"); assertThat(labeledCounter.labels("one")).isSameAs(NoOpMetricsSystem.NO_OP_COUNTER); } @@ -38,7 +39,7 @@ public class NoOpMetricsSystemTest { public void failsWheLabelCountsDoNotMatchOnCounter() { final LabelledMetric labeledCounter = metricsSystem.createLabelledCounter( - MetricCategory.PROCESS, "name", "help", "label1", "label2"); + PantheonMetricCategory.PROCESS, "name", "help", "label1", "label2"); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> labeledCounter.labels("one")) @@ -51,7 +52,7 @@ public class NoOpMetricsSystemTest { @Test public void labelCountsMatchOnTimer() { final LabelledMetric labeledTimer = - metricsSystem.createLabelledTimer(MetricCategory.PROCESS, "name", "help", "label1"); + metricsSystem.createLabelledTimer(PantheonMetricCategory.PROCESS, "name", "help", "label1"); assertThat(labeledTimer.labels("one")).isSameAs(NoOpMetricsSystem.NO_OP_OPERATION_TIMER); } @@ -59,7 +60,7 @@ public class NoOpMetricsSystemTest { public void failsWheLabelCountsDoNotMatchOnTimer() { final LabelledMetric labeledTimer = metricsSystem.createLabelledTimer( - MetricCategory.PROCESS, "name", "help", "label1", "label2"); + PantheonMetricCategory.PROCESS, "name", "help", "label1", "label2"); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> labeledTimer.labels("one")) diff --git a/metrics/core/src/test/java/tech/pegasys/pantheon/metrics/prometheus/PrometheusMetricsSystemTest.java b/metrics/core/src/test/java/tech/pegasys/pantheon/metrics/prometheus/PrometheusMetricsSystemTest.java index 57e264f9bb..b40e9a78d2 100644 --- a/metrics/core/src/test/java/tech/pegasys/pantheon/metrics/prometheus/PrometheusMetricsSystemTest.java +++ b/metrics/core/src/test/java/tech/pegasys/pantheon/metrics/prometheus/PrometheusMetricsSystemTest.java @@ -17,18 +17,18 @@ import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static tech.pegasys.pantheon.metrics.MetricCategory.JVM; -import static tech.pegasys.pantheon.metrics.MetricCategory.NETWORK; -import static tech.pegasys.pantheon.metrics.MetricCategory.PEERS; -import static tech.pegasys.pantheon.metrics.MetricCategory.RPC; +import static tech.pegasys.pantheon.metrics.PantheonMetricCategory.JVM; +import static tech.pegasys.pantheon.metrics.PantheonMetricCategory.NETWORK; +import static tech.pegasys.pantheon.metrics.PantheonMetricCategory.PEERS; +import static tech.pegasys.pantheon.metrics.PantheonMetricCategory.RPC; import tech.pegasys.pantheon.metrics.Counter; import tech.pegasys.pantheon.metrics.LabelledMetric; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; import tech.pegasys.pantheon.metrics.Observation; import tech.pegasys.pantheon.metrics.OperationTimer; import tech.pegasys.pantheon.metrics.OperationTimer.TimingContext; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.metrics.noop.NoOpMetricsSystem; import java.util.Comparator; @@ -175,7 +175,7 @@ public class PrometheusMetricsSystemTest { public void shouldOnlyObserveEnabledMetrics() { final MetricsConfiguration metricsConfiguration = MetricsConfiguration.builder() - .metricCategories(EnumSet.of(MetricCategory.RPC)) + .metricCategories(EnumSet.of(PantheonMetricCategory.RPC)) .enabled(true) .build(); final MetricsSystem localMetricSystem = PrometheusMetricsSystem.init(metricsConfiguration); diff --git a/metrics/rocksdb/src/main/java/tech/pegasys/pantheon/metrics/rocksdb/RocksDBStats.java b/metrics/rocksdb/src/main/java/tech/pegasys/pantheon/metrics/rocksdb/RocksDBStats.java index 9853b366cd..58316d87bd 100644 --- a/metrics/rocksdb/src/main/java/tech/pegasys/pantheon/metrics/rocksdb/RocksDBStats.java +++ b/metrics/rocksdb/src/main/java/tech/pegasys/pantheon/metrics/rocksdb/RocksDBStats.java @@ -12,7 +12,7 @@ */ package tech.pegasys.pantheon.metrics.rocksdb; -import static tech.pegasys.pantheon.metrics.MetricCategory.KVSTORE_ROCKSDB_STATS; +import static tech.pegasys.pantheon.metrics.PantheonMetricCategory.KVSTORE_ROCKSDB_STATS; import tech.pegasys.pantheon.metrics.prometheus.PrometheusMetricsSystem; diff --git a/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java b/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java index e4da69421e..7d002e65c3 100644 --- a/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java +++ b/pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java @@ -24,7 +24,7 @@ import static tech.pegasys.pantheon.ethereum.graphql.GraphQLConfiguration.DEFAUL import static tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcConfiguration.DEFAULT_JSON_RPC_PORT; import static tech.pegasys.pantheon.ethereum.jsonrpc.RpcApis.DEFAULT_JSON_RPC_APIS; import static tech.pegasys.pantheon.ethereum.jsonrpc.websocket.WebSocketConfiguration.DEFAULT_WEBSOCKET_PORT; -import static tech.pegasys.pantheon.metrics.MetricCategory.DEFAULT_METRIC_CATEGORIES; +import static tech.pegasys.pantheon.metrics.PantheonMetricCategory.DEFAULT_METRIC_CATEGORIES; import static tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration.DEFAULT_METRICS_PORT; import static tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration.DEFAULT_METRICS_PUSH_PORT; @@ -61,8 +61,8 @@ import tech.pegasys.pantheon.ethereum.permissioning.LocalPermissioningConfigurat import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration; import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfigurationBuilder; import tech.pegasys.pantheon.ethereum.permissioning.SmartContractPermissioningConfiguration; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration; import tech.pegasys.pantheon.metrics.prometheus.PrometheusMetricsSystem; import tech.pegasys.pantheon.metrics.vertx.VertxMetricsAdapterFactory; @@ -412,7 +412,7 @@ public class PantheonCommand implements DefaultCommandValues, Runnable { arity = "1..*", description = "Comma separated list of categories to track metrics for (default: ${DEFAULT-VALUE})") - private final Set metricCategories = DEFAULT_METRIC_CATEGORIES; + private final Set metricCategories = DEFAULT_METRIC_CATEGORIES; @Option( names = {"--metrics-push-enabled"}, diff --git a/pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java b/pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java index fdf8b3ec1c..c9bbcc9242 100644 --- a/pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java +++ b/pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java @@ -49,7 +49,7 @@ import tech.pegasys.pantheon.ethereum.p2p.peers.EnodeURL; import tech.pegasys.pantheon.ethereum.permissioning.LocalPermissioningConfiguration; import tech.pegasys.pantheon.ethereum.permissioning.PermissioningConfiguration; import tech.pegasys.pantheon.ethereum.permissioning.SmartContractPermissioningConfiguration; -import tech.pegasys.pantheon.metrics.MetricCategory; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration; import tech.pegasys.pantheon.util.bytes.BytesValue; @@ -2054,13 +2054,13 @@ public class PantheonCommandTest extends CommandTestAbstract { @Test public void metricsCategoryPropertyMustBeUsed() { - parseCommand("--metrics-enabled", "--metrics-category", MetricCategory.JVM.toString()); + parseCommand("--metrics-enabled", "--metrics-category", PantheonMetricCategory.JVM.toString()); verify(mockRunnerBuilder).metricsConfiguration(metricsConfigArgumentCaptor.capture()); verify(mockRunnerBuilder).build(); assertThat(metricsConfigArgumentCaptor.getValue().getMetricCategories()) - .containsExactly(MetricCategory.JVM); + .containsExactly(PantheonMetricCategory.JVM); assertThat(commandOutput.toString()).isEmpty(); assertThat(commandErrorOutput.toString()).isEmpty(); diff --git a/services/kvstore/src/main/java/tech/pegasys/pantheon/services/kvstore/RocksDbKeyValueStorage.java b/services/kvstore/src/main/java/tech/pegasys/pantheon/services/kvstore/RocksDbKeyValueStorage.java index a16a1fb5cd..3f8124b54c 100644 --- a/services/kvstore/src/main/java/tech/pegasys/pantheon/services/kvstore/RocksDbKeyValueStorage.java +++ b/services/kvstore/src/main/java/tech/pegasys/pantheon/services/kvstore/RocksDbKeyValueStorage.java @@ -13,9 +13,9 @@ package tech.pegasys.pantheon.services.kvstore; import tech.pegasys.pantheon.metrics.Counter; -import tech.pegasys.pantheon.metrics.MetricCategory; import tech.pegasys.pantheon.metrics.MetricsSystem; import tech.pegasys.pantheon.metrics.OperationTimer; +import tech.pegasys.pantheon.metrics.PantheonMetricCategory; import tech.pegasys.pantheon.metrics.prometheus.PrometheusMetricsSystem; import tech.pegasys.pantheon.metrics.rocksdb.RocksDBStats; import tech.pegasys.pantheon.services.util.RocksDbUtil; @@ -76,7 +76,7 @@ public class RocksDbKeyValueStorage implements KeyValueStorage, Closeable { readLatency = metricsSystem .createLabelledTimer( - MetricCategory.KVSTORE_ROCKSDB, + PantheonMetricCategory.KVSTORE_ROCKSDB, "read_latency_seconds", "Latency for read from RocksDB.", "database") @@ -84,7 +84,7 @@ public class RocksDbKeyValueStorage implements KeyValueStorage, Closeable { removeLatency = metricsSystem .createLabelledTimer( - MetricCategory.KVSTORE_ROCKSDB, + PantheonMetricCategory.KVSTORE_ROCKSDB, "remove_latency_seconds", "Latency of remove requests from RocksDB.", "database") @@ -92,7 +92,7 @@ public class RocksDbKeyValueStorage implements KeyValueStorage, Closeable { writeLatency = metricsSystem .createLabelledTimer( - MetricCategory.KVSTORE_ROCKSDB, + PantheonMetricCategory.KVSTORE_ROCKSDB, "write_latency_seconds", "Latency for write to RocksDB.", "database") @@ -100,7 +100,7 @@ public class RocksDbKeyValueStorage implements KeyValueStorage, Closeable { commitLatency = metricsSystem .createLabelledTimer( - MetricCategory.KVSTORE_ROCKSDB, + PantheonMetricCategory.KVSTORE_ROCKSDB, "commit_latency_seconds", "Latency for commits to RocksDB.", "database") @@ -111,7 +111,7 @@ public class RocksDbKeyValueStorage implements KeyValueStorage, Closeable { } metricsSystem.createLongGauge( - MetricCategory.KVSTORE_ROCKSDB, + PantheonMetricCategory.KVSTORE_ROCKSDB, "rocks_db_table_readers_memory_bytes", "Estimated memory used for RocksDB index and filter blocks in bytes", () -> { @@ -126,7 +126,7 @@ public class RocksDbKeyValueStorage implements KeyValueStorage, Closeable { rollbackCount = metricsSystem .createLabelledCounter( - MetricCategory.KVSTORE_ROCKSDB, + PantheonMetricCategory.KVSTORE_ROCKSDB, "rollback_count", "Number of RocksDB transactions rolled back.", "database")