Skip to content

Commit

Permalink
Update metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
ensi321 committed Apr 16, 2024
1 parent 52d207e commit 1fab30d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/beacon-node/src/chain/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,9 @@ export class BeaconChain implements IBeaconChain {
secFromSlot,
slot,
});
this.metrics?.forkChoice.isBlockTimely.set(isHeadTimely ? 1 : 0);
if (notReorgedReason !== undefined) {
this.metrics?.forkChoice.notReorgedReason.set(notReorgedReason);

if (isHeadTimely && notReorgedReason !== undefined) {
this.metrics?.forkChoice.notReorgedReason.inc({reason: notReorgedReason});
}
return head;
} catch (e) {
Expand Down
8 changes: 3 additions & 5 deletions packages/beacon-node/src/metrics/metrics/beacon.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {ProducedBlockSource} from "@lodestar/types";
import {NotReorgedReason} from "@lodestar/fork-choice/lib/forkChoice/interface.js";
import {RegistryMetricCreator} from "../utils/registryMetricCreator.js";
import {BlockProductionStep, PayloadPreparationType} from "../../chain/produceBlock/index.js";

Expand Down Expand Up @@ -110,13 +111,10 @@ export function createBeaconMetrics(register: RegistryMetricCreator) {
name: "beacon_fork_choice_indices_count",
help: "Current count of indices in fork choice data structures",
}),
isBlockTimely: register.gauge({
name: "beacon_fork_choice_is_block_timely",
help: "Whether the current head (or original head if re-orged out because it is late) is timely or not",
}),
notReorgedReason: register.gauge({
notReorgedReason: register.gauge<{reason: NotReorgedReason}>({
name: "beacon_fork_choice_not_reorged_reason",
help: "Reason why the current head is not re-orged out",
labelNames: ["reason"],
}),
},

Expand Down

0 comments on commit 1fab30d

Please sign in to comment.