rssnyder / discord-stock-ticker

Add live stock & crypto prices to your discord sidebar.
https://rssnyder.github.io/discord-stock-ticker/
MIT License
293 stars 113 forks source link

health checks #63

Closed jr0dd closed 3 years ago

jr0dd commented 3 years ago

Adding a proper health check to query on /health would be a nice feature to have. If the api doesn't respond k8s can signal reboot.

rssnyder commented 3 years ago

I am starting work on this.

My initial plan is to expose the seconds since the last time a ticker was updated.

Current beta example: time_since_last_update{ticker="smooth-love-potion",type="ticker"} 11

Most likely end state will be the timestamp of the last update: time_of_last_update{ticker="smooth-love-potion",type="ticker"} 1.6295890054337895e+09

Then we can use some scrape config + grafana query setup to get the "time since last update"

# HELP time_of_last_update Number of seconds since the ticker last updated.
# TYPE time_of_last_update gauge
time_of_last_update{guild="High Life Lounge",ticker="Cryptos",type="board"} 1.6295912192707872e+09
time_of_last_update{guild="High Life Lounge",ticker="dogecoin",type="ticker"} 1.629591218555943e+09
time_of_last_update{guild="High Life Lounge",ticker="ethereum",type="gas"} 1.6295912183680356e+09
time_of_last_update{guild="High Life Lounge",ticker="ethereum-0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",type="holders"} 1.629591218312564e+09
time_of_last_update{guild="High Life Lounge",ticker="ethereum-0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",type="token"} 1.6295912184257197e+09