Skip to content

Commit

Permalink
Add perf counter to healthcheck loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-z committed Sep 8, 2023
1 parent e25ad06 commit 890c49f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from discord.ext import tasks
from sentry_sdk.integrations.logging import LoggingIntegration
from sentry_sdk.crons import monitor
from time import perf_counter


sentry_logging = LoggingIntegration(
Expand Down Expand Up @@ -80,7 +81,10 @@ async def health_endpoint(_request):
@tasks.loop(seconds=60)
async def healthcheck_loop():
logger.info(f'Healthcheck loop running. {client.is_closed()=}')
start = perf_counter()
monitor_once()
stop = perf_counter()
logger.info(f"Healthcheck loop completed in {stop-start:.2f} seconds")

@monitor(monitor_slug='discord-provisioner-bot')
def monitor_once():
Expand Down

0 comments on commit 890c49f

Please sign in to comment.