• /
  • Log in

Python runtime metrics

The Python agent records runtime metrics to allow you to analyze the performance of your Python processes and interpreter. This includes metrics related to CPU usage, memory usage, and garbage collection.

CPU Usage

With CPU runtime metrics, you can monitor CPU usage by examining user and system CPU utilization, and also see time spent in different components of the CPU. The following CPU usage metrics are available:

  • CPU Time: Track the amount of time being spent in different states of the CPU. This includes user (time running application code) and system (time spent in the operating system). This metric is represented as total elapsed time in seconds.
  • CPU Utilization: Analyze the amount of processing resources being utilized over time by different components of the CPU. This includes the user component (for running application code) and system component (for running kernel code). This metric is reported as a percentage representing the time spent in the specified CPU component divided by total elapsed CPU time.

Memory Usage

You can monitor your system’s overall memory consumption and utilization by process and host. The following memory usage metrics are available:

  • Total Physical Memory: Monitor the amount of total physical memory in megabytes being used by your system over time. This metric is also available for individual process IDs.
  • Memory Utilization: Track memory utilization over time for your system and for individual processes. This metric is represented by the value of the total physical memory being used by your system (or a specific process) divided by the total amount of memory available.

Garbage Collection

Important

Garbage collection profiling is available in Python agent version 6.2.0.156 and higher and is disabled by default in the agent. To enable it, check out our documentation here.

The garbage collector finds unused data objects and reclaims that memory space so it can be used by another process. The Python agent provides the following garbage collection metrics:

  • Object Count by Type: Gain insight into the most common object types being collected by the garbage collector by viewing their associated collection counts. You can customize the maximum number of object types you would like to see reported by this metric type by configuring the top_object_count_limit setting.
  • Object Count by Generation: As collection occurs in each generation of the garbage collector, objects that survive are promoted into higher generations. This metric allows you to view the number of objects being stored in each of the garbage collector’s generations over time.
  • Total Time by Generation: Analyze the amount of time the garbage collector is spending in each generation of collection.
  • Garbage Collector Collections: The number of collections is influenced by the object threshold set for each generation. When the threshold is reached, a collection process will be triggered. Collections can also be manually triggered within application code with calls to gc.collect(). This metric reports the number of garbage collector sweeps that have happened in each generation over time.
  • Garbage Collector Uncollectable: In some instances, the garbage collector may not be able to reach and free a certain object, deeming it uncollectable. This metric allows you to view the number of objects that were uncollectable by the garbage collector in each generation.
  • Garbage Collector Collected: This metric reports the total number of objects that were collected by the garbage collector in each generation.

For more help

If you need more help, check out these support and learning resources:

Create issueEdit page
Copyright © 2021 New Relic Inc.