diff --git a/automon/integrations/sentryio/client.py b/automon/integrations/sentryio/client.py index 61afbbe8..991ceabc 100644 --- a/automon/integrations/sentryio/client.py +++ b/automon/integrations/sentryio/client.py @@ -40,19 +40,19 @@ def __init__(self, dsn: str = None, config: SentryConfig = None, *args, **kwargs def __repr__(self): return f'{self.__dict__}' - async def isConnected(self): - if await self.config.is_ready(): + def isConnected(self): + if self.config.is_ready(): return True - async def setLevel(self, level): + def setLevel(self, level): return self.config.setLevel(level) - async def capture_exception(self, exception): + def capture_exception(self, exception): if self.isConnected(): return _capture_exception(exception) return False - async def capture_event(self, message: str, level): + def capture_event(self, message: str, level): if self.isConnected(): return _capture_event(dict( message=message, @@ -60,30 +60,30 @@ async def capture_event(self, message: str, level): )) return False - async def capture_message(self, message): - if await self.isConnected(): + def capture_message(self, message): + if self.isConnected(): return _capture_message(message) return False - async def error(self, msg: str): - await self.setLevel('error') - return await self.capture_message(f'{msg}') + def error(self, msg: str): + self.setLevel('error') + return self.capture_message(f'{msg}') - async def warning(self, msg: str): - await self.setLevel('warning') - return await self.capture_message(f'{msg}') + def warning(self, msg: str): + self.setLevel('warning') + return self.capture_message(f'{msg}') - async def warn(self, msg: str): + def warn(self, msg: str): return self.warning(msg=msg) - async def info(self, msg: str): - await self.setLevel('info') - return await self.capture_message(f'{msg}') + def info(self, msg: str): + self.setLevel('info') + return self.capture_message(f'{msg}') - async def debug(self, msg: str): - await self.setLevel('debug') - return await self.capture_message(f'{msg}') + def debug(self, msg: str): + self.setLevel('debug') + return self.capture_message(f'{msg}') - async def critical(self, msg: str): - await self.setLevel('critical') - return await self.capture_message(f'{msg}') + def critical(self, msg: str): + self.setLevel('critical') + return self.capture_message(f'{msg}') diff --git a/automon/integrations/sentryio/config.py b/automon/integrations/sentryio/config.py index e683302c..23805e44 100644 --- a/automon/integrations/sentryio/config.py +++ b/automon/integrations/sentryio/config.py @@ -59,10 +59,10 @@ def __init__( def __repr__(self): return f'{self.__dict__}' - async def is_ready(self): + def is_ready(self): if self.dsn: return True - async def setLevel(self, level): + def setLevel(self, level): self.level = level return sentry_sdk.set_level(self.level) diff --git a/automon/integrations/sentryio/tests/test_sentryio.py b/automon/integrations/sentryio/tests/test_sentryio.py index 79522e64..26038626 100644 --- a/automon/integrations/sentryio/tests/test_sentryio.py +++ b/automon/integrations/sentryio/tests/test_sentryio.py @@ -1,5 +1,4 @@ import unittest -import asyncio from datetime import datetime @@ -11,11 +10,11 @@ class SentryClientTest(unittest.TestCase): - async def test_sentry(self): - if await s.isConnected(): - self.assertTrue(asyncio.run(s.capture_exception(Exception(f'test capture_exception')))) - self.assertTrue(asyncio.run(s.capture_message(f'test capture_message'))) - # self.assertTrue(asyncio.run(s.capture_event('test capture_event', 'warning'))) + def test_sentry(self): + if s.isConnected(): + self.assertTrue(s.capture_exception(Exception(f'test capture_exception'))) + self.assertTrue(s.capture_message(f'test capture_message')) + # self.assertTrue(s.capture_event('test capture_event', 'warning')) if __name__ == '__main__': diff --git a/automon/integrations/sentryio/tests/test_sentryio_callback.py b/automon/integrations/sentryio/tests/test_sentryio_callback.py index 6c176957..20ff6a66 100644 --- a/automon/integrations/sentryio/tests/test_sentryio_callback.py +++ b/automon/integrations/sentryio/tests/test_sentryio_callback.py @@ -1,5 +1,4 @@ import unittest -import asyncio from automon import log from automon.integrations.sentryio.client import SentryClient @@ -11,7 +10,7 @@ class CallbackTest(unittest.TestCase): - async def test_sentry(self): + def test_sentry(self): self.assertIsNone(logger.info('test')) self.assertIsNone(logger.debug('test')) self.assertIsNone(logger.error('test'))