Rename MetricCategory to PantheonMetricCategory (#1574)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
Adrian Sutton 6 years ago committed by GitHub
parent 8bf224707f
commit f2a2ffc008
  1. 16
      ethereum/core/src/main/java/tech/pegasys/pantheon/ethereum/chain/DefaultMutableBlockchain.java
  2. 4
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/EthPeers.java
  3. 14
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/MonitoredExecutors.java
  4. 4
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/manager/task/AbstractEthTask.java
  5. 6
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/DefaultSynchronizer.java
  6. 4
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/PipelineChainDownloader.java
  7. 6
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastDownloaderFactory.java
  8. 6
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActions.java
  9. 6
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncDownloadPipelineFactory.java
  10. 4
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fullsync/FullSyncDownloadPipelineFactory.java
  11. 6
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/CompleteTaskStep.java
  12. 4
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/LoadLocalDataStep.java
  13. 4
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/WorldStateDownloadProcess.java
  14. 6
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/worldstate/WorldStateDownloader.java
  15. 6
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/transactions/PendingTransactions.java
  16. 4
      ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/transactions/TransactionPool.java
  17. 4
      ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java
  18. 6
      ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/subscription/SubscriptionManager.java
  19. 4
      ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugMetricsTest.java
  20. 4
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/VertxPeerDiscoveryAgent.java
  21. 6
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/DiscoveryProtocolLogger.java
  22. 8
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/discovery/internal/PeerDiscoveryController.java
  23. 4
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/network/NetworkRunner.java
  24. 8
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/RlpxAgent.java
  25. 4
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/connections/PeerConnectionEvents.java
  26. 4
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/connections/netty/DeFramer.java
  27. 6
      ethereum/p2p/src/main/java/tech/pegasys/pantheon/ethereum/p2p/rlpx/connections/netty/NettyConnectionInitializer.java
  28. 8
      ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/AccountLocalConfigPermissioningController.java
  29. 8
      ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/NodeLocalConfigPermissioningController.java
  30. 8
      ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/NodeSmartContractPermissioningController.java
  31. 8
      ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/TransactionSmartContractPermissioningController.java
  32. 10
      ethereum/permissioning/src/main/java/tech/pegasys/pantheon/ethereum/permissioning/node/provider/SyncStatusNodePermissioningProvider.java
  33. 8
      ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/AccountLocalConfigPermissioningControllerTest.java
  34. 8
      ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/NodeLocalConfigPermissioningControllerTest.java
  35. 8
      ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/NodeSmartContractPermissioningControllerTest.java
  36. 8
      ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/TransactionSmartContractPermissioningControllerTest.java
  37. 10
      ethereum/permissioning/src/test/java/tech/pegasys/pantheon/ethereum/permissioning/node/provider/SyncStatusNodePermissioningProviderTest.java
  38. 19
      metrics/core/src/main/java/tech/pegasys/pantheon/metrics/MetricsSystem.java
  39. 6
      metrics/core/src/main/java/tech/pegasys/pantheon/metrics/Observation.java
  40. 8
      metrics/core/src/main/java/tech/pegasys/pantheon/metrics/PantheonMetricCategory.java
  41. 10
      metrics/core/src/main/java/tech/pegasys/pantheon/metrics/noop/NoOpMetricsSystem.java
  42. 14
      metrics/core/src/main/java/tech/pegasys/pantheon/metrics/prometheus/MetricsConfiguration.java
  43. 51
      metrics/core/src/main/java/tech/pegasys/pantheon/metrics/prometheus/PrometheusMetricsSystem.java
  44. 8
      metrics/core/src/main/java/tech/pegasys/pantheon/metrics/vertx/PoolMetricsAdapter.java
  45. 8
      metrics/core/src/test-support/java/tech/pegasys/pantheon/metrics/StubMetricsSystem.java
  46. 11
      metrics/core/src/test/java/tech/pegasys/pantheon/metrics/noop/NoOpMetricsSystemTest.java
  47. 12
      metrics/core/src/test/java/tech/pegasys/pantheon/metrics/prometheus/PrometheusMetricsSystemTest.java
  48. 2
      metrics/rocksdb/src/main/java/tech/pegasys/pantheon/metrics/rocksdb/RocksDBStats.java
  49. 6
      pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java
  50. 6
      pantheon/src/test/java/tech/pegasys/pantheon/cli/PantheonCommandTest.java
  51. 14
      services/kvstore/src/main/java/tech/pegasys/pantheon/services/kvstore/RocksDbKeyValueStorage.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);

@ -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);

@ -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");
}

@ -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<T> implements EthTask<T> {
private static OperationTimer buildOperationTimer(final MetricsSystem metricsSystem) {
final LabelledMetric<OperationTimer> 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() {

@ -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<C> 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);

@ -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<C> implements ChainDownloader {
final LabelledMetric<Counter> labelledCounter =
metricsSystem.createLabelledCounter(
MetricCategory.SYNCHRONIZER,
PantheonMetricCategory.SYNCHRONIZER,
"chain_download_pipeline_restarts",
"Number of times the chain download pipeline has been restarted",
"reason");

@ -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);

@ -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<C> {
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);

@ -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<C> implements DownloadPipelineFacto
this.metricsSystem = metricsSystem;
final LabelledMetric<Counter> 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<C> 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",

@ -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<C> 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",

@ -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");
}

@ -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");
}

