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

[EXP-35-236] sentry release tracking + custom tags #236

Merged
merged 2 commits into from
Feb 8, 2022
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
3 changes: 2 additions & 1 deletion services/dashboard/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ x-common-envs: &common-envs
- EXPLORER:
- SLEEP_SECONDS:
- SKIP_WALLET_STATS:
- ENV:
- SENTRY_ENVIRONMENT: ${SENTRY_ENVIRONMENT:-development}
- SENTRY_RELEASE:
- SENTRY_DSN:

x-common-historical-envs: &common-historical-envs
Expand Down
3 changes: 2 additions & 1 deletion services/ipfs/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ services:
- IPFS_NODE_ADDRESS
- IPFS_NODE_KEY
- IPFS_NODE_SECRET
- ENV
- SENTRY_RELEASE
- SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT:-development}
- SENTRY_DSN
volumes:
- solidity_compilers:/root/.solcx
Expand Down
3 changes: 2 additions & 1 deletion services/tvl/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ services:
- PGUSER=postgres
- PGHOST=postgres
- PGPASS=yearn
- ENV
- SENTRY_RELEASE
- SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT:-development}
- SENTRY_DSN
volumes:
- solidity_compilers:/root/.solcx
Expand Down
8 changes: 3 additions & 5 deletions yearn/sentry.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import os

from brownie import chain
from brownie import chain, web3
from sentry_sdk import Hub, capture_message, init, set_tag, utils
from sentry_sdk.integrations.threading import ThreadingIntegration

from yearn.networks import Network

environment = os.getenv('ENV', 'DEVELOPMENT')

def before_send(event, hint):
# custom event parsing goes here
return event

def set_custom_tags():
set_tag("chain_id", chain.id)
set_tag("network_label", Network.label(chain.id))
set_tag("network", Network(chain.id).name)
set_tag("web3_client_version", web3.clientVersion)


def setup_sentry():
Expand All @@ -29,7 +28,6 @@ def setup_sentry():
# We recommend adjusting this value in production.
traces_sample_rate=1.0,
shutdown_timeout=5,
environment=environment,
before_send=before_send,
debug=False,
integrations=[ThreadingIntegration(propagate_hub=True)],
Expand Down