Customizing the Python data collector
You can set the variables to change the default behavior of the Python data collector.
User-defined environment variables for the Python data collector
For Python monitoring in IBM® Cloud Private or OpenShift, set the following variables in the application yaml file.
For on-premises applications, set the following variables as environment variables or in the config.properties file.
| Variable name | Value | Description |
|---|---|---|
| KPG_LOG_LEVEL |
|
|
| KPG_LOG_TOCONSOLE | True | The log is printed to console and you can see the log by running the command kubectl
logs <pod name>:. Tip:
|
| KPG_GC_STATS | True | All statistical functions of python garbage collection are enabled. When you set this value
to True, it equals running the following command:
To disable KPG_GC_STATS, delete this environment variable. Do not set it to False. Note: Never set
KPG_SAVE_ALL=True in your formal
production environment. It is only for the debug mode. Make sure that enough memory is assigned to
the application. |
| KPG_SAVE_ALL | True | All unreferenced objects are saved into gc.garbage, and you must clear
gc.garbage every minute (the data collector clears it for you). When the value
is set to True, it equals running the following command:
To disable KPG_SAVE_ALL, delete this environment
variable. Do not set it to False. Note: Never set
KPG_SAVE_ALL=True in your formal production environment. It is only for the debug
mode. Make sure that enough memory is assigned to the application. |
| KPG_ENABLE_OPENTT | "False" |
By default, the Python data collector enables OpenTracing function. You can disable OpenTracing by setting the environment variable to false. Example:
|
OpenTracing sampling:
|
The default sampler type is "probabilistic", and the default sampler param
is 0.01, which means that 1 in 100 traces will be sampled. You can set it to other
values. For more information, see Sampling. |
When the OpenTracing function is enabled, you can set the OpenTracing sampler type and param.
Example: |
| LATENCY_SAMPLER_PARAM | Any value between 0 and 1 |
The default value is 0.1, which means getting 1 request out of 10 requests. The value must be between 0 and 1. The value of 0 means no latency data will be collected. The value of 1 means no sampler and all requests data will be collected. Example:
|