Container Metrics

This topic describes the metrics that are emitted by all containers managed by Cloud Foundry Application Runtime (CFAR) 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.

Metric Description Unit
CpuPercentage 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.
AbsoluteCPUEntitlement 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.
AbsoluteCPUUsage CPU time used by AI
  • AbsoluteCPUUsage / AbsoluteCPUEntitlement calculates a 0-100% range of AI usage per entitlement.
MemoryBytes RAM memory used by AI, in MB uint64
MemoryBytesQuota RAM memory available, in GB uint64
DiskBytes Disk space used by AI, in MB uint64
DiskBytesQuota Disk space available, in GB uint64
ContainerAge Age of container, in nanoseconds uint64

The Diego container metrics are packaged in the ContainerMetric structure. See the ContainerMetric structure definition in diego-logging-client in GitHub.

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

Run the command cf app APP-NAME to see current container metrics values for each instance of the app. The command output lists metric values as follows, based on the Diego Container Metrics described above:

Label in Output Container Metrics Listed
cpu CpuPercentage
memory MemoryBytes of MemoryBytesQuota
disk DiskBytes of DiskBytesQuota

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 05 Apr 10:41:21 PDT 2019
stack:             cflinuxfs3
buildpacks:        ruby

type:           web
instances:      1/1
memory usage:   256M
     state     since                  cpu    memory          disk          details
#0   running   2019-04-05T17:41:31Z   0.4%   39.5M of 256M   89.9M of 1G

Retrieve CPU Entitlement Metrics (Experimental)

To see app instance AbsoluteCPUEntitlement 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