hyperprobe-agent 1.2.25b9__tar.gz → 1.2.26__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 (40) hide show
  1. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/PKG-INFO +33 -26
  2. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/README.md +32 -25
  3. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe/agent.py +295 -27
  4. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe/core/broker.py +2 -2
  5. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe/core/safety.py +68 -19
  6. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe_agent.egg-info/PKG-INFO +33 -26
  7. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe_agent.egg-info/SOURCES.txt +4 -5
  8. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/setup.py +1 -6
  9. hyperprobe_agent-1.2.26/tests/test_fork.py +276 -0
  10. hyperprobe_agent-1.2.26/tests/test_safety.py +149 -0
  11. hyperprobe_agent-1.2.26/tests/test_startup.py +110 -0
  12. hyperprobe_agent-1.2.25b9/hyperprobe/bootstrap.py +0 -40
  13. hyperprobe_agent-1.2.25b9/hyperprobe/core/injection/__init__.py +0 -0
  14. hyperprobe_agent-1.2.25b9/hyperprobe/core/injection/sitecustomize.py +0 -18
  15. hyperprobe_agent-1.2.25b9/hyperprobe_agent.egg-info/entry_points.txt +0 -2
  16. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/LICENSE +0 -0
  17. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe/__init__.py +0 -0
  18. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe/core/__init__.py +0 -0
  19. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe/core/evaluator.py +0 -0
  20. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe/core/logger.py +0 -0
  21. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe/core/monitoring_engine.py +0 -0
  22. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe/core/probe_output.py +0 -0
  23. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe/core/quota.py +0 -0
  24. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe/core/serializer.py +0 -0
  25. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe/core/trace_extractor.py +0 -0
  26. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe/protos/__init__.py +0 -0
  27. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe/protos/agent_pb2.py +0 -0
  28. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe/protos/agent_pb2_grpc.py +0 -0
  29. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe_agent.egg-info/dependency_links.txt +0 -0
  30. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe_agent.egg-info/requires.txt +0 -0
  31. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/hyperprobe_agent.egg-info/top_level.txt +0 -0
  32. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/setup.cfg +0 -0
  33. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/tests/test_agent.py +0 -0
  34. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/tests/test_evaluator.py +0 -0
  35. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/tests/test_logger.py +0 -0
  36. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/tests/test_metric_probes.py +0 -0
  37. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/tests/test_multithreading_integration.py +0 -0
  38. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/tests/test_p1_regressions.py +0 -0
  39. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/tests/test_probe_output.py +0 -0
  40. {hyperprobe_agent-1.2.25b9 → hyperprobe_agent-1.2.26}/tests/test_serializer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyperprobe-agent
3
- Version: 1.2.25b9
3
+ Version: 1.2.26
4
4
  Summary: Production-grade, non-breaking live debugger and telemetry agent for Python.
5
5
  Home-page: https://www.hyperprobe.co
6
6
  Author: Arif, Saksham, Karan
@@ -46,7 +46,6 @@ HyperProbe allows you to debug running Python applications in real-time without
46
46
  - **Counter Probes:** Emit a value of `1` whenever a configured source line is reached.
47
47
  - **Metric Probes:** Safely evaluate a numerical Python expression and emit its value.
48
48
  - **Duration Probes:** Measure elapsed monotonic time in milliseconds between two source lines, with optional request correlation.
49
- - **Zero-Code-Change Auto-Instrumentation:** Prepend our bootstrap runtime to any Python process without editing your application's code.
50
49
  - **Circular Reference & Deep Object Protection:** Memory-safe serialization of deeply nested or cyclic variables.
51
50
  - **High-Performance Safety Guard:** Automatically pauses monitoring and goes idle if CPU/memory boundaries or pause budgets are exceeded.
52
51
 
@@ -74,16 +73,24 @@ pip install hyperprobe-agent
74
73
 
75
74
  ## Usage
76
75
 
77
- Run your application using the `hyperprobe-run` launcher. This automatically injects the live-debugging runtime before your code executes:
76
+ Start the agent programmatically at your application's entrypoint:
78
77
 
