diff options
author | 2024-03-26 17:32:20 +0000 | |
---|---|---|
committer | 2024-03-26 17:35:05 +0000 | |
commit | f9328d2dee7a2a8543ab133c0c9a955da0c5446a (patch) | |
tree | b5a3b112915919b359d5f8230a7bb81857455581 | |
parent | Bump emoji from 2.10.1 to 2.11.0 (#2974) (diff) |
Capture cog load times using sentry performance tracking
-rw-r--r-- | bot/bot.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bot/bot.py b/bot/bot.py index 84caf1873..fa3617f1b 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -6,7 +6,7 @@ import aiohttp from discord.errors import Forbidden from pydis_core import BotBase from pydis_core.utils.error_handling import handle_forbidden_from_block -from sentry_sdk import push_scope +from sentry_sdk import push_scope, start_transaction from bot import constants, exts from bot.log import get_logger @@ -29,6 +29,11 @@ class Bot(BotBase): super().__init__(*args, **kwargs) + async def load_extension(self, name: str, *args, **kwargs) -> None: + """Extend D.py's load_extension function to also record sentry performance stats.""" + with start_transaction(op="cog-load", name=name): + await super().load_extension(name, *args, **kwargs) + async def ping_services(self) -> None: """A helper to make sure all the services the bot relies on are available on startup.""" # Connect Site/API |