Typically, the number of concurrent pod requests are used as an indicator to evaluate a service. Knative collects request-related metrics through the queue-proxy container. This topic describes how to use Prometheus Monitoring to display the pod request-related metrics in a Knative service.

Step 1: Install the Prometheus Monitoring component

  1. Log on to the ACK console.
  2. In the left-side navigation pane, choose Marketplace > App Catalog.
  3. On the App Catalog page, click the Alibaba Cloud Apps tab and click ack-arms-prometheus.
  4. On the App Catalog - ack-arms-prometheus page, click the Parameters tab.
  5. On the Parameters tab, set parameter cluster_id.

    The system automatically sets the value to the ID of the target cluster. To find the cluster ID, choose Clusters > Clusters in the left-side navigation pane, find the target cluster on the Clusters page, and the cluster ID is displayed in the Cluster Name/ID column.

  6. On the App Catalog - ack-arms-prometheus page, go to the Deploy tab on the right, select the target cluster, and click Create.
    Note Namespace and Release Name are set to arms-prom by default.

Step 2: Set queue-proxy job collection rules

  1. Log on to the ARMS console.
  2. In the left-side navigation pane, click Prometheus Monitoring.
  3. On the Prometheus Monitoring page, click Settings in the Actions column.
  4. Click the Prometheus Settings tab, add the following content to the Prometheus.yaml file, and click Save.
      scrape_interval: 30s
      scrape_timeout: 10s
      evaluation_interval: 30s
    - job_name: queue-proxy
      scrape_interval: 3s
      scrape_timeout: 3s
      - role: pod
      # Rename metadata labels to be reader friendly
      - source_labels: [__meta_kubernetes_pod_label_serving_knative_dev_revision, __meta_kubernetes_pod_container_port_name]
        action: keep
        regex: .+;http-autometric
      - source_labels: [__meta_kubernetes_namespace]
        target_label: namespace
      - source_labels: [__meta_kubernetes_pod_name]
        target_label: pod
      - source_labels: [__meta_kubernetes_service_name]
        target_label: service
  5. Click the Metric tab to view the queue-proxy-related metrics.

Step 3: Query the number of concurrent pod requests

  1. In the left-side navigation pane of the cluster configuration page, choose Dashboards.
  2. Click Prometheus in the Name column.
  3. On the Prometheus page, click the Explore icon on the left side of the page.explore
  4. In the Metrics drop-down list, select queue to view queue-proxy-related metrics.
    The queue_requests_per_second metric is queried in this example.metrics
    You can also query the number of pod requests per second by specifying the namespace, revision, and pod name. Example:
    Number of pod requests