debugbundle-python 0.1.1__tar.gz → 0.1.2__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.
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/PKG-INFO +22 -2
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/README.md +21 -1
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/pyproject.toml +1 -1
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/core.py +55 -1
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle_python.egg-info/PKG-INFO +22 -2
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/tests/test_sdk.py +13 -1
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/LICENSE +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/setup.cfg +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/__init__.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/config.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/integrations/__init__.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/integrations/common.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/integrations/django.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/integrations/fastapi.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/integrations/flask.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/integrations/relay_django.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/integrations/relay_fastapi.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/integrations/relay_flask.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/logger_integrations.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/py.typed +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/redaction.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/relay.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/suppression.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/transport.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/trigger_token.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle_python.egg-info/SOURCES.txt +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle_python.egg-info/dependency_links.txt +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle_python.egg-info/requires.txt +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle_python.egg-info/top_level.txt +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/tests/test_contracts.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/tests/test_framework_integrations.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/tests/test_hooks.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/tests/test_http_integration.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/tests/test_relay.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/tests/test_remote_config.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/tests/test_repository_metadata.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/tests/test_schema_validation.py +0 -0
- {debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/tests/test_trigger_token.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: debugbundle-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: DebugBundle SDK for Python
|
|
5
5
|
Author: DebugBundle
|
|
6
6
|
License-Expression: AGPL-3.0-only
|
|
@@ -59,8 +59,28 @@ debugbundle.flush()
|
|
|
59
59
|
|
|
60
60
|
## Status
|
|
61
61
|
|
|
62
|
-
This repository currently contains the full Phase 18 Python SDK scope in eleven implementation slices: core SDK surface, buffering, redaction, duplicate suppression, probe buffering, vanilla runtime hooks, framework integrations for Django, Flask, and FastAPI, remote config polling and capture-policy enforcement, optional `structlog` and `loguru` auto-detection when `capture_logging()` is enabled, contract-aligned `EventEnvelope` emission for log, request, exception, suppression, and probe payloads, explicit public wrapper signatures and a validated buildable typed package artifact, real HTTP integration coverage against a lightweight mock ingestion server, vendored machine-readable schema validation for all event types the Python SDK currently emits, a standalone CI workflow that validates Ruff, mypy, pytest, and package builds for the Python 3.10+ support floor actually used by the package, an enforced per-file coverage gate that keeps every shipped Python SDK module at or above the required 80% minimum,
|
|
62
|
+
This repository currently contains the full Phase 18 Python SDK scope in eleven implementation slices: core SDK surface, buffering, redaction, duplicate suppression, probe buffering, vanilla runtime hooks, framework integrations for Django, Flask, and FastAPI, remote config polling and capture-policy enforcement, optional `structlog` and `loguru` auto-detection when `capture_logging()` is enabled, contract-aligned `EventEnvelope` emission for log, request, exception, suppression, and probe payloads, explicit public wrapper signatures and a validated buildable typed package artifact, real HTTP integration coverage against a lightweight mock ingestion server, vendored machine-readable schema validation for all event types the Python SDK currently emits, a standalone CI workflow that validates Ruff, mypy, pytest, and package builds for the Python 3.10+ support floor actually used by the package, an enforced per-file coverage gate that keeps every shipped Python SDK module at or above the required 80% minimum, request-local framework correlation binding so `X-DebugBundle-Trace-Id` flows through Django, Flask, and FastAPI into the emitted event correlation metadata for cross-context linking, and safe backend runtime process facts on exception payloads without reading environment variables.
|
|
63
|
+
|
|
64
|
+
## Runtime Context
|
|
65
|
+
|
|
66
|
+
Backend exception events now include safe runtime process facts when the host exposes them, including:
|
|
67
|
+
|
|
68
|
+
- Python version
|
|
69
|
+
- platform
|
|
70
|
+
- architecture
|
|
71
|
+
- pid
|
|
72
|
+
- cwd
|
|
73
|
+
- uptime
|
|
74
|
+
- hostname
|
|
75
|
+
- thread id
|
|
76
|
+
- best-effort memory metadata
|
|
77
|
+
|
|
78
|
+
The SDK does not read or emit environment variables in this runtime block.
|
|
63
79
|
|
|
64
80
|
## Docs
|
|
65
81
|
|
|
66
82
|
https://debugbundle.com/docs/sdk-python
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
AGPL-3.0-only
|
|
@@ -20,8 +20,28 @@ debugbundle.flush()
|
|
|
20
20
|
|
|
21
21
|
## Status
|
|
22
22
|
|
|
23
|
-
This repository currently contains the full Phase 18 Python SDK scope in eleven implementation slices: core SDK surface, buffering, redaction, duplicate suppression, probe buffering, vanilla runtime hooks, framework integrations for Django, Flask, and FastAPI, remote config polling and capture-policy enforcement, optional `structlog` and `loguru` auto-detection when `capture_logging()` is enabled, contract-aligned `EventEnvelope` emission for log, request, exception, suppression, and probe payloads, explicit public wrapper signatures and a validated buildable typed package artifact, real HTTP integration coverage against a lightweight mock ingestion server, vendored machine-readable schema validation for all event types the Python SDK currently emits, a standalone CI workflow that validates Ruff, mypy, pytest, and package builds for the Python 3.10+ support floor actually used by the package, an enforced per-file coverage gate that keeps every shipped Python SDK module at or above the required 80% minimum,
|
|
23
|
+
This repository currently contains the full Phase 18 Python SDK scope in eleven implementation slices: core SDK surface, buffering, redaction, duplicate suppression, probe buffering, vanilla runtime hooks, framework integrations for Django, Flask, and FastAPI, remote config polling and capture-policy enforcement, optional `structlog` and `loguru` auto-detection when `capture_logging()` is enabled, contract-aligned `EventEnvelope` emission for log, request, exception, suppression, and probe payloads, explicit public wrapper signatures and a validated buildable typed package artifact, real HTTP integration coverage against a lightweight mock ingestion server, vendored machine-readable schema validation for all event types the Python SDK currently emits, a standalone CI workflow that validates Ruff, mypy, pytest, and package builds for the Python 3.10+ support floor actually used by the package, an enforced per-file coverage gate that keeps every shipped Python SDK module at or above the required 80% minimum, request-local framework correlation binding so `X-DebugBundle-Trace-Id` flows through Django, Flask, and FastAPI into the emitted event correlation metadata for cross-context linking, and safe backend runtime process facts on exception payloads without reading environment variables.
|
|
24
|
+
|
|
25
|
+
## Runtime Context
|
|
26
|
+
|
|
27
|
+
Backend exception events now include safe runtime process facts when the host exposes them, including:
|
|
28
|
+
|
|
29
|
+
- Python version
|
|
30
|
+
- platform
|
|
31
|
+
- architecture
|
|
32
|
+
- pid
|
|
33
|
+
- cwd
|
|
34
|
+
- uptime
|
|
35
|
+
- hostname
|
|
36
|
+
- thread id
|
|
37
|
+
- best-effort memory metadata
|
|
38
|
+
|
|
39
|
+
The SDK does not read or emit environment variables in this runtime block.
|
|
24
40
|
|
|
25
41
|
## Docs
|
|
26
42
|
|
|
27
43
|
https://debugbundle.com/docs/sdk-python
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
AGPL-3.0-only
|
|
@@ -2,9 +2,12 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import logging
|
|
5
|
+
import os
|
|
5
6
|
import platform
|
|
7
|
+
import socket
|
|
6
8
|
import sys
|
|
7
9
|
import threading
|
|
10
|
+
import time
|
|
8
11
|
import traceback
|
|
9
12
|
import uuid
|
|
10
13
|
from collections import deque
|
|
@@ -32,10 +35,16 @@ from .suppression import EventSuppressionTracker
|
|
|
32
35
|
from .transport import HttpTransport, Transport, coerce_transport_response
|
|
33
36
|
from .trigger_token import resolve_request_trigger_directives
|
|
34
37
|
|
|
38
|
+
try:
|
|
39
|
+
import resource
|
|
40
|
+
except ImportError: # pragma: no cover - resource is unavailable on some platforms.
|
|
41
|
+
resource = None # type: ignore[assignment]
|
|
42
|
+
|
|
35
43
|
DEFAULT_BATCH_SIZE = 25
|
|
36
44
|
DEFAULT_FLUSH_INTERVAL = 5.0
|
|
37
45
|
DEFAULT_ENDPOINT = "https://api.debugbundle.com/v1/events"
|
|
38
46
|
DEFAULT_LOG_LEVEL = "warning"
|
|
47
|
+
PROCESS_START_MONOTONIC = time.monotonic()
|
|
39
48
|
SCHEMA_VERSION = "2026-03-01"
|
|
40
49
|
LEVEL_RANKS = {
|
|
41
50
|
"debug": 10,
|
|
@@ -225,7 +234,7 @@ class DebugBundleSdk:
|
|
|
225
234
|
"handled": handled,
|
|
226
235
|
"request": request_payload,
|
|
227
236
|
"response": response_payload,
|
|
228
|
-
"runtime":
|
|
237
|
+
"runtime": _runtime_process_facts(),
|
|
229
238
|
}
|
|
230
239
|
if self._probe_flush_on_error:
|
|
231
240
|
probe_data = self._build_probe_data()
|
|
@@ -699,6 +708,51 @@ def _redact_mapping(value: object, redact_fields: set[str]) -> Any:
|
|
|
699
708
|
return value
|
|
700
709
|
|
|
701
710
|
|
|
711
|
+
def _runtime_process_facts() -> dict[str, object]:
|
|
712
|
+
return {
|
|
713
|
+
"version": platform.python_version(),
|
|
714
|
+
"platform": sys.platform,
|
|
715
|
+
"arch": platform.machine() or None,
|
|
716
|
+
"pid": os.getpid(),
|
|
717
|
+
"cwd": _safe_cwd(),
|
|
718
|
+
"uptime_sec": round(max(0.0, time.monotonic() - PROCESS_START_MONOTONIC), 3),
|
|
719
|
+
"hostname": _safe_hostname(),
|
|
720
|
+
"thread_id": threading.get_ident(),
|
|
721
|
+
"memory": _memory_facts(),
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
def _safe_cwd() -> str | None:
|
|
726
|
+
try:
|
|
727
|
+
return os.getcwd()
|
|
728
|
+
except OSError:
|
|
729
|
+
return None
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
def _safe_hostname() -> str | None:
|
|
733
|
+
try:
|
|
734
|
+
return socket.gethostname()
|
|
735
|
+
except OSError:
|
|
736
|
+
return None
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
def _memory_facts() -> dict[str, object]:
|
|
740
|
+
memory: dict[str, object] = {
|
|
741
|
+
"rss": None,
|
|
742
|
+
"heap_total": None,
|
|
743
|
+
"heap_used": None,
|
|
744
|
+
"external": None,
|
|
745
|
+
"peak": None,
|
|
746
|
+
}
|
|
747
|
+
if resource is None:
|
|
748
|
+
return memory
|
|
749
|
+
|
|
750
|
+
usage = resource.getrusage(resource.RUSAGE_SELF)
|
|
751
|
+
# ru_maxrss is KiB on Linux and bytes on macOS/BSD.
|
|
752
|
+
memory["peak"] = usage.ru_maxrss if sys.platform == "darwin" else usage.ru_maxrss * 1024
|
|
753
|
+
return memory
|
|
754
|
+
|
|
755
|
+
|
|
702
756
|
def _backend_exception_request_payload(candidate: object | None) -> dict[str, object]:
|
|
703
757
|
mapping = _dict_from_object(candidate)
|
|
704
758
|
payload: dict[str, object] = {
|
{debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle_python.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: debugbundle-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: DebugBundle SDK for Python
|
|
5
5
|
Author: DebugBundle
|
|
6
6
|
License-Expression: AGPL-3.0-only
|
|
@@ -59,8 +59,28 @@ debugbundle.flush()
|
|
|
59
59
|
|
|
60
60
|
## Status
|
|
61
61
|
|
|
62
|
-
This repository currently contains the full Phase 18 Python SDK scope in eleven implementation slices: core SDK surface, buffering, redaction, duplicate suppression, probe buffering, vanilla runtime hooks, framework integrations for Django, Flask, and FastAPI, remote config polling and capture-policy enforcement, optional `structlog` and `loguru` auto-detection when `capture_logging()` is enabled, contract-aligned `EventEnvelope` emission for log, request, exception, suppression, and probe payloads, explicit public wrapper signatures and a validated buildable typed package artifact, real HTTP integration coverage against a lightweight mock ingestion server, vendored machine-readable schema validation for all event types the Python SDK currently emits, a standalone CI workflow that validates Ruff, mypy, pytest, and package builds for the Python 3.10+ support floor actually used by the package, an enforced per-file coverage gate that keeps every shipped Python SDK module at or above the required 80% minimum,
|
|
62
|
+
This repository currently contains the full Phase 18 Python SDK scope in eleven implementation slices: core SDK surface, buffering, redaction, duplicate suppression, probe buffering, vanilla runtime hooks, framework integrations for Django, Flask, and FastAPI, remote config polling and capture-policy enforcement, optional `structlog` and `loguru` auto-detection when `capture_logging()` is enabled, contract-aligned `EventEnvelope` emission for log, request, exception, suppression, and probe payloads, explicit public wrapper signatures and a validated buildable typed package artifact, real HTTP integration coverage against a lightweight mock ingestion server, vendored machine-readable schema validation for all event types the Python SDK currently emits, a standalone CI workflow that validates Ruff, mypy, pytest, and package builds for the Python 3.10+ support floor actually used by the package, an enforced per-file coverage gate that keeps every shipped Python SDK module at or above the required 80% minimum, request-local framework correlation binding so `X-DebugBundle-Trace-Id` flows through Django, Flask, and FastAPI into the emitted event correlation metadata for cross-context linking, and safe backend runtime process facts on exception payloads without reading environment variables.
|
|
63
|
+
|
|
64
|
+
## Runtime Context
|
|
65
|
+
|
|
66
|
+
Backend exception events now include safe runtime process facts when the host exposes them, including:
|
|
67
|
+
|
|
68
|
+
- Python version
|
|
69
|
+
- platform
|
|
70
|
+
- architecture
|
|
71
|
+
- pid
|
|
72
|
+
- cwd
|
|
73
|
+
- uptime
|
|
74
|
+
- hostname
|
|
75
|
+
- thread id
|
|
76
|
+
- best-effort memory metadata
|
|
77
|
+
|
|
78
|
+
The SDK does not read or emit environment variables in this runtime block.
|
|
63
79
|
|
|
64
80
|
## Docs
|
|
65
81
|
|
|
66
82
|
https://debugbundle.com/docs/sdk-python
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
AGPL-3.0-only
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import platform
|
|
4
|
+
import sys
|
|
4
5
|
import uuid
|
|
5
6
|
from dataclasses import dataclass
|
|
6
7
|
|
|
@@ -234,7 +235,18 @@ def test_emits_contract_compliant_event_envelopes() -> None:
|
|
|
234
235
|
assert exception_event["payload"]["handled"] is True
|
|
235
236
|
assert exception_event["payload"]["request"]["path"] == "/checkout"
|
|
236
237
|
assert exception_event["payload"]["response"]["status_code"] == 500
|
|
237
|
-
|
|
238
|
+
runtime = exception_event["payload"]["runtime"]
|
|
239
|
+
assert runtime["version"] == platform.python_version()
|
|
240
|
+
assert runtime["platform"] == sys.platform
|
|
241
|
+
assert isinstance(runtime["arch"], str)
|
|
242
|
+
assert isinstance(runtime["pid"], int)
|
|
243
|
+
assert isinstance(runtime["cwd"], str)
|
|
244
|
+
assert isinstance(runtime["uptime_sec"], (int, float))
|
|
245
|
+
assert runtime["uptime_sec"] >= 0
|
|
246
|
+
assert isinstance(runtime["hostname"], str)
|
|
247
|
+
assert isinstance(runtime["thread_id"], int)
|
|
248
|
+
assert isinstance(runtime["memory"], dict)
|
|
249
|
+
assert "environment" not in runtime
|
|
238
250
|
|
|
239
251
|
|
|
240
252
|
def test_suppresses_duplicate_exceptions_after_the_first_three() -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/integrations/__init__.py
RENAMED
|
File without changes
|
{debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/integrations/common.py
RENAMED
|
File without changes
|
{debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/integrations/django.py
RENAMED
|
File without changes
|
{debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/integrations/fastapi.py
RENAMED
|
File without changes
|
|
File without changes
|
{debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/integrations/relay_django.py
RENAMED
|
File without changes
|
{debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/integrations/relay_fastapi.py
RENAMED
|
File without changes
|
{debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/integrations/relay_flask.py
RENAMED
|
File without changes
|
{debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle/logger_integrations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle_python.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle_python.egg-info/requires.txt
RENAMED
|
File without changes
|
{debugbundle_python-0.1.1 → debugbundle_python-0.1.2}/src/debugbundle_python.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|