79
- ```bash
80
- HYPERPROBE_BROKER_URL="https://logger.app.hyperprobe.co" \
81
- HYPERPROBE_SERVICE_ID="<service-uuid-from-dashboard>" \
82
- HYPERPROBE_ENVIRONMENT="development" \
83
- GIT_COMMIT=$(git rev-parse HEAD) \
84
- hyperprobe-run python app.py
78
+ ```python
79
+ import os
80
+ from hyperprobe import HyperProbe
81
+
82
+ agent = HyperProbe.start({
83
+ "service_id": "<service-uuid-from-dashboard>",
84
+ "environment": os.getenv("PYTHON_ENV"),
85
+ "broker_url": "https://logger.app.hyperprobe.co",
86
+ "commit_sha": os.getenv("GIT_COMMIT"),
87
+ })
85
88
  ```
86
89
 
90
+ Required identity values may also be supplied through the environment variables
91
+ below. Explicit options take precedence. Initialization failures are reported
92
+ and the application continues without instrumentation.
93
+
87
94
  ### Configuration Environment Variables
88
95
 
89
96
  Configure the agent using the following environment variables:
@@ -102,7 +109,7 @@ Configure the agent using the following environment variables:
102
109
  | `HYPERPROBE_BANDWIDTH_KB_PER_SEC` | Max bandwidth limit for telemetry transmissions (quota). | `1024` (1 MB) |
103
110
  | `HYPERPROBE_RPC_TIMEOUT_SEC` | Deadline for broker RPCs. | `10` |
104
111
  | `HYPERPROBE_COOLDOWN_SEC` | Tracing suspension duration after a RED safety state. | `10` |
105
- | `HYPERPROBE_MAX_LAG_MS` | Execution-thread lag threshold for the safety monitor. | `50` |
112
+ | `HYPERPROBE_MAX_LAG_MS` | Per-reading scheduler-lag threshold. YELLOW requires 4/10 breaches; RED requires 7/10 breaches or 3/5 readings above 4x the threshold. | `50` |
106
113
  | `HYPERPROBE_PAUSE_BUDGET_MS` | Per-second capture pause budget for the safety monitor. | `15` |
107
114
  | `HYPERPROBE_REDACT_KEYS` | Comma-separated key patterns to redact. | `password,secret,token,authorization,cookie,key,signature` |
108
115
  | `HYPERPROBE_REDACT_VALUES` | Comma-separated value patterns to redact. | *(empty)* |
@@ -111,6 +118,7 @@ Configure the agent using the following environment variables:
111
118
  | `HYPERPROBE_STACK_FRAME_DEPTH` | Maximum captured stack-frame depth. | `3` |
112
119
  | `HYPERPROBE_MAX_OBJECT_PROPERTIES` | Maximum serialized properties per object. | `50` |
113
120
  | `HYPERPROBE_MAX_STRING_LENGTH` | Maximum serialized string length. | `1024` |
121
+ | `HYPERPROBE_FORK_MODE` | Set to `worker` for preloaded, prefork servers. The parent defers agent initialization and every worker starts fresh process-local state. | `none` |
114
122
 
115
123
  ### Debug logging
116
124
 
@@ -118,9 +126,9 @@ Set `DEBUG` to a comma- or space-separated list of namespaces. Patterns accept
118
126
  `*`, and exclusions begin with `-`:
119
127
 
120
128
  ```bash
121
- DEBUG=hyperprobe* # all HyperProbe SDK logs
129
+ DEBUG=hyperprobe:* # all HyperProbe SDK logs
122
130
  DEBUG=hyperprobe:broker,hyperprobe:monitor # selected components
123
- DEBUG=hyperprobe*,-hyperprobe:evaluator # exclude a component
131
+ DEBUG=hyperprobe:*,-hyperprobe:evaluator # exclude a component
124
132
  DEBUG_COLORS=1 # force ANSI colors
125
133
  ```
126
134
 
@@ -129,26 +137,25 @@ Without `*`, a selector is exact: `DEBUG=hyperprobe` does not match
129
137
  Set `DEBUG_COLORS=0` to disable colors. Logging configuration is read during
130
138
  SDK initialization, so set these variables before starting the process.
131
139
 
132
- ## Programmatic Usage (Inside Your Code)
140
+ ## Shutdown
133
141
 
134
- If you prefer to start the agent directly inside your Python script instead of using the `hyperprobe-run` launcher, you can do so by importing the package and calling `HyperProbe.start()` programmatically.
142
+ Call `HyperProbe.shutdown()` when the application process stops to close
143
+ monitoring, workers, and the broker connection cleanly.
135
144
 
136
- This is useful for applications where you want to control exactly when the agent boots up or configure the agent dynamically at runtime:
145
+ For servers that import the application before forking workers, such as
146
+ Gunicorn with `--preload`, enable worker fork mode:
137
147
 
138
148
  ```python
