Skip to content

Commit

Permalink
Request counts
Browse files Browse the repository at this point in the history
  • Loading branch information
MOZGIII committed Nov 6, 2024
1 parent 2d7f416 commit 0ddddf1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/registerMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export default (api: ApiPromise) => {
name: "humanode_state_session_validators_count",
help: "count of session validators",
async collect() {
const validators = await api.query.session.validators();
this.set((validators.toJSON() as string[]).length);
const validators = await api.query.session.validators.size();
this.set(validators.toNumber());
},
});
}
Expand All @@ -19,8 +19,8 @@ export default (api: ApiPromise) => {
help: "count of bioauth active authentications",
async collect() {
const activeAuthentications =
await api.query.bioauth.activeAuthentications();
this.set((activeAuthentications.toJSON() as string[]).length);
await api.query.bioauth.activeAuthentications.size();
this.set(activeAuthentications.toNumber());
},
});
}
Expand All @@ -31,8 +31,8 @@ export default (api: ApiPromise) => {
help: "count of consumed auth ticket nonces",
async collect() {
const consumedAuthTicketNonces =
await api.query.bioauth.consumedAuthTicketNonces();
this.set((consumedAuthTicketNonces.toJSON() as string[]).length);
await api.query.bioauth.consumedAuthTicketNonces.size();
this.set(consumedAuthTicketNonces.toNumber());
},
});
}
Expand All @@ -53,8 +53,8 @@ export default (api: ApiPromise) => {
name: "humanode_state_session_next_keys_count",
help: "count of the session keys to use in the next session",
async collect() {
const nextKeys = await api.query.session.nextKeys.entries();
this.set(nextKeys.length);
const nextKeys = await api.query.session.nextKeys.size();
this.set(nextKeys.toNumber());
},
});
}
Expand All @@ -64,8 +64,8 @@ export default (api: ApiPromise) => {
name: "humanode_state_offences_reports_count",
help: "count of the offence reports",
async collect() {
const reports = await api.query.offences.reports.entries();
this.set(reports.length);
const reports = await api.query.offences.reports.size();
this.set(reports.toNumber());
},
});
}
Expand Down

0 comments on commit 0ddddf1

Please sign in to comment.