You can monitor the CPU and memory usage of a Knative application. This topic describes how to collect these metrics.

Prerequisites

  • Knative is enabled for a serverless Kubernetes (ASK) cluster. For more information, see Enable Knative.
  • Prometheus Monitoring is enabled for the ASK cluster. For more information, see ARMS Prometheus.

Procedure

  1. Log on to the ARMS console.
  2. In the left-side navigation pane, click Prometheus Monitoring and click the ASK cluster that you want to manage.
    Note If you have not installed Prometheus, click Install on the Prometheus Monitoring page.
    98-ch
  3. On the Dashboards page, click Prometheus in the Name column.
  4. On the left side of the page that appears, click the Explore icon and select the ASK cluster from the Select datasource drop-down list.
    99
  5. Query the CPU usage of a Knative application.
    Enter the following PromQL statement into the Metrics field. In this example, the helloworld-go application is queried. Click Run Query to query the CPU usage of the application.
    sum (rate (container_cpu_usage_seconds_total{pod_name=~"helloworld-go.*",namespace="default"}[1m])) 
    100
  6. Query the memory usage of a Knative application.
    Enter the following PromQL statement into the Metrics field. In this example, the helloworld-go application is queried. Click Run Query to query the memory usage of the application.
    sum (rate (container_memory_working_set_bytes{pod_name=~"helloworld-go.*",namespace="default"}[1m])) 
    101