Container Metrics

Page last updated:

This topic describes the metrics that are emitted by all containers managed by Cloud Foundry and its scheduling system, Diego.

App metrics include the container metrics described below, plus any custom app metrics that developers create.

Diego Container Metrics

Diego containers emit the following resource usage metrics for their app instance (AI). Each metric is averaged over and emitted every 15 seconds.

The following table describes all Diego container metrics:

Metric Description Unit
cpu CPU time used by AI as a percentage of a single CPU core.

This is usually no greater than 100% * the number of vCPUs on the host Diego cell, but it may be more due to discrepancies in measurement timing.
absolute_entitlement CPU time that the AI was entitled to use.

At minimum, the CPU time that a Diego cell provides an AI is min(app memory, 8 GB) * (Diego cell vCPUs/Diego cell memory) * 100%.

The platform operator can provide the Diego cell vCPUs/memory ratio to developers.
If a Diego cell is not at capacity or if other workloads on it are idle, the cell can provide more than the minimum CPU.
absolute_usage CPU time used by AI.

absolute_usage / absolute_entitlement calculates a 0-100% range of AI usage per entitlement.
memory RAM memory used by AI, in bytes. uint64
memory_quota RAM memory available, in bytes. float64
disk Disk space used by AI, in bytes. float64
disk_quota Disk space available, in bytes. float64
container_age Age of container, in nanoseconds. float64
log_rate Log rate used by AI, in bytes per second. float64
log_rate_limit Log rate available, in bytes per second. float64

Loggregator v1: Most of the container metrics are emitted in a ContainerMetric envelope. The absolute_entitlement, absolute_usage, container_age, log_rate and log_rate_limit container metrics are emitted as separate ValueMetric envelopes.

Loggregator v2: All container metrics are emitted in gauge envelopes. The absolute_entitlement, absolute_usage, container_age, log_rate and log_rate_limit container metrics are emitted in separate envelopes to the other container metrics.

Retrieve Container Metrics from the cf CLI

You can use Cloud Foundry command-line interface (cf CLI) commands to return container metrics.

Retrieve CPU, Memory, and Disk Metrics

To retrieve CPU, memory, and disk metrics for all instances of an app:

  1. Run the command cf app APP-NAME.

The command output lists Diego container metric values as follows:

Label in Output Metrics listed, as described in Diego Container Metrics, above
cpu cpu
memory memory of memory_quota
disk disk of disk_quota

For example:

$ cf app dora-example
Showing health and status for app dora-example in org o / space s as admin...

name:              dora-example
requested state:   started
last uploaded:     Fri 16 Sep 01:38:32 UTC 2022
stack:             cflinuxfs3
    name             version   detect output   buildpack name
    ruby_buildpack   1.8.58    ruby            ruby

type:           web
instances:      1/1
memory usage:   1024M
     state     since                  cpu    memory        disk          logging            details
#0   running   2022-09-16T01:38:46Z   0.2%   36.3M of 1G   90.3M of 1G   0/s of unlimited

Retrieve CPU Entitlement Metrics (Experimental)

To see app instance absolute_entitlement metrics from the command line:

  1. Install the CPU Entitlement Plugin from cpu-entitlement-plugin in GitHub.

  2. Run the command cf cpu-entitlement APP-NAME.

For example:

$ cf cpu-entitlement dora-example
Note: This feature is experimental.
Showing CPU usage against entitlement for app dora-example in org example-org / space example-org-staging as ...
     avg usage   curr usage
#0   1.62%       1.66%
#1   2.93%       3.09%
#2   2.51%       2.62%
Create a pull request or raise an issue on the source for this page in GitHub