feat(sentry): remove Sentry
This commit is contained in:
		@@ -11,15 +11,6 @@ class Config:
 | 
			
		||||
    def __init__(self) -> None:
 | 
			
		||||
        """Configuration module."""
 | 
			
		||||
 | 
			
		||||
        # Sentry config needs to be processed first for loop prevention.
 | 
			
		||||
 | 
			
		||||
        self.__sentry_dsn: str = os.environ.get("SENTRY_DSN", "")
 | 
			
		||||
 | 
			
		||||
        self.__sentry_enabled: bool = bool(
 | 
			
		||||
            os.environ.get("SENTRY_ENABLED", "False").upper() == "TRUE"
 | 
			
		||||
            and self.__sentry_dsn != ""
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def environment(self) -> str:
 | 
			
		||||
        """Returns the current app lifecycle."""
 | 
			
		||||
@@ -30,19 +21,6 @@ class Config:
 | 
			
		||||
        """Returns the current app version."""
 | 
			
		||||
        return os.environ["APP_VERSION"]
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def sentry_enabled(self) -> bool:
 | 
			
		||||
        """Returns True if Sentry SDK is enabled, else False."""
 | 
			
		||||
        return self.__sentry_enabled
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def sentry_dsn(self) -> str:
 | 
			
		||||
        """Returns the Sentry DSN value if Sentry SDK is enabled AND
 | 
			
		||||
        Sentry DSN is set, else blank string."""
 | 
			
		||||
        if not self.__sentry_enabled:
 | 
			
		||||
            return ""
 | 
			
		||||
        return self.__sentry_dsn
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def bot_name(self) -> str:
 | 
			
		||||
        """Returns the bot name."""
 | 
			
		||||
 
 | 
			
		||||
@@ -4,9 +4,6 @@ import requests
 | 
			
		||||
 | 
			
		||||
from app.utils.config import config
 | 
			
		||||
 | 
			
		||||
if config.sentry_enabled:
 | 
			
		||||
    import sentry_sdk
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def __n8n_post(data: dict) -> bool:
 | 
			
		||||
    """Post data to N8N webhook URL.
 | 
			
		||||
@@ -46,12 +43,8 @@ def submit_task(summary, description, completion_date, requestor) -> bool:
 | 
			
		||||
        "description": description,
 | 
			
		||||
        "completiondate": completion_date,
 | 
			
		||||
    }
 | 
			
		||||
    if not config.sentry_enabled:
 | 
			
		||||
        _data = __n8n_post(data=data)
 | 
			
		||||
        return _data
 | 
			
		||||
    with sentry_sdk.start_transaction(name="submit_task"):
 | 
			
		||||
        _data = __n8n_post(data=data)
 | 
			
		||||
        return _data
 | 
			
		||||
    _data = __n8n_post(data=data)
 | 
			
		||||
    return _data
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_tasks(requestor) -> bool:
 | 
			
		||||
@@ -64,23 +57,12 @@ def get_tasks(requestor) -> bool:
 | 
			
		||||
        bool: True if successful, else False.
 | 
			
		||||
    """
 | 
			
		||||
    headers: dict = {"Content-Type": "application/json"}
 | 
			
		||||
    if not config.sentry_enabled:
 | 
			
		||||
        resp: requests.Response = requests.get(
 | 
			
		||||
            url=config.n8n_webhook_url,
 | 
			
		||||
            headers=headers,
 | 
			
		||||
            timeout=10,
 | 
			
		||||
            verify=False,
 | 
			
		||||
            params={"requestor": requestor},
 | 
			
		||||
        )
 | 
			
		||||
        _data = bool(resp.status_code == 200)
 | 
			
		||||
        return _data
 | 
			
		||||
    with sentry_sdk.start_transaction(name="get_tasks"):
 | 
			
		||||
        resp: requests.Response = requests.get(
 | 
			
		||||
            url=config.n8n_webhook_url,
 | 
			
		||||
            headers=headers,
 | 
			
		||||
            timeout=10,
 | 
			
		||||
            verify=False,
 | 
			
		||||
            params={"requestor": requestor},
 | 
			
		||||
        )
 | 
			
		||||
        _data = bool(resp.status_code == 200)
 | 
			
		||||
        return _data
 | 
			
		||||
    resp: requests.Response = requests.get(
 | 
			
		||||
        url=config.n8n_webhook_url,
 | 
			
		||||
        headers=headers,
 | 
			
		||||
        timeout=10,
 | 
			
		||||
        verify=False,
 | 
			
		||||
        params={"requestor": requestor},
 | 
			
		||||
    )
 | 
			
		||||
    _data = bool(resp.status_code == 200)
 | 
			
		||||
    return _data
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user