Skip to content

Commit

Permalink
Track total unknown parent syncs (#3113)
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion authored Sep 11, 2021
1 parent c357ef9 commit 6fae286
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/lodestar/src/metrics/metrics/lodestar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@ export function createLodestarMetrics(
name: "lodestar_sync_status",
help: "Range sync status: [Stalled, SyncingFinalized, SyncingHead, Synced]",
}),
syncUnknownParentSyncs: register.gauge({
name: "lodestar_sync_unknown_parent_syncs_total",
help: "Total number of unknown parent syncs",
}),

// Validator monitoring

Expand Down
4 changes: 4 additions & 0 deletions packages/lodestar/src/sync/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ import {fetchUnknownBlockRoot, getPeerSyncType, PeerSyncType} from "./utils";
import {MIN_EPOCH_TO_START_GOSSIP} from "./constants";
import {SyncState, SyncChainDebugState, syncStateMetric} from "./interface";
import {ISyncOptions} from "./options";
import {IMetrics} from "../metrics";

export class BeaconSync implements IBeaconSync {
private readonly config: IBeaconConfig;
private readonly logger: ILogger;
private readonly network: INetwork;
private readonly chain: IBeaconChain;
private readonly metrics: IMetrics | null;
private readonly opts: ISyncOptions;

private readonly rangeSync: RangeSync;
Expand All @@ -42,6 +44,7 @@ export class BeaconSync implements IBeaconSync {
this.config = config;
this.network = network;
this.chain = chain;
this.metrics = metrics;
this.logger = logger;
this.rangeSync = new RangeSync(modules, this.opts);
this.slotImportTolerance = SLOTS_PER_EPOCH;
Expand Down Expand Up @@ -207,6 +210,7 @@ export class BeaconSync implements IBeaconSync {
return;
}

this.metrics?.syncUnknownParentSyncs.inc(1);
this.processingRoots.add(parentRootHex);
this.logger.verbose("Finding block for unknown ancestor root", {parentRootHex});

Expand Down

0 comments on commit 6fae286

Please sign in to comment.