This topic describes the metrics that are emitted by all containers managed by VMware Tanzu Application Service for VMs (TAS for VMs) and its scheduling system, Diego.

Overview of Container Metrics

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

Diego Container Metrics

Diego containers emit resource usage metrics for the app instance. Diego averages and emits each metric every 15 seconds.

The following table describes all Diego container metrics:

Metric Description Unit
cpu The CPU time that an app instance has used, as a percentage of a single CPU core.

This value is usually no greater than 100% * the number of vCPUs on the host Diego cell. However, discrepancies in measurement timing may cause the value to be greater.
float64
absolute_entitlement The amount of CPU time that a Diego Cell has allocated to an app instance.

At minimum, the CPU time that a Diego Cell allocates to an app instance is min(app memory, 8 GB) * (Diego cell vCPUs/Diego cell memory) * 100%. The operator of your TAS for VMs deployment can provide the vCPUs/memory ratio of the Diego Cell to developers.
If a Diego Cell is not already working at capacity, or if other workloads on the Diego Cell are idle, the Diego Cell can allocate more than the minimum amount of CPU time to an app instance.
float64
absolute_usage The CPU time that an app instance has used.

absolute_usage / absolute_entitlement calculates a 0-100% range of app instance usage per entitlement.
float64
memory The amount of RAM memory in bytes that an app instance has used. uint64
memory_quota The amount of RAM memory in bytes that is available for an app instance to use. float64
disk The amount of disk space in bytes that an app instance has used. float64
disk_quota The amount of disk space in bytes that is available for an app instance to use. float64
container_age The age in nanoseconds of the Diego container. float64
log_rate The current log rate in bytes per second for an app instance. float64
log_rate_limit The log rate limit in bytes per second for an app instance. float64

The way that Diego emits container metrics differs depending on the version of Loggregator used in your TAS for VMs deployment:

  • Loggregator v1: Diego emits most container metrics in a ContainerMetric envelope. Diego emits the absolute_entitlement, absolute_usage, container_age, log_rate, and log_rate_limit container metrics in ValueMetric envelopes.

  • Loggregator v2: Diego emits all container metrics in gauge envelopes. Diego emits the absolute_entitlement, absolute_usage, container_age, log_rate, and log_rate_limit container metrics in separate gauge envelopes from other container metrics.

Retrieve Container Metrics from the cf CLI

You can retrieve container metrics using the Cloud Foundry Command Line Interface (cf CLI).

To retrieve CPU, memory, and disk metrics for all instances of an app, see Retrieve CPU, Memory, and Disk Metrics below.

To retrieve CPU entitlement metrics for all instances of an app, see Retrieve CPU Entitlement Metrics below.

To determine when an app has exceeded its CPU entitlement, see Monitor Apps That Exceed Their CPU Entitlement below.

Retrieve CPU, Memory, and Disk Metrics

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

  1. In a terminal window, run:

    cf app APP-NAME
    

    Where APP-NAME is the name of the app.

    The above command returns CPU, memory, and disk metrics for all instances of the app, similar to the following example:

    Showing health and status for app dora-example in org o / space s as admin...
    
    name:              dora-example
    requested state:   started
    routes:            dora-example.example.com
    last uploaded:     Fri 16 Sep 01:38:32 UTC 2022
    stack:             cflinuxfs3
    buildpacks:
    	name             version   detect output   buildpack name
    	ruby_buildpack   1.8.58    ruby            ruby
    
    type:           web
    sidecars:
    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
    

    Note: The above command shows what percentage of CPU the app is currently using relative to the total CPU on the host machine.

Retrieve CPU Entitlement Metrics

The absolute_entitlement metric shows the amount of CPU an app is using relative to its CPU entitlement.

To retrieve absolute_entitlement metrics for all instances of an app:

  1. Install the Cloud Foundry CPU Entitlement Plugin from the Cloud Foundry CPU Entitlement Plugin repository on GitHub.

  2. In a terminal window, run:

    cf cpu-entitlement APP-NAME
    

    Where APP-NAME is the name of the app.

    The above command returns absolute_entitlement metrics for all instances of the app, similar to the following example:

    Showing CPU usage against entitlement for app dora-example in org example-org / space example-org-staging as dora@example.com ...
    ​
         avg usage   curr usage
    #0   1.62%       1.66%
    #1   2.93%       3.09%
    #2   2.51%       2.62%
    

Monitor Apps That Exceed Their CPU Entitlement

You can use the Cloud Foundry CPU Entitlement Plugin to determine when an app has exceeded its CPU entitlement and may need to be scaled up.

When you allow CPU throttling in your TAS for VMs deployment, apps are split into two groups:

  • Apps with an average CPU usage under 100% of their CPU entitlement

  • Apps with an average CPU usage that exceeds 100% of their entitlements

To determine which apps in your org have exceeded their CPU entitlements:

  1. Install the Cloud Foundry CPU Entitlement Plugin from the Cloud Foundry CPU Entitlement Plugin repository on GitHub.

  2. In a terminal window, run:

    cf over-entitlement-instances
    

    The above command returns output similar to the following example:

    Note: This feature is experimental.
    Showing over-entitlement apps in org example-org / space example-org-staging as dora@example.com ...
    ​
       space                     app
    #0   example-org-staging       dora-example-2
    #1   example-org-staging       dora-example-3
    #2   example-org-staging       dora-example-4
    
    The above example output shows that the three listed apps have an average CPU usage that exceeds 100% of their entitlements. When an app's average CPU usage exceeds its CPU entitlement, consider increasing their CPU entitlement to ensure that they do not become throttled.
check-circle-line exclamation-circle-line close-line
Scroll to top icon