| 1 | --- |
| 2 | title: Collector |
| 3 | weight: 3 |
| 4 | --- |
| 5 | |
| 6 | # Process Collector |
| 7 | |
| 8 | The Python client automatically exports metrics about process CPU usage, RAM, |
| 9 | file descriptors and start time. These all have the prefix `process`, and |
| 10 | are only currently available on Linux. |
| 11 | |
| 12 | The namespace and pid constructor arguments allows for exporting metrics about |
| 13 | other processes, for example: |
| 14 | ``` |
| 15 | ProcessCollector(namespace='mydaemon', pid=lambda: open('/var/run/daemon.pid').read()) |
| 16 | ``` |
| 17 | |
| 18 | # Platform Collector |
| 19 | |
| 20 | The client also automatically exports some metadata about Python. If using Jython, |
| 21 | metadata about the JVM in use is also included. This information is available as |
| 22 | labels on the `python_info` metric. The value of the metric is 1, since it is the |
| 23 | labels that carry information. |
| 24 | |
| 25 | # Disabling Default Collector metrics |
| 26 | |
| 27 | By default the collected `process`, `gc`, and `platform` collector metrics are exported. |
| 28 | If this information is not helpful, it can be disabled using the following: |
| 29 | |
| 30 | ```python |
| 31 | import prometheus_client |
| 32 | |
| 33 | prometheus_client.REGISTRY.unregister(prometheus_client.GC_COLLECTOR) |
| 34 | prometheus_client.REGISTRY.unregister(prometheus_client.PLATFORM_COLLECTOR) |
| 35 | prometheus_client.REGISTRY.unregister(prometheus_client.PROCESS_COLLECTOR) |
| 36 | ``` |