watchdock-errors 0.2.1__tar.gz → 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {watchdock_errors-0.2.1/src/watchdock_errors.egg-info → watchdock_errors-0.2.3}/PKG-INFO +1 -1
  2. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/src/watchdock_errors/__init__.py +4 -2
  3. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/src/watchdock_errors/event.py +5 -0
  4. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3/src/watchdock_errors.egg-info}/PKG-INFO +1 -1
  5. watchdock_errors-0.2.3/src/watchdock_errors.egg-info/scm_version.json +8 -0
  6. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/tests/test_event.py +18 -0
  7. watchdock_errors-0.2.1/src/watchdock_errors.egg-info/scm_version.json +0 -8
  8. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/.github/workflows/ci.yml +0 -0
  9. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/.github/workflows/release.yml +0 -0
  10. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/.gitignore +0 -0
  11. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/README.md +0 -0
  12. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/pyproject.toml +0 -0
  13. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/setup.cfg +0 -0
  14. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/src/watchdock_errors/client.py +0 -0
  15. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/src/watchdock_errors/config.py +0 -0
  16. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/src/watchdock_errors/integrations/__init__.py +0 -0
  17. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/src/watchdock_errors/integrations/django.py +0 -0
  18. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/src/watchdock_errors/integrations/fastapi.py +0 -0
  19. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/src/watchdock_errors/utils.py +0 -0
  20. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/src/watchdock_errors.egg-info/SOURCES.txt +0 -0
  21. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/src/watchdock_errors.egg-info/dependency_links.txt +0 -0
  22. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/src/watchdock_errors.egg-info/requires.txt +0 -0
  23. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/src/watchdock_errors.egg-info/scm_file_list.json +0 -0
  24. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/src/watchdock_errors.egg-info/top_level.txt +0 -0
  25. {watchdock_errors-0.2.1 → watchdock_errors-0.2.3}/tests/test_client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: watchdock-errors
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Application error tracking SDK for the Watchdock platform
5
5
  License: MIT
6
6
  Keywords: error-tracking,observability,watchdock
@@ -105,14 +105,14 @@ def capture_exception(exc: BaseException | None = None, request_context: dict |
105
105
  logger.debug("watchdock_errors: event dropped by before_send hook")
106
106
 
107
107
 
108
- def capture_message(message: str, request_context: dict | None = None) -> None:
108
+ def capture_message(message: str, level: str = "info", request_context: dict | None = None) -> None:
109
109
  """Capture an arbitrary message string and send it to Watchdock."""
110
110
  if _client is None or _config is None:
111
111
  return
112
112
 
113
113
  from .event import build_event
114
114
 
115
- event = build_event(None, _config, message=message, request_context=request_context)
115
+ event = build_event(None, _config, message=message, level=level, request_context=request_context)
116
116
  if event is not None:
117
117
  logger.info("watchdock_errors: capturing message — %s", message)
118
118
  _client.capture(event)
@@ -139,6 +139,8 @@ def _send_init_ping(config: "SDKConfig") -> None:
139
139
  import requests
140
140
 
141
141
  def _ping() -> None:
142
+ import time
143
+ time.sleep(5) # Wait for the server to be ready before pinging
142
144
  try:
143
145
  requests.post(
144
146
  f"{config.endpoint.rstrip('/')}/api/v1/errors/sdk-init/",
@@ -13,6 +13,7 @@ def build_event(
13
13
  exc: BaseException | None,
14
14
  config: SDKConfig,
15
15
  message: str | None = None,
16
+ level: str | None = None,
16
17
  request_context: dict | None = None,
17
18
  ) -> dict | None:
18
19
  """
@@ -22,6 +23,9 @@ def build_event(
22
23
  """
23
24
  now = datetime.datetime.now(datetime.timezone.utc).isoformat()
24
25
 
26
+ if level is None:
27
+ level = "error" if exc is not None else "info"
28
+
25
29
  if exc is not None:
26
30
  exception_data = {
27
31
  "type": type(exc).__name__,
@@ -41,6 +45,7 @@ def build_event(
41
45
  "project_key": config.api_key,
42
46
  "timestamp": now,
43
47
  "environment": config.environment,
48
+ "level": level,
44
49
  "title": title,
45
50
  "sdk": {
46
51
  "name": config.sdk_name,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: watchdock-errors
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary: Application error tracking SDK for the Watchdock platform
5
5
  License: MIT
6
6
  Keywords: error-tracking,observability,watchdock
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.2.3",
3
+ "distance": 0,
4
+ "node": "g552866cfdf269b7f1dd8cf126bc25eb5623849cb",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-07-01"
8
+ }
@@ -30,6 +30,24 @@ def test_build_event_from_message(config):
30
30
  assert event is not None
31
31
  assert event["exception"]["message"] == "Stripe webhook failed"
32
32
  assert event["exception"]["type"] == "Message"
33
+ assert event["level"] == "info"
34
+
35
+
36
+ def test_build_event_level_override(config):
37
+ event = build_event(None, config, message="disk almost full", level="warning")
38
+
39
+ assert event is not None
40
+ assert event["level"] == "warning"
41
+
42
+
43
+ def test_build_event_exception_default_level(config):
44
+ try:
45
+ raise ValueError("bad")
46
+ except ValueError as exc:
47
+ event = build_event(exc, config)
48
+
49
+ assert event is not None
50
+ assert event["level"] == "error"
33
51
 
34
52
 
35
53
  def test_before_send_can_drop_event(config):
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "0.2.1",
3
- "distance": 0,
4
- "node": "gba6ff1cea7dc61b448365a59db23b039b13e003d",
5
- "dirty": false,
6
- "branch": "HEAD",
7
- "node_date": "2026-06-29"
8
- }