Skip to content

Commit

Permalink
Add health endpoint (#63)
Browse files Browse the repository at this point in the history
* add /health endpoint

* remove comment

* change content type to application/json + lint & prettier
  • Loading branch information
marcellorigotti authored Jul 10, 2024
1 parent dcc6c81 commit b3369db
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
5 changes: 5 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,8 @@ app.get('/metrics', async (req, res) => {
(await arbitrumRegistry.metrics()),
);
});

app.get('/health', async (req, res) => {
res.set('Content-Type', 'application/json');
res.end('Online');
});
42 changes: 21 additions & 21 deletions src/metrics/chainflip/countEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,27 @@ export const countEvents = async (context: Context): Promise<void> => {

if (registry.getSingleMetric(metricName) === undefined) {
registry.registerMetric(metric);
metric.labels("governance:Approved").inc();
metric.labels("governance:Executed").inc();
metric.labels("governance:Proposed").inc();
metric.labels("ethereumBroadcaster:BroadcastAborted").inc();
metric.labels("polkadotBroadcaster:BroadcastAborted").inc();
metric.labels("arbitrumBroadcaster:BroadcastAborted").inc();
metric.labels("bitcoinBroadcaster:BroadcastAborted").inc();
metric.labels("solanaBroadcaster:BroadcastAborted").inc();
metric.labels("bitcoinBroadcaster:BroadcastAttemptTimeout").inc();
metric.labels("ethereumBroadcaster:BroadcastAttemptTimeout").inc();
metric.labels("polkadotBroadcaster:BroadcastAttemptTimeout").inc();
metric.labels("arbitrumBroadcaster:BroadcastAttemptTimeout").inc();
metric.labels("solanaBroadcaster:BroadcastAttemptTimeout").inc();
metric.labels("evmThresholdSigner:RetryRequested").inc();
metric.labels("bitcoinThresholdSigner:RetryRequested").inc();
metric.labels("polkadotThresholdSigner:RetryRequested").inc();
metric.labels("solanaThresholdSigner:RetryRequested").inc();
metric.labels("evmThresholdSigner:KeygenFailure").inc();
metric.labels("bitcoinThresholdSigner:KeygenFailure").inc();
metric.labels("polkadotThresholdSigner:KeygenFailure").inc();
metric.labels("solanaThresholdSigner:KeygenFailure").inc();
metric.labels('governance:Approved').inc();
metric.labels('governance:Executed').inc();
metric.labels('governance:Proposed').inc();
metric.labels('ethereumBroadcaster:BroadcastAborted').inc();
metric.labels('polkadotBroadcaster:BroadcastAborted').inc();
metric.labels('arbitrumBroadcaster:BroadcastAborted').inc();
metric.labels('bitcoinBroadcaster:BroadcastAborted').inc();
metric.labels('solanaBroadcaster:BroadcastAborted').inc();
metric.labels('bitcoinBroadcaster:BroadcastAttemptTimeout').inc();
metric.labels('ethereumBroadcaster:BroadcastAttemptTimeout').inc();
metric.labels('polkadotBroadcaster:BroadcastAttemptTimeout').inc();
metric.labels('arbitrumBroadcaster:BroadcastAttemptTimeout').inc();
metric.labels('solanaBroadcaster:BroadcastAttemptTimeout').inc();
metric.labels('evmThresholdSigner:RetryRequested').inc();
metric.labels('bitcoinThresholdSigner:RetryRequested').inc();
metric.labels('polkadotThresholdSigner:RetryRequested').inc();
metric.labels('solanaThresholdSigner:RetryRequested').inc();
metric.labels('evmThresholdSigner:KeygenFailure').inc();
metric.labels('bitcoinThresholdSigner:KeygenFailure').inc();
metric.labels('polkadotThresholdSigner:KeygenFailure').inc();
metric.labels('solanaThresholdSigner:KeygenFailure').inc();
}
if (registry.getSingleMetric(metricExtrinsicFailedName) === undefined)
registry.registerMetric(metricExtrinsicFailed);
Expand Down
2 changes: 1 addition & 1 deletion src/metrics/polkadot/countEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const countEvents = async (context: Context): Promise<void> => {

if (registry.getSingleMetric(metricName) === undefined) {
registry.registerMetric(metric);
metric.labels("system:CodeUpdated").inc();
metric.labels('system:CodeUpdated').inc();
}

for (const { event } of events) {
Expand Down

0 comments on commit b3369db

Please sign in to comment.