139
- import os
140
- from hyperprobe import HyperProbe
141
-
142
- # Start the agent programmatically at your application's entrypoint
143
149
  agent = HyperProbe.start({
144
150
  "service_id": "<service-uuid-from-dashboard>",
145
- "environment": os.getenv("PYTHON_ENV"), # Your environment name (e.g. dev, staging, production). Use whatever variable contains the env value.
151
+ "environment": os.getenv("PYTHON_ENV"),
146
152
  "broker_url": "https://logger.app.hyperprobe.co",
147
- "commit_sha": os.getenv("GIT_COMMIT"), # CI-injected commit SHA (reads os.getenv("GIT_COMMIT") by default)
153
+ "commit_sha": os.getenv("GIT_COMMIT"),
154
+ "fork_mode": "worker",
148
155
  })
149
-
150
- # Your application code goes here...
151
-
152
- # To cleanly shut down the agent when your app stops:
153
- HyperProbe.shutdown()
154
156
  ```
157
+
158
+ The prefork parent remains agent-free. Every worker receives a unique agent ID,
159
+ telemetry queue, gRPC channel, monitoring engine, and set of background threads.
160
+ Application code running inside those workers must use the `spawn` process start
161
+ method rather than creating additional children with `fork`.
@@ -11,7 +11,6 @@ HyperProbe allows you to debug running Python applications in real-time without
11
11
  - **Counter Probes:** Emit a value of `1` whenever a configured source line is reached.
12
12
  - **Metric Probes:** Safely evaluate a numerical Python expression and emit its value.
13
13
  - **Duration Probes:** Measure elapsed monotonic time in milliseconds between two source lines, with optional request correlation.
14
- - **Zero-Code-Change Auto-Instrumentation:** Prepend our bootstrap runtime to any Python process without editing your application's code.
15
14
  - **Circular Reference & Deep Object Protection:** Memory-safe serialization of deeply nested or cyclic variables.
16
15
  - **High-Performance Safety Guard:** Automatically pauses monitoring and goes idle if CPU/memory boundaries or pause budgets are exceeded.
17
16
 
@@ -39,16 +38,24 @@ pip install hyperprobe-agent
39
38
 
40
39
  ## Usage
41
40
 
42
- Run your application using the `hyperprobe-run` launcher. This automatically injects the live-debugging runtime before your code executes:
41
+ Start the agent programmatically at your application's entrypoint:
43
42
 
44
- ```bash
45
- HYPERPROBE_BROKER_URL="https://logger.app.hyperprobe.co" \
46
- HYPERPROBE_SERVICE_ID="<service-uuid-from-dashboard>" \
47
- HYPERPROBE_ENVIRONMENT="development" \
48
- GIT_COMMIT=$(git rev-parse HEAD) \
49
- hyperprobe-run python app.py
43
+ ```python
44
+ import os
45
+ from hyperprobe import HyperProbe
46
+
47
+ agent = HyperProbe.start({
48
+ "service_id": "<service-uuid-from-dashboard>",
49
+ "environment": os.getenv("PYTHON_ENV"),
50
+ "broker_url": "https://logger.app.hyperprobe.co",
51
+ "commit_sha": os.getenv("GIT_COMMIT"),
52
+ })
50
53
  ```
51
54
 
55
+ Required identity values may also be supplied through the environment variables
56
+ below. Explicit options take precedence. Initialization failures are reported
57
+ and the application continues without instrumentation.
58
+
52
59
  ### Configuration Environment Variables
53
60
 
54
61
  Configure the agent using the following environment variables:
@@ -67,7 +74,7 @@ Configure the agent using the following environment variables:
67
74
  | `HYPERPROBE_BANDWIDTH_KB_PER_SEC` | Max bandwidth limit for telemetry transmissions (quota). | `1024` (1 MB) |
68
75
  | `HYPERPROBE_RPC_TIMEOUT_SEC` | Deadline for broker RPCs. | `10` |
69
76
  | `HYPERPROBE_COOLDOWN_SEC` | Tracing suspension duration after a RED safety state. | `10` |
