-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
47 lines (34 loc) · 1.17 KB
/
main.py
File metadata and controls
47 lines (34 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import os
import signal
import time
import sentry_sdk
def signal_handler(sig, frame):
print("SIGINT received")
sentry_sdk.capture_message("SIGINT received")
with sentry_sdk.start_transaction(name="xxxpython312") as transaction:
transaction.set_status("ok")
for x in range(10):
with sentry_sdk.start_span(description=f"xxxchild{x} descriptions") as span:
span.set_data("x", x)
import sys
sys.exit(0)
def main():
sentry_settings = {
"dsn": os.getenv("SENTRY_DSN", None),
"environment": os.getenv("ENV", "local"),
"traces_sample_rate": 1.0,
# "send_default_pii": True,
"debug": True,
# "integrations": [],
}
print(f"Sentry Settings: {sentry_settings}")
sentry_sdk.init(**sentry_settings)
signal.signal(signal.SIGINT, signal_handler)
with sentry_sdk.start_transaction(name="python312") as transaction:
transaction.set_status("ok")
for x in range(10):
with sentry_sdk.start_span(description=f"child{x} descriptions") as span:
span.set_data("x", x)
time.sleep(10)
if __name__ == "__main__":
main()