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
Sometimes you don't actually need the agent to monitor anything in a child process.
55
67
56
-
If you do not need the agent to get loaded for application child processes, you can turn off the behavior by setting an environment variable.
68
+
The SkyWalking Python agent will start up along with all your application workers shortly.
57
69
58
-
`SW_AGENT_SW_PYTHON_BOOTSTRAP_PROPAGATE` to `False`
70
+
Note that `sw-python` also work with spawned subprocess (os.exec*/subprocess) as long as the `PYTHONPATH` is inherited.
59
71
60
-
Note the auto bootstrap depends on the environment inherited by child processes,
61
-
thus prepending a new sitecustomize path to or removing the loader path from the `PYTHONPATH` could prevent the agent from loading in a child process.
72
+
Additionally, `sw-python` started agent works well with `os.fork` when your application forks workers,
73
+
as long as the `SW_AGENT_EXPERIMENTAL_FORK_SUPPORT` is turned on. (It will be automatically turned on when gunicorn is detected)
62
74
63
-
###Configuring the agent
75
+
## Configuring the agent
64
76
65
77
You would normally want to provide additional configurations other than the default ones.
66
78
@@ -69,13 +81,13 @@ You would normally want to provide additional configurations other than the defa
69
81
The currently supported method is to provide the environment variables listed
70
82
and explained in the [Environment Variables List](Configuration.md).
71
83
72
-
#### Through a sw-config.yaml (TBD)
84
+
#### Through a sw-config.toml (TBD)
73
85
74
-
Currently, only environment variable configuration is supported; an optional `yaml` configuration is to be implemented.
86
+
Currently, only environment variable configuration is supported; an optional `toml` configuration is to be implemented.
75
87
76
-
###Enabling CLI DEBUG mode
88
+
## Enabling CLI DEBUG mode
77
89
78
-
Note the CLI is a new feature that manipulates the Python interpreter bootstrap behaviour, there could be unsupported cases.
90
+
Note the CLI is a feature that manipulates the Python interpreter bootstrap behaviour, there could be unsupported cases.
79
91
80
92
If you encounter unexpected problems, please turn on the DEBUG mode by adding the `-d` or `--debug` flag to your `sw-python` command, as shown below.
81
93
@@ -86,6 +98,29 @@ To: `sw-python -d run command`
86
98
Please attach the debug logs to the [SkyWalking Issues](https://github.com/apache/skywalking/issues) section if you believe it is a bug,
87
99
[idea discussions](https://github.com/apache/skywalking/discussions) and [pull requests](https://github.com/apache/skywalking-python/pulls) are always welcomed.
88
100
101
+
102
+
## Additional Remarks
103
+
104
+
When executing commands with `sw-python run command`, your command's Python interpreter will pick up the SkyWalking loader module.
105
+
106
+
It is not safe to attach SkyWalking Agent to those commands that resides in another Python installation
107
+
because incompatible Python versions and mismatched SkyWalking versions can cause problems.
108
+
Therefore, any attempt to pass a command that uses a different Python interpreter/ environment will not bring up
109
+
SkyWalking Python Agent even if another SkyWalking Python agent is installed there(no matter the version),
110
+
and will force exit with an error message indicating the reasoning.
111
+
112
+
#### Disabling spawned processes from starting new agents
113
+
114
+
Sometimes you don't actually need the agent to monitor anything in a new process (when it's not a web service worker).
115
+
(here we mean process spawned by subprocess and os.exec*(), os.fork() is not controlled by this flag but `experimental_fork_support`)
116
+
117
+
If you do not need the agent to get loaded for application child processes, you can turn off the behavior by setting an environment variable.
118
+
119
+
`SW_AGENT_SW_PYTHON_BOOTSTRAP_PROPAGATE` to `False`
120
+
121
+
Note the auto bootstrap depends on the environment inherited by child processes,
122
+
thus prepending a new sitecustomize path to or removing the loader path from the `PYTHONPATH` could also prevent the agent from loading in a child process.
123
+
89
124
#### Known limitations
90
125
91
126
1. The CLI may not work properly with arguments that involve double quotation marks in some shells.
0 commit comments