From ab9eb27f6fadfe1ee7592b3913b13d9143c06beb Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Fri, 1 Nov 2024 12:56:21 +0000 Subject: [PATCH 1/5] fix: update p2p metrics --- spartan/metrics/values.yaml | 2 + .../src/e2e_p2p/gossip_network.test.ts | 2 +- .../memory_attestation_pool.ts | 7 ++-- .../memory_epoch_proof_quote_pool.ts | 7 ++-- .../p2p/src/mem_pools/instrumentation.ts | 42 +++++++++++++++++-- .../src/mem_pools/tx_pool/aztec_kv_tx_pool.ts | 4 +- .../src/mem_pools/tx_pool/memory_tx_pool.ts | 4 +- yarn-project/p2p/src/metrics/index.ts | 25 +++++++++++ .../p2p/src/service/libp2p_service.ts | 18 +++++--- yarn-project/p2p/src/service/peer_manager.ts | 7 ++++ yarn-project/telemetry-client/src/metrics.ts | 9 ++++ 11 files changed, 106 insertions(+), 21 deletions(-) create mode 100644 yarn-project/p2p/src/metrics/index.ts diff --git a/spartan/metrics/values.yaml b/spartan/metrics/values.yaml index 9e33411896c8..5962909e3858 100644 --- a/spartan/metrics/values.yaml +++ b/spartan/metrics/values.yaml @@ -30,6 +30,8 @@ opentelemetry-collector: presets: kubernetesAttributes: enabled: true + hostMetrics: + enabled: true config: exporters: # debug: diff --git a/yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts b/yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts index b59a5a7ed8b6..9409182aa040 100644 --- a/yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts +++ b/yarn-project/end-to-end/src/e2e_p2p/gossip_network.test.ts @@ -33,7 +33,7 @@ describe('e2e_p2p_network', () => { }); // TODO(https://github.com/AztecProtocol/aztec-packages/issues/9164): Currently flakey - it.skip('should rollup txs from all peers', async () => { + it('should rollup txs from all peers', async () => { // create the bootstrap node for the network if (!t.bootstrapNodeEnr) { throw new Error('Bootstrap node ENR is not available'); diff --git a/yarn-project/p2p/src/mem_pools/attestation_pool/memory_attestation_pool.ts b/yarn-project/p2p/src/mem_pools/attestation_pool/memory_attestation_pool.ts index ee8608ea1ce4..9364130c4f89 100644 --- a/yarn-project/p2p/src/mem_pools/attestation_pool/memory_attestation_pool.ts +++ b/yarn-project/p2p/src/mem_pools/attestation_pool/memory_attestation_pool.ts @@ -1,9 +1,8 @@ import { type BlockAttestation } from '@aztec/circuit-types'; import { createDebugLogger } from '@aztec/foundation/log'; import { type TelemetryClient } from '@aztec/telemetry-client'; -import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; -import { PoolInstrumentation } from '../instrumentation.js'; +import { PoolInstrumentation, PoolName } from '../instrumentation.js'; import { type AttestationPool } from './attestation_pool.js'; export class InMemoryAttestationPool implements AttestationPool { @@ -11,9 +10,9 @@ export class InMemoryAttestationPool implements AttestationPool { private attestations: Map>>; - constructor(_telemetry: TelemetryClient, private log = createDebugLogger('aztec:attestation_pool')) { + constructor(telemetry: TelemetryClient, private log = createDebugLogger('aztec:attestation_pool')) { this.attestations = new Map(); - this.metrics = new PoolInstrumentation(new NoopTelemetryClient(), 'InMemoryAttestationPool'); + this.metrics = new PoolInstrumentation(telemetry, PoolName.ATTESTATION_POOL); } public getAttestationsForSlot(slot: bigint, proposalId: string): Promise { diff --git a/yarn-project/p2p/src/mem_pools/epoch_proof_quote_pool/memory_epoch_proof_quote_pool.ts b/yarn-project/p2p/src/mem_pools/epoch_proof_quote_pool/memory_epoch_proof_quote_pool.ts index 7177307e7920..568e5cbfc248 100644 --- a/yarn-project/p2p/src/mem_pools/epoch_proof_quote_pool/memory_epoch_proof_quote_pool.ts +++ b/yarn-project/p2p/src/mem_pools/epoch_proof_quote_pool/memory_epoch_proof_quote_pool.ts @@ -1,17 +1,16 @@ import { type EpochProofQuote } from '@aztec/circuit-types'; import { type TelemetryClient } from '@aztec/telemetry-client'; -import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; -import { PoolInstrumentation } from '../instrumentation.js'; +import { PoolInstrumentation, PoolName } from '../instrumentation.js'; import { type EpochProofQuotePool } from './epoch_proof_quote_pool.js'; export class MemoryEpochProofQuotePool implements EpochProofQuotePool { private quotes: Map; private metrics: PoolInstrumentation; - constructor(_telemetry: TelemetryClient) { + constructor(telemetry: TelemetryClient) { this.quotes = new Map(); - this.metrics = new PoolInstrumentation(new NoopTelemetryClient(), 'MemoryEpochProofQuotePool'); + this.metrics = new PoolInstrumentation(telemetry, PoolName.EPOCH_PROOF_QUOTE_POOL); } addQuote(quote: EpochProofQuote) { diff --git a/yarn-project/p2p/src/mem_pools/instrumentation.ts b/yarn-project/p2p/src/mem_pools/instrumentation.ts index 102235a406ed..f0dff192c628 100644 --- a/yarn-project/p2p/src/mem_pools/instrumentation.ts +++ b/yarn-project/p2p/src/mem_pools/instrumentation.ts @@ -1,6 +1,40 @@ import { type Gossipable } from '@aztec/circuit-types'; import { Attributes, type Histogram, Metrics, type TelemetryClient, type UpDownCounter } from '@aztec/telemetry-client'; +export enum PoolName { + TX_POOL = 'TxPool', + ATTESTATION_POOL = 'AttestationPool', + EPOCH_PROOF_QUOTE_POOL = 'EpochProofQuotePool', +} + +type MetricsLabels = { + objectInMempool : Metrics; + objectSize: Metrics; +} + +function getMetricsLabels(name: PoolName): MetricsLabels { + if (name === PoolName.TX_POOL) { + return { + objectInMempool: Metrics.MEMPOOL_TX_COUNT, + objectSize: Metrics.MEMPOOL_TX_SIZE, + }; + } + else if (name === PoolName.ATTESTATION_POOL) { + return { + objectInMempool: Metrics.MEMPOOL_ATTESTATIONS_COUNT, + objectSize: Metrics.MEMPOOL_ATTESTATIONS_SIZE, + }; + } + else if (name === PoolName.EPOCH_PROOF_QUOTE_POOL) { + return { + objectInMempool: Metrics.MEMPOOL_PROVER_QUOTE_COUNT, + objectSize: Metrics.MEMPOOL_PROVER_QUOTE_SIZE, + }; + } + + throw new Error('Invalid pool type'); +} + /** * Instrumentation class for the Pools (TxPool, AttestationPool, etc). */ @@ -12,15 +46,17 @@ export class PoolInstrumentation { private defaultAttributes; - constructor(telemetry: TelemetryClient, name: string) { + constructor(telemetry: TelemetryClient, name: PoolName) { const meter = telemetry.getMeter(name); this.defaultAttributes = { [Attributes.POOL_NAME]: name }; - this.objectsInMempool = meter.createUpDownCounter(Metrics.MEMPOOL_TX_COUNT, { + const metricsLabels = getMetricsLabels(name); + + this.objectsInMempool = meter.createUpDownCounter(metricsLabels.objectInMempool, { description: 'The current number of transactions in the mempool', }); - this.objectSize = meter.createHistogram(Metrics.MEMPOOL_TX_SIZE, { + this.objectSize = meter.createHistogram(metricsLabels.objectSize, { unit: 'By', description: 'The size of transactions in the mempool', advice: { diff --git a/yarn-project/p2p/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts b/yarn-project/p2p/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts index 04d931c4240b..e4cf2801a3f5 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool/aztec_kv_tx_pool.ts @@ -4,7 +4,7 @@ import { type Logger, createDebugLogger } from '@aztec/foundation/log'; import { type AztecKVStore, type AztecMap, type AztecSet } from '@aztec/kv-store'; import { type TelemetryClient } from '@aztec/telemetry-client'; -import { PoolInstrumentation } from '../instrumentation.js'; +import { PoolInstrumentation, PoolName } from '../instrumentation.js'; import { type TxPool } from './tx_pool.js'; /** @@ -37,7 +37,7 @@ export class AztecKVTxPool implements TxPool { this.#store = store; this.#log = log; - this.#metrics = new PoolInstrumentation(telemetry, 'AztecKVTxPool'); + this.#metrics = new PoolInstrumentation(telemetry, PoolName.TX_POOL); } public markAsMined(txHashes: TxHash[], blockNumber: number): Promise { diff --git a/yarn-project/p2p/src/mem_pools/tx_pool/memory_tx_pool.ts b/yarn-project/p2p/src/mem_pools/tx_pool/memory_tx_pool.ts index f7d6b59fea47..21c240894981 100644 --- a/yarn-project/p2p/src/mem_pools/tx_pool/memory_tx_pool.ts +++ b/yarn-project/p2p/src/mem_pools/tx_pool/memory_tx_pool.ts @@ -3,7 +3,7 @@ import { type TxAddedToPoolStats } from '@aztec/circuit-types/stats'; import { createDebugLogger } from '@aztec/foundation/log'; import { type TelemetryClient } from '@aztec/telemetry-client'; -import { PoolInstrumentation } from '../instrumentation.js'; +import { PoolInstrumentation, PoolName } from '../instrumentation.js'; import { type TxPool } from './tx_pool.js'; /** @@ -27,7 +27,7 @@ export class InMemoryTxPool implements TxPool { this.txs = new Map(); this.minedTxs = new Map(); this.pendingTxs = new Set(); - this.metrics = new PoolInstrumentation(telemetry, 'InMemoryTxPool'); + this.metrics = new PoolInstrumentation(telemetry, PoolName.TX_POOL); } public markAsMined(txHashes: TxHash[], blockNumber: number): Promise { diff --git a/yarn-project/p2p/src/metrics/index.ts b/yarn-project/p2p/src/metrics/index.ts new file mode 100644 index 000000000000..fd361d2d4bc9 --- /dev/null +++ b/yarn-project/p2p/src/metrics/index.ts @@ -0,0 +1,25 @@ + + +import { UpDownCounter, TelemetryClient, Metrics, WithTracer } from '@aztec/telemetry-client'; + +export class P2PMetrics extends WithTracer { + private peerCount: UpDownCounter; + + constructor(client: TelemetryClient, name = 'P2P') { + super(client, name); + + const meter = client.getMeter(name); + + this.peerCount = meter.createUpDownCounter(Metrics.P2P_PEER_COUNT, { + description: "The number of active peers", + }); + } + + recordAddPeer() { + this.peerCount.add(1); + } + + recordRemovePeer() { + this.peerCount.add(-1); + } +} \ No newline at end of file diff --git a/yarn-project/p2p/src/service/libp2p_service.ts b/yarn-project/p2p/src/service/libp2p_service.ts index 463471041bba..45f36080e1ff 100644 --- a/yarn-project/p2p/src/service/libp2p_service.ts +++ b/yarn-project/p2p/src/service/libp2p_service.ts @@ -58,6 +58,7 @@ import { } from './reqresp/interface.js'; import { ReqResp } from './reqresp/reqresp.js'; import type { P2PService, PeerDiscoveryService } from './service.js'; +import { P2PMetrics } from '../metrics/index.js'; /** * Create a libp2p peer ID from the private key if provided, otherwise creates a new random ID. @@ -78,13 +79,16 @@ export async function createLibP2PPeerId(privateKey?: string): Promise { /** * Lib P2P implementation of the P2PService interface. */ -export class LibP2PService extends WithTracer implements P2PService { +export class LibP2PService implements P2PService { private jobQueue: SerialQueue = new SerialQueue(); private peerManager: PeerManager; private discoveryRunningPromise?: RunningPromise; // Request and response sub service - private reqresp: ReqResp; + public reqresp: ReqResp; + + // Metrics + private metrics: P2PMetrics; /** * Callback for when a block is received from a peer. @@ -105,10 +109,10 @@ export class LibP2PService extends WithTracer implements P2PService { private requestResponseHandlers: ReqRespSubProtocolHandlers = DEFAULT_SUB_PROTOCOL_HANDLERS, private logger = createDebugLogger('aztec:libp2p_service'), ) { - // Instatntiate tracer - super(telemetry, 'LibP2PService'); + // Instatntiate Metrics + this.metrics = new P2PMetrics(telemetry, 'P2P'); - this.peerManager = new PeerManager(node, peerDiscoveryService, config, logger); + this.peerManager = new PeerManager(node, peerDiscoveryService, config, logger, this.metrics); this.node.services.pubsub.score.params.appSpecificScore = (peerId: string) => { return this.peerManager.getPeerScore(peerId); }; @@ -123,6 +127,10 @@ export class LibP2PService extends WithTracer implements P2PService { }; } + get tracer() { + return this.metrics.tracer; + } + /** * Starts the LibP2P service. * @returns An empty promise. diff --git a/yarn-project/p2p/src/service/peer_manager.ts b/yarn-project/p2p/src/service/peer_manager.ts index edb0ee58f9a4..65a4126a655b 100644 --- a/yarn-project/p2p/src/service/peer_manager.ts +++ b/yarn-project/p2p/src/service/peer_manager.ts @@ -8,6 +8,9 @@ import { type P2PConfig } from '../config.js'; import { type PubSubLibp2p } from '../util.js'; import { type PeerErrorSeverity, PeerScoring } from './peer_scoring.js'; import { type PeerDiscoveryService } from './service.js'; +import { TelemetryClient } from '@aztec/telemetry-client'; +import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; +import { P2PMetrics } from '../metrics/index.js'; const MAX_DIAL_ATTEMPTS = 3; const MAX_CACHED_PEERS = 100; @@ -28,6 +31,7 @@ export class PeerManager { private peerDiscoveryService: PeerDiscoveryService, private config: P2PConfig, private logger = createDebugLogger('aztec:p2p:peer_manager'), + private metrics?: P2PMetrics, ) { this.peerScoring = new PeerScoring(config); // Handle new established connections @@ -38,6 +42,7 @@ export class PeerManager { } else { this.logger.debug(`Connected to transaction peer ${peerId.toString()}`); } + this.metrics?.recordAddPeer(); }); // Handle lost connections @@ -48,6 +53,7 @@ export class PeerManager { } else { this.logger.debug(`Disconnected from transaction peer ${peerId.toString()}`); } + this.metrics?.recordRemovePeer(); }); // Handle Discovered peers @@ -78,6 +84,7 @@ export class PeerManager { // Get current connections const connections = this.libP2PNode.getConnections(); + // Calculate how many connections we're looking to make const peersToConnect = this.config.maxPeerCount - connections.length; diff --git a/yarn-project/telemetry-client/src/metrics.ts b/yarn-project/telemetry-client/src/metrics.ts index 094044f416da..72b873eebd52 100644 --- a/yarn-project/telemetry-client/src/metrics.ts +++ b/yarn-project/telemetry-client/src/metrics.ts @@ -26,6 +26,12 @@ export const CIRCUIT_SIZE = 'aztec.circuit.size'; export const MEMPOOL_TX_COUNT = 'aztec.mempool.tx_count'; export const MEMPOOL_TX_SIZE = 'aztec.mempool.tx_size'; +export const MEMPOOL_ATTESTATIONS_COUNT = 'aztec.mempool.attestations_count'; +export const MEMPOOL_ATTESTATIONS_SIZE = 'aztec.mempool.attestations_size'; + +export const MEMPOOL_PROVER_QUOTE_COUNT = 'aztec.mempool.prover_quote_count'; +export const MEMPOOL_PROVER_QUOTE_SIZE = 'aztec.mempool.prover_quote_size'; + export const ARCHIVER_SYNC_DURATION = 'aztec.archiver.sync_duration'; export const ARCHIVER_BLOCK_HEIGHT = 'aztec.archiver.block_height'; export const ARCHIVER_BLOCK_SIZE = 'aztec.archiver.block_size'; @@ -73,3 +79,6 @@ export const WORLD_STATE_MERKLE_TREE_SIZE = 'aztec.world_state.merkle_tree_size' export const WORLD_STATE_DB_SIZE = 'aztec.world_state.db_size'; export const PROOF_VERIFIER_COUNT = 'aztec.proof_verifier.count'; + +/** p2p metrics */ +export const P2P_PEER_COUNT = 'aztec.p2p.peer_count'; From 0ff717815de97589ff3682f33c11f6a5d5a68827 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:14:53 +0000 Subject: [PATCH 2/5] comment --- yarn-project/p2p/src/mem_pools/instrumentation.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/yarn-project/p2p/src/mem_pools/instrumentation.ts b/yarn-project/p2p/src/mem_pools/instrumentation.ts index f0dff192c628..7f8c2f835452 100644 --- a/yarn-project/p2p/src/mem_pools/instrumentation.ts +++ b/yarn-project/p2p/src/mem_pools/instrumentation.ts @@ -12,6 +12,11 @@ type MetricsLabels = { objectSize: Metrics; } +/** + * Get the metrics labels for a given pool name. + * They must all have different names, as if duplicates appear, it will brick + * the metrics instance + */ function getMetricsLabels(name: PoolName): MetricsLabels { if (name === PoolName.TX_POOL) { return { From d8fb79f29ca05e0a0b5e1142368fafcf2d773acb Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Fri, 1 Nov 2024 13:33:55 +0000 Subject: [PATCH 3/5] exp: metrics --- yarn-project/p2p/src/client/index.ts | 7 +++++-- yarn-project/p2p/src/client/p2p_client.test.ts | 17 +++++++---------- yarn-project/p2p/src/client/p2p_client.ts | 14 +++++++++----- yarn-project/p2p/src/metrics/index.ts | 2 +- yarn-project/p2p/src/mocks/index.ts | 4 +++- yarn-project/p2p/src/service/libp2p_service.ts | 16 +++++----------- yarn-project/p2p/src/service/peer_manager.ts | 4 +--- .../prover-node/src/prover-node.test.ts | 2 +- 8 files changed, 32 insertions(+), 34 deletions(-) diff --git a/yarn-project/p2p/src/client/index.ts b/yarn-project/p2p/src/client/index.ts index e6a4d273f0ea..cf9b7047ef86 100644 --- a/yarn-project/p2p/src/client/index.ts +++ b/yarn-project/p2p/src/client/index.ts @@ -17,6 +17,7 @@ import { DiscV5Service } from '../service/discV5_service.js'; import { DummyP2PService } from '../service/dummy_service.js'; import { LibP2PService, createLibP2PPeerId } from '../service/index.js'; import { configureP2PClientAddresses } from '../util.js'; +import { P2PMetrics } from '../metrics/index.js'; export * from './p2p_client.js'; @@ -44,6 +45,8 @@ export const createP2PClient = async ( let p2pService; + const p2pMetrics = new P2PMetrics(telemetry, 'P2PClient'); + if (_config.p2pEnabled) { config = await configureP2PClientAddresses(_config); @@ -60,10 +63,10 @@ export const createP2PClient = async ( proofVerifier, worldStateSynchronizer, store, - telemetry, + p2pMetrics, ); } else { p2pService = new DummyP2PService(); } - return new P2PClient(store, l2BlockSource, mempools, p2pService, config.keepProvenTxsInPoolFor, telemetry); + return new P2PClient(store, l2BlockSource, mempools, p2pService, config.keepProvenTxsInPoolFor, p2pMetrics); }; diff --git a/yarn-project/p2p/src/client/p2p_client.test.ts b/yarn-project/p2p/src/client/p2p_client.test.ts index c19fd464dcc2..b81929903a2c 100644 --- a/yarn-project/p2p/src/client/p2p_client.test.ts +++ b/yarn-project/p2p/src/client/p2p_client.test.ts @@ -5,8 +5,6 @@ import { retryUntil } from '@aztec/foundation/retry'; import { sleep } from '@aztec/foundation/sleep'; import { type AztecKVStore } from '@aztec/kv-store'; import { openTmpStore } from '@aztec/kv-store/utils'; -import { type TelemetryClient } from '@aztec/telemetry-client'; -import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; import { expect, jest } from '@jest/globals'; @@ -32,7 +30,6 @@ describe('In-Memory P2P Client', () => { let p2pService: Mockify; let kvStore: AztecKVStore; let client: P2PClient; - const telemetryClient: TelemetryClient = new NoopTelemetryClient(); beforeEach(() => { txPool = { @@ -80,7 +77,7 @@ describe('In-Memory P2P Client', () => { }; kvStore = openTmpStore(); - client = new P2PClient(kvStore, blockSource, mempools, p2pService, 0, telemetryClient); + client = new P2PClient(kvStore, blockSource, mempools, p2pService, 0); }); const advanceToProvenBlock = async (getProvenBlockNumber: number, provenEpochNumber = getProvenBlockNumber) => { @@ -150,7 +147,7 @@ describe('In-Memory P2P Client', () => { await client.start(); await client.stop(); - const client2 = new P2PClient(kvStore, blockSource, mempools, p2pService, 0, telemetryClient); + const client2 = new P2PClient(kvStore, blockSource, mempools, p2pService, 0); expect(client2.getSyncedLatestBlockNum()).toEqual(client.getSyncedLatestBlockNum()); }); @@ -165,7 +162,7 @@ describe('In-Memory P2P Client', () => { }); it('deletes txs after waiting the set number of blocks', async () => { - client = new P2PClient(kvStore, blockSource, mempools, p2pService, 10, telemetryClient); + client = new P2PClient(kvStore, blockSource, mempools, p2pService, 10); blockSource.setProvenBlockNumber(0); await client.start(); expect(txPool.deleteTxs).not.toHaveBeenCalled(); @@ -182,7 +179,7 @@ describe('In-Memory P2P Client', () => { }); it('stores and returns epoch proof quotes', async () => { - client = new P2PClient(kvStore, blockSource, mempools, p2pService, 0, telemetryClient); + client = new P2PClient(kvStore, blockSource, mempools, p2pService, 0); blockSource.setProvenEpochNumber(2); await client.start(); @@ -213,7 +210,7 @@ describe('In-Memory P2P Client', () => { }); it('deletes expired proof quotes', async () => { - client = new P2PClient(kvStore, blockSource, mempools, p2pService, 0, telemetryClient); + client = new P2PClient(kvStore, blockSource, mempools, p2pService, 0); blockSource.setProvenEpochNumber(1); blockSource.setProvenBlockNumber(1); @@ -276,7 +273,7 @@ describe('In-Memory P2P Client', () => { }); it('deletes txs created from a pruned block', async () => { - client = new P2PClient(kvStore, blockSource, mempools, p2pService, 10, telemetryClient); + client = new P2PClient(kvStore, blockSource, mempools, p2pService, 10); blockSource.setProvenBlockNumber(0); await client.start(); @@ -298,7 +295,7 @@ describe('In-Memory P2P Client', () => { }); it('moves mined and valid txs back to the pending set', async () => { - client = new P2PClient(kvStore, blockSource, mempools, p2pService, 10, telemetryClient); + client = new P2PClient(kvStore, blockSource, mempools, p2pService, 10); blockSource.setProvenBlockNumber(0); await client.start(); diff --git a/yarn-project/p2p/src/client/p2p_client.ts b/yarn-project/p2p/src/client/p2p_client.ts index a8bd5954eb47..6cef387f7525 100644 --- a/yarn-project/p2p/src/client/p2p_client.ts +++ b/yarn-project/p2p/src/client/p2p_client.ts @@ -14,7 +14,7 @@ import { import { INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js/constants'; import { createDebugLogger } from '@aztec/foundation/log'; import { type AztecKVStore, type AztecMap, type AztecSingleton } from '@aztec/kv-store'; -import { Attributes, type TelemetryClient, WithTracer, trackSpan } from '@aztec/telemetry-client'; +import { Attributes, trackSpan } from '@aztec/telemetry-client'; import { type ENR } from '@chainsafe/enr'; @@ -25,6 +25,8 @@ import { type MemPools } from '../mem_pools/interface.js'; import { type TxPool } from '../mem_pools/tx_pool/index.js'; import { TX_REQ_PROTOCOL } from '../service/reqresp/interface.js'; import type { P2PService } from '../service/service.js'; +import { P2PMetrics } from '../metrics/index.js'; +import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; /** * Enum defining the possible states of the p2p client. @@ -180,7 +182,7 @@ export interface P2P { /** * The P2P client implementation. */ -export class P2PClient extends WithTracer implements P2P { +export class P2PClient implements P2P { /** Property that indicates whether the client is running. */ private stopping = false; @@ -218,11 +220,9 @@ export class P2PClient extends WithTracer implements P2P { mempools: MemPools, private p2pService: P2PService, private keepProvenTxsFor: number, - telemetryClient: TelemetryClient, + private metrics: P2PMetrics = new P2PMetrics(new NoopTelemetryClient(), 'P2PClient'), private log = createDebugLogger('aztec:p2p'), ) { - super(telemetryClient, 'P2PClient'); - const { blockCheckIntervalMS, blockRequestBatchSize } = getP2PConfigFromEnv(); this.blockStream = new L2BlockStream(l2BlockSource, this, this, { @@ -239,6 +239,10 @@ export class P2PClient extends WithTracer implements P2P { this.epochProofQuotePool = mempools.epochProofQuotePool; } + get tracer() { + return this.metrics.tracer; + } + public getL2BlockHash(number: number): Promise { return Promise.resolve(this.synchedBlockHashes.get(number)); } diff --git a/yarn-project/p2p/src/metrics/index.ts b/yarn-project/p2p/src/metrics/index.ts index fd361d2d4bc9..69165f50f248 100644 --- a/yarn-project/p2p/src/metrics/index.ts +++ b/yarn-project/p2p/src/metrics/index.ts @@ -1,6 +1,6 @@ -import { UpDownCounter, TelemetryClient, Metrics, WithTracer } from '@aztec/telemetry-client'; +import { type UpDownCounter, type TelemetryClient, Metrics, WithTracer } from '@aztec/telemetry-client'; export class P2PMetrics extends WithTracer { private peerCount: UpDownCounter; diff --git a/yarn-project/p2p/src/mocks/index.ts b/yarn-project/p2p/src/mocks/index.ts index 5127a8c62386..9bd2a84e60c6 100644 --- a/yarn-project/p2p/src/mocks/index.ts +++ b/yarn-project/p2p/src/mocks/index.ts @@ -35,6 +35,7 @@ import { } from '../service/reqresp/interface.js'; import { ReqResp } from '../service/reqresp/reqresp.js'; import { type PubSubLibp2p } from '../util.js'; +import { P2PMetrics } from '../metrics/index.js'; /** * Creates a libp2p node, pre configured. @@ -120,6 +121,7 @@ export async function createTestLibP2PService( // No bootstrap nodes provided as the libp2p service will register them in the constructor const p2pNode = await createLibp2pNode([], peerId, port, /*enable gossip */ true, /**start */ false); + const p2pMetrics = new P2PMetrics(telemetry, 'P2PService'); return new LibP2PService( config, p2pNode as PubSubLibp2p, @@ -128,7 +130,7 @@ export async function createTestLibP2PService( l2BlockSource, proofVerifier, worldStateSynchronizer, - telemetry, + p2pMetrics, ); } diff --git a/yarn-project/p2p/src/service/libp2p_service.ts b/yarn-project/p2p/src/service/libp2p_service.ts index 45f36080e1ff..851c7d1d3955 100644 --- a/yarn-project/p2p/src/service/libp2p_service.ts +++ b/yarn-project/p2p/src/service/libp2p_service.ts @@ -18,7 +18,7 @@ import { createDebugLogger } from '@aztec/foundation/log'; import { SerialQueue } from '@aztec/foundation/queue'; import { RunningPromise } from '@aztec/foundation/running-promise'; import type { AztecKVStore } from '@aztec/kv-store'; -import { Attributes, type TelemetryClient, WithTracer, trackSpan } from '@aztec/telemetry-client'; +import { Attributes, trackSpan } from '@aztec/telemetry-client'; import { type ENR } from '@chainsafe/enr'; import { type GossipSub, type GossipSubComponents, gossipsub } from '@chainsafe/libp2p-gossipsub'; @@ -58,7 +58,7 @@ import { } from './reqresp/interface.js'; import { ReqResp } from './reqresp/reqresp.js'; import type { P2PService, PeerDiscoveryService } from './service.js'; -import { P2PMetrics } from '../metrics/index.js'; +import { type P2PMetrics } from '../metrics/index.js'; /** * Create a libp2p peer ID from the private key if provided, otherwise creates a new random ID. @@ -87,9 +87,6 @@ export class LibP2PService implements P2PService { // Request and response sub service public reqresp: ReqResp; - // Metrics - private metrics: P2PMetrics; - /** * Callback for when a block is received from a peer. * @param block - The block received from the peer. @@ -105,13 +102,10 @@ export class LibP2PService implements P2PService { private l2BlockSource: L2BlockSource, private proofVerifier: ClientProtocolCircuitVerifier, private worldStateSynchronizer: WorldStateSynchronizer, - telemetry: TelemetryClient, + private metrics: P2PMetrics, private requestResponseHandlers: ReqRespSubProtocolHandlers = DEFAULT_SUB_PROTOCOL_HANDLERS, private logger = createDebugLogger('aztec:libp2p_service'), ) { - // Instatntiate Metrics - this.metrics = new P2PMetrics(telemetry, 'P2P'); - this.peerManager = new PeerManager(node, peerDiscoveryService, config, logger, this.metrics); this.node.services.pubsub.score.params.appSpecificScore = (peerId: string) => { return this.peerManager.getPeerScore(peerId); @@ -217,7 +211,7 @@ export class LibP2PService implements P2PService { proofVerifier: ClientProtocolCircuitVerifier, worldStateSynchronizer: WorldStateSynchronizer, store: AztecKVStore, - telemetry: TelemetryClient, + metrics: P2PMetrics, ) { const { tcpListenAddress, tcpAnnounceAddress, minPeerCount, maxPeerCount } = config; const bindAddrTcp = convertToMultiaddr(tcpListenAddress, 'tcp'); @@ -320,7 +314,7 @@ export class LibP2PService implements P2PService { l2BlockSource, proofVerifier, worldStateSynchronizer, - telemetry, + metrics, requestResponseHandlers, ); } diff --git a/yarn-project/p2p/src/service/peer_manager.ts b/yarn-project/p2p/src/service/peer_manager.ts index 65a4126a655b..81115b4fdc8c 100644 --- a/yarn-project/p2p/src/service/peer_manager.ts +++ b/yarn-project/p2p/src/service/peer_manager.ts @@ -8,9 +8,7 @@ import { type P2PConfig } from '../config.js'; import { type PubSubLibp2p } from '../util.js'; import { type PeerErrorSeverity, PeerScoring } from './peer_scoring.js'; import { type PeerDiscoveryService } from './service.js'; -import { TelemetryClient } from '@aztec/telemetry-client'; -import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; -import { P2PMetrics } from '../metrics/index.js'; +import { type P2PMetrics } from '../metrics/index.js'; const MAX_DIAL_ATTEMPTS = 3; const MAX_CACHED_PEERS = 100; diff --git a/yarn-project/prover-node/src/prover-node.test.ts b/yarn-project/prover-node/src/prover-node.test.ts index bca781310f45..2282c542202d 100644 --- a/yarn-project/prover-node/src/prover-node.test.ts +++ b/yarn-project/prover-node/src/prover-node.test.ts @@ -310,7 +310,7 @@ describe('prover-node', () => { port, ); const kvStore = openTmpStore(); - return new P2PClient(kvStore, l2BlockSource, mempools, libp2pService, 0, telemetryClient); + return new P2PClient(kvStore, l2BlockSource, mempools, libp2pService, 0); }; beforeEach(async () => { From 66c53cb23b4363c1da09225169f10966b023be98 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:10:58 +0000 Subject: [PATCH 4/5] fix: revert non pool changes --- yarn-project/p2p/src/client/index.ts | 7 ++---- yarn-project/p2p/src/client/p2p_client.ts | 13 ++++------ yarn-project/p2p/src/metrics/index.ts | 25 ------------------- yarn-project/p2p/src/mocks/index.ts | 4 +-- .../p2p/src/service/libp2p_service.ts | 19 ++++++-------- yarn-project/p2p/src/service/peer_manager.ts | 4 --- yarn-project/telemetry-client/src/metrics.ts | 5 +--- 7 files changed, 17 insertions(+), 60 deletions(-) delete mode 100644 yarn-project/p2p/src/metrics/index.ts diff --git a/yarn-project/p2p/src/client/index.ts b/yarn-project/p2p/src/client/index.ts index cf9b7047ef86..e6a4d273f0ea 100644 --- a/yarn-project/p2p/src/client/index.ts +++ b/yarn-project/p2p/src/client/index.ts @@ -17,7 +17,6 @@ import { DiscV5Service } from '../service/discV5_service.js'; import { DummyP2PService } from '../service/dummy_service.js'; import { LibP2PService, createLibP2PPeerId } from '../service/index.js'; import { configureP2PClientAddresses } from '../util.js'; -import { P2PMetrics } from '../metrics/index.js'; export * from './p2p_client.js'; @@ -45,8 +44,6 @@ export const createP2PClient = async ( let p2pService; - const p2pMetrics = new P2PMetrics(telemetry, 'P2PClient'); - if (_config.p2pEnabled) { config = await configureP2PClientAddresses(_config); @@ -63,10 +60,10 @@ export const createP2PClient = async ( proofVerifier, worldStateSynchronizer, store, - p2pMetrics, + telemetry, ); } else { p2pService = new DummyP2PService(); } - return new P2PClient(store, l2BlockSource, mempools, p2pService, config.keepProvenTxsInPoolFor, p2pMetrics); + return new P2PClient(store, l2BlockSource, mempools, p2pService, config.keepProvenTxsInPoolFor, telemetry); }; diff --git a/yarn-project/p2p/src/client/p2p_client.ts b/yarn-project/p2p/src/client/p2p_client.ts index 6cef387f7525..d3df549f28f5 100644 --- a/yarn-project/p2p/src/client/p2p_client.ts +++ b/yarn-project/p2p/src/client/p2p_client.ts @@ -14,7 +14,7 @@ import { import { INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js/constants'; import { createDebugLogger } from '@aztec/foundation/log'; import { type AztecKVStore, type AztecMap, type AztecSingleton } from '@aztec/kv-store'; -import { Attributes, trackSpan } from '@aztec/telemetry-client'; +import { Attributes, TelemetryClient, trackSpan, WithTracer } from '@aztec/telemetry-client'; import { type ENR } from '@chainsafe/enr'; @@ -25,7 +25,6 @@ import { type MemPools } from '../mem_pools/interface.js'; import { type TxPool } from '../mem_pools/tx_pool/index.js'; import { TX_REQ_PROTOCOL } from '../service/reqresp/interface.js'; import type { P2PService } from '../service/service.js'; -import { P2PMetrics } from '../metrics/index.js'; import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; /** @@ -182,7 +181,7 @@ export interface P2P { /** * The P2P client implementation. */ -export class P2PClient implements P2P { +export class P2PClient extends WithTracer implements P2P { /** Property that indicates whether the client is running. */ private stopping = false; @@ -220,9 +219,11 @@ export class P2PClient implements P2P { mempools: MemPools, private p2pService: P2PService, private keepProvenTxsFor: number, - private metrics: P2PMetrics = new P2PMetrics(new NoopTelemetryClient(), 'P2PClient'), + telemetry: TelemetryClient = new NoopTelemetryClient(), private log = createDebugLogger('aztec:p2p'), ) { + super(telemetry, 'P2PClient'); + const { blockCheckIntervalMS, blockRequestBatchSize } = getP2PConfigFromEnv(); this.blockStream = new L2BlockStream(l2BlockSource, this, this, { @@ -239,10 +240,6 @@ export class P2PClient implements P2P { this.epochProofQuotePool = mempools.epochProofQuotePool; } - get tracer() { - return this.metrics.tracer; - } - public getL2BlockHash(number: number): Promise { return Promise.resolve(this.synchedBlockHashes.get(number)); } diff --git a/yarn-project/p2p/src/metrics/index.ts b/yarn-project/p2p/src/metrics/index.ts deleted file mode 100644 index 69165f50f248..000000000000 --- a/yarn-project/p2p/src/metrics/index.ts +++ /dev/null @@ -1,25 +0,0 @@ - - -import { type UpDownCounter, type TelemetryClient, Metrics, WithTracer } from '@aztec/telemetry-client'; - -export class P2PMetrics extends WithTracer { - private peerCount: UpDownCounter; - - constructor(client: TelemetryClient, name = 'P2P') { - super(client, name); - - const meter = client.getMeter(name); - - this.peerCount = meter.createUpDownCounter(Metrics.P2P_PEER_COUNT, { - description: "The number of active peers", - }); - } - - recordAddPeer() { - this.peerCount.add(1); - } - - recordRemovePeer() { - this.peerCount.add(-1); - } -} \ No newline at end of file diff --git a/yarn-project/p2p/src/mocks/index.ts b/yarn-project/p2p/src/mocks/index.ts index 9bd2a84e60c6..5127a8c62386 100644 --- a/yarn-project/p2p/src/mocks/index.ts +++ b/yarn-project/p2p/src/mocks/index.ts @@ -35,7 +35,6 @@ import { } from '../service/reqresp/interface.js'; import { ReqResp } from '../service/reqresp/reqresp.js'; import { type PubSubLibp2p } from '../util.js'; -import { P2PMetrics } from '../metrics/index.js'; /** * Creates a libp2p node, pre configured. @@ -121,7 +120,6 @@ export async function createTestLibP2PService( // No bootstrap nodes provided as the libp2p service will register them in the constructor const p2pNode = await createLibp2pNode([], peerId, port, /*enable gossip */ true, /**start */ false); - const p2pMetrics = new P2PMetrics(telemetry, 'P2PService'); return new LibP2PService( config, p2pNode as PubSubLibp2p, @@ -130,7 +128,7 @@ export async function createTestLibP2PService( l2BlockSource, proofVerifier, worldStateSynchronizer, - p2pMetrics, + telemetry, ); } diff --git a/yarn-project/p2p/src/service/libp2p_service.ts b/yarn-project/p2p/src/service/libp2p_service.ts index 851c7d1d3955..be94cc1a8618 100644 --- a/yarn-project/p2p/src/service/libp2p_service.ts +++ b/yarn-project/p2p/src/service/libp2p_service.ts @@ -18,7 +18,7 @@ import { createDebugLogger } from '@aztec/foundation/log'; import { SerialQueue } from '@aztec/foundation/queue'; import { RunningPromise } from '@aztec/foundation/running-promise'; import type { AztecKVStore } from '@aztec/kv-store'; -import { Attributes, trackSpan } from '@aztec/telemetry-client'; +import { Attributes, TelemetryClient, trackSpan, WithTracer } from '@aztec/telemetry-client'; import { type ENR } from '@chainsafe/enr'; import { type GossipSub, type GossipSubComponents, gossipsub } from '@chainsafe/libp2p-gossipsub'; @@ -58,7 +58,6 @@ import { } from './reqresp/interface.js'; import { ReqResp } from './reqresp/reqresp.js'; import type { P2PService, PeerDiscoveryService } from './service.js'; -import { type P2PMetrics } from '../metrics/index.js'; /** * Create a libp2p peer ID from the private key if provided, otherwise creates a new random ID. @@ -79,7 +78,7 @@ export async function createLibP2PPeerId(privateKey?: string): Promise { /** * Lib P2P implementation of the P2PService interface. */ -export class LibP2PService implements P2PService { +export class LibP2PService extends WithTracer implements P2PService { private jobQueue: SerialQueue = new SerialQueue(); private peerManager: PeerManager; private discoveryRunningPromise?: RunningPromise; @@ -102,11 +101,13 @@ export class LibP2PService implements P2PService { private l2BlockSource: L2BlockSource, private proofVerifier: ClientProtocolCircuitVerifier, private worldStateSynchronizer: WorldStateSynchronizer, - private metrics: P2PMetrics, + private telemetry: TelemetryClient, private requestResponseHandlers: ReqRespSubProtocolHandlers = DEFAULT_SUB_PROTOCOL_HANDLERS, private logger = createDebugLogger('aztec:libp2p_service'), ) { - this.peerManager = new PeerManager(node, peerDiscoveryService, config, logger, this.metrics); + super(telemetry, 'LibP2PService'); + + this.peerManager = new PeerManager(node, peerDiscoveryService, config, logger); this.node.services.pubsub.score.params.appSpecificScore = (peerId: string) => { return this.peerManager.getPeerScore(peerId); }; @@ -121,10 +122,6 @@ export class LibP2PService implements P2PService { }; } - get tracer() { - return this.metrics.tracer; - } - /** * Starts the LibP2P service. * @returns An empty promise. @@ -211,7 +208,7 @@ export class LibP2PService implements P2PService { proofVerifier: ClientProtocolCircuitVerifier, worldStateSynchronizer: WorldStateSynchronizer, store: AztecKVStore, - metrics: P2PMetrics, + telemetry: TelemetryClient, ) { const { tcpListenAddress, tcpAnnounceAddress, minPeerCount, maxPeerCount } = config; const bindAddrTcp = convertToMultiaddr(tcpListenAddress, 'tcp'); @@ -314,7 +311,7 @@ export class LibP2PService implements P2PService { l2BlockSource, proofVerifier, worldStateSynchronizer, - metrics, + telemetry, requestResponseHandlers, ); } diff --git a/yarn-project/p2p/src/service/peer_manager.ts b/yarn-project/p2p/src/service/peer_manager.ts index 81115b4fdc8c..b70fb61c0930 100644 --- a/yarn-project/p2p/src/service/peer_manager.ts +++ b/yarn-project/p2p/src/service/peer_manager.ts @@ -8,7 +8,6 @@ import { type P2PConfig } from '../config.js'; import { type PubSubLibp2p } from '../util.js'; import { type PeerErrorSeverity, PeerScoring } from './peer_scoring.js'; import { type PeerDiscoveryService } from './service.js'; -import { type P2PMetrics } from '../metrics/index.js'; const MAX_DIAL_ATTEMPTS = 3; const MAX_CACHED_PEERS = 100; @@ -29,7 +28,6 @@ export class PeerManager { private peerDiscoveryService: PeerDiscoveryService, private config: P2PConfig, private logger = createDebugLogger('aztec:p2p:peer_manager'), - private metrics?: P2PMetrics, ) { this.peerScoring = new PeerScoring(config); // Handle new established connections @@ -40,7 +38,6 @@ export class PeerManager { } else { this.logger.debug(`Connected to transaction peer ${peerId.toString()}`); } - this.metrics?.recordAddPeer(); }); // Handle lost connections @@ -51,7 +48,6 @@ export class PeerManager { } else { this.logger.debug(`Disconnected from transaction peer ${peerId.toString()}`); } - this.metrics?.recordRemovePeer(); }); // Handle Discovered peers diff --git a/yarn-project/telemetry-client/src/metrics.ts b/yarn-project/telemetry-client/src/metrics.ts index 72b873eebd52..f778ae4d92b3 100644 --- a/yarn-project/telemetry-client/src/metrics.ts +++ b/yarn-project/telemetry-client/src/metrics.ts @@ -78,7 +78,4 @@ export const WORLD_STATE_SYNC_DURATION = 'aztec.world_state.sync.duration'; export const WORLD_STATE_MERKLE_TREE_SIZE = 'aztec.world_state.merkle_tree_size'; export const WORLD_STATE_DB_SIZE = 'aztec.world_state.db_size'; -export const PROOF_VERIFIER_COUNT = 'aztec.proof_verifier.count'; - -/** p2p metrics */ -export const P2P_PEER_COUNT = 'aztec.p2p.peer_count'; +export const PROOF_VERIFIER_COUNT = 'aztec.proof_verifier.count'; \ No newline at end of file From 73b6987c679e7402fa07c8379c6679dfcef23713 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:13:17 +0000 Subject: [PATCH 5/5] fmt --- yarn-project/p2p/src/client/p2p_client.ts | 4 ++-- yarn-project/p2p/src/mem_pools/instrumentation.ts | 10 ++++------ yarn-project/p2p/src/service/libp2p_service.ts | 2 +- yarn-project/p2p/src/service/peer_manager.ts | 1 - yarn-project/telemetry-client/src/metrics.ts | 2 +- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/yarn-project/p2p/src/client/p2p_client.ts b/yarn-project/p2p/src/client/p2p_client.ts index d3df549f28f5..dfc74254bd93 100644 --- a/yarn-project/p2p/src/client/p2p_client.ts +++ b/yarn-project/p2p/src/client/p2p_client.ts @@ -14,7 +14,8 @@ import { import { INITIAL_L2_BLOCK_NUM } from '@aztec/circuits.js/constants'; import { createDebugLogger } from '@aztec/foundation/log'; import { type AztecKVStore, type AztecMap, type AztecSingleton } from '@aztec/kv-store'; -import { Attributes, TelemetryClient, trackSpan, WithTracer } from '@aztec/telemetry-client'; +import { Attributes, type TelemetryClient, WithTracer, trackSpan } from '@aztec/telemetry-client'; +import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; import { type ENR } from '@chainsafe/enr'; @@ -25,7 +26,6 @@ import { type MemPools } from '../mem_pools/interface.js'; import { type TxPool } from '../mem_pools/tx_pool/index.js'; import { TX_REQ_PROTOCOL } from '../service/reqresp/interface.js'; import type { P2PService } from '../service/service.js'; -import { NoopTelemetryClient } from '@aztec/telemetry-client/noop'; /** * Enum defining the possible states of the p2p client. diff --git a/yarn-project/p2p/src/mem_pools/instrumentation.ts b/yarn-project/p2p/src/mem_pools/instrumentation.ts index 7f8c2f835452..19322f678a4c 100644 --- a/yarn-project/p2p/src/mem_pools/instrumentation.ts +++ b/yarn-project/p2p/src/mem_pools/instrumentation.ts @@ -8,9 +8,9 @@ export enum PoolName { } type MetricsLabels = { - objectInMempool : Metrics; + objectInMempool: Metrics; objectSize: Metrics; -} +}; /** * Get the metrics labels for a given pool name. @@ -23,14 +23,12 @@ function getMetricsLabels(name: PoolName): MetricsLabels { objectInMempool: Metrics.MEMPOOL_TX_COUNT, objectSize: Metrics.MEMPOOL_TX_SIZE, }; - } - else if (name === PoolName.ATTESTATION_POOL) { + } else if (name === PoolName.ATTESTATION_POOL) { return { objectInMempool: Metrics.MEMPOOL_ATTESTATIONS_COUNT, objectSize: Metrics.MEMPOOL_ATTESTATIONS_SIZE, }; - } - else if (name === PoolName.EPOCH_PROOF_QUOTE_POOL) { + } else if (name === PoolName.EPOCH_PROOF_QUOTE_POOL) { return { objectInMempool: Metrics.MEMPOOL_PROVER_QUOTE_COUNT, objectSize: Metrics.MEMPOOL_PROVER_QUOTE_SIZE, diff --git a/yarn-project/p2p/src/service/libp2p_service.ts b/yarn-project/p2p/src/service/libp2p_service.ts index be94cc1a8618..c94eb711dd2b 100644 --- a/yarn-project/p2p/src/service/libp2p_service.ts +++ b/yarn-project/p2p/src/service/libp2p_service.ts @@ -18,7 +18,7 @@ import { createDebugLogger } from '@aztec/foundation/log'; import { SerialQueue } from '@aztec/foundation/queue'; import { RunningPromise } from '@aztec/foundation/running-promise'; import type { AztecKVStore } from '@aztec/kv-store'; -import { Attributes, TelemetryClient, trackSpan, WithTracer } from '@aztec/telemetry-client'; +import { Attributes, type TelemetryClient, WithTracer, trackSpan } from '@aztec/telemetry-client'; import { type ENR } from '@chainsafe/enr'; import { type GossipSub, type GossipSubComponents, gossipsub } from '@chainsafe/libp2p-gossipsub'; diff --git a/yarn-project/p2p/src/service/peer_manager.ts b/yarn-project/p2p/src/service/peer_manager.ts index b70fb61c0930..edb0ee58f9a4 100644 --- a/yarn-project/p2p/src/service/peer_manager.ts +++ b/yarn-project/p2p/src/service/peer_manager.ts @@ -78,7 +78,6 @@ export class PeerManager { // Get current connections const connections = this.libP2PNode.getConnections(); - // Calculate how many connections we're looking to make const peersToConnect = this.config.maxPeerCount - connections.length; diff --git a/yarn-project/telemetry-client/src/metrics.ts b/yarn-project/telemetry-client/src/metrics.ts index f778ae4d92b3..9b33b770b565 100644 --- a/yarn-project/telemetry-client/src/metrics.ts +++ b/yarn-project/telemetry-client/src/metrics.ts @@ -78,4 +78,4 @@ export const WORLD_STATE_SYNC_DURATION = 'aztec.world_state.sync.duration'; export const WORLD_STATE_MERKLE_TREE_SIZE = 'aztec.world_state.merkle_tree_size'; export const WORLD_STATE_DB_SIZE = 'aztec.world_state.db_size'; -export const PROOF_VERIFIER_COUNT = 'aztec.proof_verifier.count'; \ No newline at end of file +export const PROOF_VERIFIER_COUNT = 'aztec.proof_verifier.count';