Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sentry #6

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,128 changes: 605 additions & 523 deletions poetry.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "periodic-tasks"
version = "v0.1.0"
version = "v0.1.1"
description = ""
authors = ["StakeWise Labs <info@stakewise.io>"]
readme = "README.md"
Expand All @@ -12,6 +12,7 @@ gql = {extras = ["requests"], version = "==3.5.0"}
sw-utils = {git = "https://github.com/stakewise/sw-utils.git", rev = "v0.6.25"}
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)
2 changes: 2 additions & 0 deletions src/common/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
EXECUTION_ENDPOINT: str = config('EXECUTION_ENDPOINT', default='')
HOT_WALLET_PRIVATE_KEY: str = config('HOT_WALLET_PRIVATE_KEY')

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

NETWORK: Network = config('NETWORK', cast=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
@@ -1,11 +1,13 @@
import logging
import sys

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

logger = logging.getLogger(__name__)

try:
setup_sentry()
update_vault_max_ltv_user()
except Exception as e:
logger.error(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
Loading