@ -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<Counter> outputCounter =
metricsSystem.createLabelledCounter(
MetricCategory.SYNCHRONIZER,
PantheonMetricCategory.SYNCHRONIZER,
"world_state_pipeline_processed_total",
"Number of entries processed by each world state download pipeline stage",
"step",

@ -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));

@ -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<Counter> 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",

@ -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");

@ -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");

@ -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");

@ -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;

@ -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()));

@ -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");

@ -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");

@ -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",

@ -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);

@ -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",

@ -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",

@ -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));

@ -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");
}

@ -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");
}

@ -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");
}

@ -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");
}

@ -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");
}

@ -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);

@ -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);

@ -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);

@ -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);

@ -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());

@ -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<Counter> 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<OperationTimer> 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<Observation> streamObservations(MetricCategory category);
Stream<Observation> streamObservations(PantheonMetricCategory category);
default Stream<Observation> streamObservations() {
return Stream.of(MetricCategory.values()).flatMap(this::streamObservations);
return Stream.of(PantheonMetricCategory.values()).flatMap(this::streamObservations);
}
}

@ -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<String> labels;
private final Object value;
public Observation(
final MetricCategory category,
final PantheonMetricCategory category,
final String metricName,
final Object value,
final List<String> labels) {
@ -34,7 +34,7 @@ public class Observation {
this.labels = labels;
}
public MetricCategory getCategory() {
public PantheonMetricCategory getCategory() {
return category;
}

@ -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<MetricCategory> DEFAULT_METRIC_CATEGORIES =
public static final Set<PantheonMetricCategory> 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;
}

@ -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<Counter> 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<OperationTimer> 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<Observation> streamObservations(final MetricCategory category) {
public Stream<Observation> streamObservations(final PantheonMetricCategory category) {
return Stream.empty();
}

@ -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<MetricCategory> metricCategories;
private final Set<PantheonMetricCategory> 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<MetricCategory> metricCategories,
final Set<PantheonMetricCategory> metricCategories,
final boolean pushEnabled,
final int pushPort,
final String pushHost,
@ -82,7 +82,7 @@ public class MetricsConfiguration {
return host;
}
public Set<MetricCategory> getMetricCategories() {
public Set<PantheonMetricCategory> 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<MetricCategory> metricCategories = DEFAULT_METRIC_CATEGORIES;
private Set<PantheonMetricCategory> 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<MetricCategory> metricCategories) {
public Builder metricCategories(final Set<PantheonMetricCategory> metricCategories) {
this.metricCategories = metricCategories;
return this;
}

@ -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<MetricCategory, Collection<Collector>> collectors = new ConcurrentHashMap<>();
private final Map<PantheonMetricCategory, Collection<Collector>> collectors =
new ConcurrentHashMap<>();
private final CollectorRegistry registry = new CollectorRegistry(true);
private final Map<String, LabelledMetric<tech.pegasys.pantheon.metrics.Counter>> cachedCounters =
new ConcurrentHashMap<>();
private final Map<String, LabelledMetric<tech.pegasys.pantheon.metrics.OperationTimer>>
cachedTimers = new ConcurrentHashMap<>();
private final EnumSet<MetricCategory> enabledCategories = EnumSet.allOf(MetricCategory.class);
private final EnumSet<PantheonMetricCategory> 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<tech.pegasys.pantheon.metrics.Counter> 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<OperationTimer> 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<Observation> streamObservations(final MetricCategory category) {
public Stream<Observation> streamObservations(final PantheonMetricCategory category) {
return collectors.getOrDefault(category, Collections.emptySet()).stream()
.flatMap(collector -> collector.collect().stream())
.flatMap(familySamples -> convertSamplesToObservations(category, familySamples));
}
private Stream<Observation> 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<String> 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<String> 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() + "_";

@ -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<Object> {
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<Object> {
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<Object> {
rejectedCounter =
metricsSystem
.createLabelledCounter(
MetricCategory.NETWORK,
PantheonMetricCategory.NETWORK,
"vertx_worker_pool_rejected_total",
"Total number of tasks rejected by the Vertx worker pool",
"poolType",

@ -29,7 +29,7 @@ public class StubMetricsSystem implements MetricsSystem {
@Override
public LabelledMetric<Counter> 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<OperationTimer> 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<Observation> streamObservations(final MetricCategory category) {
public Stream<Observation> streamObservations(final PantheonMetricCategory category) {
throw new UnsupportedOperationException("Observations aren't actually recorded");
}

@ -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<Counter> 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<Counter> 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<OperationTimer> 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<OperationTimer> labeledTimer =
metricsSystem.createLabelledTimer(
MetricCategory.PROCESS, "name", "help", "label1", "label2");
PantheonMetricCategory.PROCESS, "name", "help", "label1", "label2");
assertThatExceptionOfType(IllegalArgumentException.class)
.isThrownBy(() -> labeledTimer.labels("one"))

@ -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);

@ -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;

@ -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<MetricCategory> metricCategories = DEFAULT_METRIC_CATEGORIES;
private final Set<PantheonMetricCategory> metricCategories = DEFAULT_METRIC_CATEGORIES;
@Option(
names = {"--metrics-push-enabled"},

@ -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();

@ -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")

Loading…
Cancel
Save