Skip to content

Commit 5d2c6c7

Browse files
committed
update
1 parent 97105fd commit 5d2c6c7

1 file changed

Lines changed: 25 additions & 6 deletions

File tree

pyepsilla/vectordb/sentry.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@
44
# Sentry collects crash reports and performance numbers
55
# It is possible to turn off data collection using an environment variable named "SENTRY_DISABLE"
66

7-
import os, sys, platform, uuid, hashlib, socket, requests
7+
import hashlib
8+
import os
9+
import platform
10+
import socket
11+
import sys
12+
import uuid
13+
14+
import requests
815
import sentry_sdk
916
from sentry_sdk.integrations.atexit import AtexitIntegration
17+
1018
from .version import __version__
1119

1220
CONFIG_URL = "https://config.epsilla.com/candidate.json"
13-
SENTRY_DSN = "https://c705adb9ba9a5750ab5719c69021e3b0@o4505952171917312.ingest.sentry.io/4506031458746368"
21+
SENTRY_DSN = "https://7b7043e213409f7125c511127697d668@o4506949201428480.ingest.us.sentry.io/4506949333680128"
1422

1523
try:
1624
r = requests.get(CONFIG_URL, headers={"Agent": "PyEpsilla"}, timeout=2)
@@ -19,15 +27,18 @@
1927
except Exception:
2028
pass
2129

30+
2231
def callback(pending, timeout):
2332
sys.stderr.flush()
24-
33+
34+
2535
def get_external_ip() -> str:
2636
try:
2737
return requests.get("https://api.ipify.org", timeout=2).text
2838
except Exception:
2939
return "NA"
3040

41+
3142
def init_sentry():
3243
if "SENTRY_DISABLE" not in os.environ:
3344
try:
@@ -37,10 +48,18 @@ def init_sentry():
3748
sentry_sdk.set_tag("uid", uid)
3849
sentry_sdk.set_tag("internal_ip", internal_ip)
3950
sentry_sdk.set_tag("external_ip", external_ip)
40-
sentry_sdk.set_user({'ip_address': '{{auto}}'})
41-
sentry_sdk.set_user({"username": "{}-{}-{}".format(socket.gethostname(), internal_ip, external_ip)})
51+
sentry_sdk.set_user({"ip_address": "{{auto}}"})
52+
sentry_sdk.set_user(
53+
{
54+
"username": "{}-{}-{}".format(
55+
socket.gethostname(), internal_ip, external_ip
56+
)
57+
}
58+
)
4259
sentry_sdk.set_tag("version", platform.version())
43-
sentry_sdk.set_tag("platform", "{}-{}".format(sys.platform, platform.machine()))
60+
sentry_sdk.set_tag(
61+
"platform", "{}-{}".format(sys.platform, platform.machine())
62+
)
4463
sentry_sdk.init(
4564
dsn=SENTRY_DSN,
4665
release=__version__,

0 commit comments

Comments
 (0)