Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Rename MetricCategory to PantheonMetricCategory #1574

Merged
merged 4 commits into from
Jun 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
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;
Expand Down Expand Up @@ -69,44 +69,44 @@ public DefaultMutableBlockchain(
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",
() ->
BytesValues.asUnsignedBigInteger(this.getChainHead().getTotalDifficulty().getBytes())
.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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

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;
Expand Down Expand Up @@ -53,7 +53,7 @@ public EthPeers(final String protocolName, final Clock clock, final MetricsSyste
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -87,31 +87,31 @@ private static <T extends ThreadPoolExecutor> T newMonitoredExecutor(
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);
Expand All @@ -126,7 +126,7 @@ private static class CountingAbortPolicy extends AbortPolicy {
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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

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;
Expand Down Expand Up @@ -50,7 +50,7 @@ protected AbstractEthTask(final OperationTimer taskTimer) {
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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
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;

Expand Down Expand Up @@ -98,12 +98,12 @@ public DefaultSynchronizer(
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
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;

Expand Down Expand Up @@ -65,7 +65,7 @@ public PipelineChainDownloader(

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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
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;

Expand Down Expand Up @@ -123,13 +123,13 @@ private static CachingTaskCollection<NodeDataRequest> createWorldStateDownloader
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
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;
Expand Down Expand Up @@ -66,11 +66,11 @@ public 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
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;

Expand Down Expand Up @@ -67,7 +67,7 @@ public FastSyncDownloadPipelineFactory(
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");
Expand Down Expand Up @@ -130,7 +130,7 @@ public Pipeline<?> createDownloadPipelineForSyncTarget(final SyncTarget target)
checkpointRangeSource,
downloaderParallelism,
metricsSystem.createLabelledCounter(
MetricCategory.SYNCHRONIZER,
PantheonMetricCategory.SYNCHRONIZER,
"chain_download_pipeline_processed_total",
"Number of entries process by each chain download pipeline stage",
"step",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
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;

Expand Down Expand Up @@ -95,7 +95,7 @@ public Pipeline<?> createDownloadPipelineForSyncTarget(final SyncTarget target)
checkpointRangeSource,
downloaderParallelism,
metricsSystem.createLabelledCounter(
MetricCategory.SYNCHRONIZER,
PantheonMetricCategory.SYNCHRONIZER,
"chain_download_pipeline_processed_total",
"Number of entries process by each chain download pipeline stage",
"step",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
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 {
Expand All @@ -31,12 +31,12 @@ public 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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

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;
Expand All @@ -33,7 +33,7 @@ public 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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
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;
Expand Down Expand Up @@ -196,7 +196,7 @@ public WorldStateDownloadProcess build() {
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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
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;
Expand Down Expand Up @@ -66,13 +66,13 @@ public 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));
Expand Down
Loading