Foxray: a light error tracker for the Sentry SDKs. Runs inside Django (the admin is the UI) or on its own; SQLite or Postgres, nothing else. Not affiliated with Sentry.
danq9
0.1.2: the first PyPI release (v0.1.1 is already tagged at 05cc354, before the PyPI metadata)
58507e3
4 weeks ago
History
sdk_any_client.py · 877 bytes · 31 lines
| 1 | """A client that works on sentry-sdk 1.x and 2.x: errors and messages only (no crons, no new_scope). |
| 2 | |
| 3 | python tests/sdk_any_client.py <dsn> prints the reported ids as JSON on the last line""" |
| 4 | |
| 5 | import json |
| 6 | import sys |
| 7 | |
| 8 | import sentry_sdk |
| 9 | |
| 10 | |
| 11 | def checkout(n): |
| 12 | return 10 / n |
| 13 | |
| 14 | |
| 15 | def main(dsn: str) -> None: |
| 16 | sentry_sdk.init(dsn=dsn, traces_sample_rate=0, release="shop@1.0.0", environment="test") |
| 17 | ids = {"exc": []} |
| 18 | for _ in range(2): |
| 19 | try: |
| 20 | checkout(0) |
| 21 | except ZeroDivisionError as e: |
| 22 | ids["exc"].append(sentry_sdk.capture_exception(e)) |
| 23 | with sentry_sdk.push_scope() as scope: |
| 24 | scope.set_tag("tenant", "acme") |
| 25 | ids["msg"] = sentry_sdk.capture_message("Payment provider slow: 1234 ms", level="warning") |
| 26 | sentry_sdk.flush(timeout=10) |
| 27 | print(json.dumps(ids)) |
| 28 | |
| 29 | |
| 30 | if __name__ == "__main__": |
| 31 | main(sys.argv[1]) |