You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: honest fork-safety guidance; test gunicorn --preload; review fixes
Review follow-ups:
- Explicit os.fork() with a live gRPC channel is documented (and warned
at runtime, outside the Gunicorn prefork path) as unreliable on
grpcio >= 1.80 — background reporters enter gRPC independent of
requests, upstream races grpc/grpc#43055/#43062 remain open; forking
applications are directed to SW_AGENT_PROTOCOL=http/kafka. Gunicorn
via `sw-python run -p` is called out as the supported channel-after-
fork model.
- The asyncio enhancement + prefork incompatibility is now documented in
the Gunicorn FAQ, AsyncEnhancement.md and the config reference.
- sw_grpc plugin note states the effective grpcio floor (>= 1.83 via the
agent package) alongside the 1.* instrumentation range.
- __fini is registered once per process lineage (atexit registrations
are fork-inherited), mirroring the at-fork hook guard.
- The sw_gunicorn provider now runs with --preload and performs an
instrumented call at module import, covering the agent.started()
no-op guard in the instrumentation-only master.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
| agent_instance_properties_json | SW_AGENT_INSTANCE_PROPERTIES_JSON | <class 'str'> || A custom JSON string to be reported as service instance properties, e.g. `{"key": "value"}`|
41
41
| agent_experimental_fork_support | SW_AGENT_EXPERIMENTAL_FORK_SUPPORT | <class 'bool'> | False | The agent will restart itself in any os.fork()-ed child process. Important Note: it's not suitable for short-lived processes as each one will create a new instance in SkyWalking dashboard in format of `service_instance-child(pid)`. When the sw-python CLI detects a pre-forking server (Gunicorn), only worker processes run a full agent; the master installs instrumentation only. |
42
42
| agent_queue_timeout | SW_AGENT_QUEUE_TIMEOUT | <class 'int'> | 1 | DANGEROUS - This option controls the interval of each bulk report from telemetry data queues Do not modify unless you have evaluated its impact given your service load. |
43
-
| agent_asyncio_enhancement | SW_AGENT_ASYNCIO_ENHANCEMENT | <class 'bool'> | False | Replace the threads to asyncio coroutines to report telemetry data to the OAP. This option is experimental and may not work as expected. |
43
+
| agent_asyncio_enhancement | SW_AGENT_ASYNCIO_ENHANCEMENT | <class 'bool'> | False | Replace the threads to asyncio coroutines to report telemetry data to the OAP. This option is experimental and may not work as expected. Not compatible with pre-forking servers (`sw-python run -p`): the agent refuses to start under a Gunicorn master. |
44
44
### SW_PYTHON Auto Instrumentation CLI
45
45
| Configuration | Environment Variable | Type | Default Value | Description |
Copy file name to clipboardExpand all lines: docs/en/setup/advanced/AsyncEnhancement.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,10 @@ Since `1.1.0`, the Python agent supports asynchronous reporting of ALL telemetry
6
6
export SW_AGENT_ASYNCIO_ENHANCEMENT=true
7
7
```
8
8
9
+
> Limitation: this option is incompatible with pre-forking servers via `sw-python run -p` (e.g. Gunicorn) —
10
+
> the asyncio agent has no fork support, so the agent refuses to start and the application runs without
11
+
> observability. See the [Gunicorn FAQ](../faq/How-to-use-with-gunicorn.md).
12
+
9
13
## Why we need this feature
10
14
11
15
Before version `1.1.0`, SkyWalking Python agent had only an implementation with the Threading module to provide data reporters. Yet with the growth of the Python agent, it is now fully capable and requires more resources than when only tracing was supported (we start many threads and gRPC itself creates even more threads when streaming).
0 commit comments