Skip to content

Commit

Permalink
add cf_block_weight (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcellorigotti authored Nov 4, 2024
1 parent 4190162 commit 615cd2a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/metrics/chainflip/gaugeBlockWeight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ export const gaugeBlockWeight = async (context: Context): Promise<void> => {
logger.debug(`Scraping ${metricName}`);

try {
const systemBlockWeights = await api.consts.system.blockWeights;
logger.debug(systemBlockWeights.toJSON());

const currentBlockWeight = await api.query.system.blockWeight();
logger.debug(currentBlockWeight.toJSON());
const currentBlockWeight = (await api.query.system.blockWeight()).toJSON();
const totalWeight: number =
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
currentBlockWeight.mandatory.refTime +
currentBlockWeight.normal.refTime +
currentBlockWeight.operational.refTime;
metric.set(totalWeight);
} catch (e) {
logger.error(e);
}
Expand Down
3 changes: 2 additions & 1 deletion src/watchers/chainflip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
gaugeWitnessChainTracking,
gaugeWitnessCount,
gaugeSolanaNonces,
gaugeBlockWeight,
} from '../metrics/chainflip';
import { ApiPromise, WsProvider } from '@polkadot/api';
import { customRpcs } from '../utils/customRpcSpecification';
Expand Down Expand Up @@ -90,7 +91,7 @@ async function startWatcher(context: Context) {
gaugeBuildVersion(context);
gaugeValidatorStatus(context);
gaugeBtcUtxos(context);
// gaugeBlockWeight(context);
gaugeBlockWeight(context);
gaugePendingRedemptions(context);
gaugePendingBroadcast(context);
gaugeTssRetryQueues(context);
Expand Down

0 comments on commit 615cd2a

Please sign in to comment.