Skip to content

Commit

Permalink
Add Metrics
Browse files Browse the repository at this point in the history
These metrics were used by our current metrics and alerting system to determine whether or not the poster is running successfully. We add these back so we can use similar metrics.
hayesgm committed Jul 31, 2020
1 parent f3d798f commit a45b500
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions poster/src/index.ts
Original file line number Diff line number Diff line change
@@ -64,12 +64,37 @@ async function run() {
web3.eth.transactionConfirmationBlocks = 10;
}

try {
await main(sources, poster_key, view_address, view_function, gas_limit, gas_price, price_delta, assets, mocked_world, pairs, web3);
console.log('Poster run completed successfully');
} catch (e) {
console.error(`Poster failed to run`, e);
}
await main(sources, poster_key, view_address, view_function, gas_limit, gas_price, price_delta, assets, mocked_world, pairs, web3);

let success_log = {
message: "Price Feed Poster run completed successfully",
metric_name: 'PriceFeed-PosterHealth',
labels: {
price_feed_poster_healthy: 1
}
};

process.stderr.write(JSON.stringify(success_log) + "\n", () => {
process.exit(0);
});
}

run();
run().catch((e) => {
console.error(`Error encountered: ${e}`);
console.error(e);
console.log(e.stack)
console.log

let error_log = {
message: "Price run failed",
metric_name: 'PriceFeed-PosterHealth',
labels: {
price_feed_poster_healthy: 0,
error: e.toString()
}
};

process.stderr.write(JSON.stringify(error_log) + "\n", () => {
process.exit(1);
})
});

0 comments on commit a45b500

Please sign in to comment.