-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain2.py
More file actions
38 lines (27 loc) · 716 Bytes
/
main2.py
File metadata and controls
38 lines (27 loc) · 716 Bytes
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
import os
import sentry_sdk
def main():
sentry_sdk.init(
dsn=os.environ["SENTRY_DSN"],
traces_sample_rate=1.0,
debug=True,
)
client = sentry_sdk.Client(
dsn="http://123@localhost:9999/0",
)
scope = sentry_sdk.get_current_scope().fork()
scope.set_client(client)
event = {
"message": "Hello, world!",
"level": "error",
}
with sentry_sdk.use_scope(scope):
event_id = scope.capture_event(event)
print(event_id)
# for i in range(100):
# try:
# division_by_zero = 1 / 0
# except Exception as e:
# sentry_sdk.capture_exception(e)
if __name__ == "__main__":
main()