70
- | `HYPERPROBE_MAX_LAG_MS` | Execution-thread lag threshold for the safety monitor. | `50` |
77
+ | `HYPERPROBE_MAX_LAG_MS` | Per-reading scheduler-lag threshold. YELLOW requires 4/10 breaches; RED requires 7/10 breaches or 3/5 readings above 4x the threshold. | `50` |
71
78
  | `HYPERPROBE_PAUSE_BUDGET_MS` | Per-second capture pause budget for the safety monitor. | `15` |
72
79
  | `HYPERPROBE_REDACT_KEYS` | Comma-separated key patterns to redact. | `password,secret,token,authorization,cookie,key,signature` |
73
80
  | `HYPERPROBE_REDACT_VALUES` | Comma-separated value patterns to redact. | *(empty)* |
@@ -76,6 +83,7 @@ Configure the agent using the following environment variables:
76
83
  | `HYPERPROBE_STACK_FRAME_DEPTH` | Maximum captured stack-frame depth. | `3` |
77
84
  | `HYPERPROBE_MAX_OBJECT_PROPERTIES` | Maximum serialized properties per object. | `50` |
78
85
  | `HYPERPROBE_MAX_STRING_LENGTH` | Maximum serialized string length. | `1024` |
86
+ | `HYPERPROBE_FORK_MODE` | Set to `worker` for preloaded, prefork servers. The parent defers agent initialization and every worker starts fresh process-local state. | `none` |
79
87
 
80
88
  ### Debug logging
81
89
 
@@ -83,9 +91,9 @@ Set `DEBUG` to a comma- or space-separated list of namespaces. Patterns accept
83
91
  `*`, and exclusions begin with `-`:
84
92
 
85
93
  ```bash
86
- DEBUG=hyperprobe* # all HyperProbe SDK logs
94
+ DEBUG=hyperprobe:* # all HyperProbe SDK logs
87
95
  DEBUG=hyperprobe:broker,hyperprobe:monitor # selected components
88
- DEBUG=hyperprobe*,-hyperprobe:evaluator # exclude a component
96
+ DEBUG=hyperprobe:*,-hyperprobe:evaluator # exclude a component
89
97
  DEBUG_COLORS=1 # force ANSI colors
90
98
  ```
91
99
 
@@ -94,26 +102,25 @@ Without `*`, a selector is exact: `DEBUG=hyperprobe` does not match
94
102
  Set `DEBUG_COLORS=0` to disable colors. Logging configuration is read during
95
103
  SDK initialization, so set these variables before starting the process.
96
104
 
97
- ## Programmatic Usage (Inside Your Code)
105
+ ## Shutdown
98
106
 
99
- If you prefer to start the agent directly inside your Python script instead of using the `hyperprobe-run` launcher, you can do so by importing the package and calling `HyperProbe.start()` programmatically.
107
+ Call `HyperProbe.shutdown()` when the application process stops to close
108
+ monitoring, workers, and the broker connection cleanly.
100
109
 
101
- This is useful for applications where you want to control exactly when the agent boots up or configure the agent dynamically at runtime:
110
+ For servers that import the application before forking workers, such as
111
+ Gunicorn with `--preload`, enable worker fork mode:
102
112
 
103
113
  ```python
104
- import os
105
- from hyperprobe import HyperProbe
106
-
107
- # Start the agent programmatically at your application's entrypoint
108
114
  agent = HyperProbe.start({
109
115
  "service_id": "<service-uuid-from-dashboard>",
110
- "environment": os.getenv("PYTHON_ENV"), # Your environment name (e.g. dev, staging, production). Use whatever variable contains the env value.
116
+ "environment": os.getenv("PYTHON_ENV"),
111
117
  "broker_url": "https://logger.app.hyperprobe.co",
112
- "commit_sha": os.getenv("GIT_COMMIT"), # CI-injected commit SHA (reads os.getenv("GIT_COMMIT") by default)
118
+ "commit_sha": os.getenv("GIT_COMMIT"),
119
+ "fork_mode": "worker",
113
120
  })
114
-
115
- # Your application code goes here...
116
-
117
- # To cleanly shut down the agent when your app stops:
118
- HyperProbe.shutdown()
119
121
  ```
122
+
123
+ The prefork parent remains agent-free. Every worker receives a unique agent ID,
124
+ telemetry queue, gRPC channel, monitoring engine, and set of background threads.
125
+ Application code running inside those workers must use the `spawn` process start
126
+ method rather than creating additional children with `fork`.