Skip to content

Commit

Permalink
Merge main into force-exit
Browse files Browse the repository at this point in the history
  • Loading branch information
cyc60 committed Dec 26, 2024
2 parents 8e95596 + 4150f4a commit 4505497
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 116 deletions.
273 changes: 157 additions & 116 deletions poetry.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ python = "^3.10"
sw-utils = {git = "https://github.com/stakewise/sw-utils.git", rev = "v0.7.3"}
python-decouple = "==3.8"
aiohttp = "==3.10.11"
sentry-sdk = "==2.19.2"

[tool.poetry.group.dev.dependencies]
pylint = "==3.0.1"
Expand Down
15 changes: 15 additions & 0 deletions src/common/sentry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from src.common.settings import NETWORK, SENTRY_DSN


def setup_sentry() -> None:
if not SENTRY_DSN:
return
# pylint: disable-next=import-outside-toplevel
import sentry_sdk

sentry_sdk.init(
SENTRY_DSN,
traces_sample_rate=0.1,
environment=NETWORK.value,
)
sentry_sdk.set_tag('network', NETWORK)
1 change: 1 addition & 0 deletions src/common/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

EXECUTION_TRANSACTION_TIMEOUT: int = config('EXECUTION_TRANSACTION_TIMEOUT', default=300, cast=int)

SENTRY_DSN: str = config('SENTRY_DSN', default='')

NETWORK = config('NETWORK')
network_config = NETWORKS[NETWORK]
2 changes: 2 additions & 0 deletions src/update_ltv.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sys

from src.common.logs import setup_gql_log_level
from src.common.sentry import setup_sentry
from src.ltv.tasks import update_vault_max_ltv_user

logger = logging.getLogger(__name__)
Expand All @@ -13,6 +14,7 @@ async def main() -> None:


try:
setup_sentry()
setup_gql_log_level()
asyncio.run(main())
except Exception as e:
Expand Down
2 changes: 2 additions & 0 deletions src/update_price.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import logging
import sys

from src.common.sentry import setup_sentry
from src.price.tasks import check_and_sync

logger = logging.getLogger(__name__)


try:
setup_sentry()
check_and_sync()
except Exception as e:
logger.error(e)
Expand Down

0 comments on commit 4505497

Please sign in to comment.