Query metrics from AMP

Configure AMP data source

  1. Select AWS services from the AWS logo on the left navigation menu.

This will take you to a screen that shows all the AWS data sources available for you to choose from as pictured below.

AWS Datasources

Select Amazon Managed Service for Prometheus from the list, select the AWS Region where you created the AMP workspace. This will automatically populate the AMP workspaces available in that Region as shown below.

AMP data source config

  1. Select the AMP workspace from the list and click Add data sources.

Once added, you will see that the AMP data source is authenticated through SigV4 protocol. Grafana (7.3.5 and above) has the AWS SigV4 proxy built-in as a plugin which makes this possible.

AMP configuration

Query Metrics

Kubernetes metrics

In this section you will import a public Grafana dashboard that allows you to visualize metrics from a Kubernetes environment.

  1. Click the plus sign on the left navigation bar and select Import. Import link

  2. In the Import screen, type 3119 in Import via grafana.com textbox and click Load.

  3. Select the AMP data source from the dropdown at the bottom and click Import.

Import 3119 Dashboard

Once complete, you will be able to see the Grafana dashboard showing metrics from the EKS cluster through AMP data source as shown below.

3119 Dashboard

You can also create your own custom dashboard using PromQL by creating a custom dashboard and adding a panel connecting AMP as the data source.

ECS metrics

In this section we will query the metrics collected following these instructions.

  1. Click the plus sign on the left navigation bar and select Dashboard to create a new custom dashboard.

  2. Click Add an empty panel, on the query tab, select the observability-workshop and enter the following query

ecs_task_cpu_utilized

On the legend field, enter the following expression {{aws_ecs_task_id}} and leave the visualization by default on graph

Add ecs task cpu

  1. Name the panel on the right, name your dashboard and apply.

  2. Click on the plus sign, and repeat with the following queries

ECS Memory:

Metrics: ecs_task_memory_utilized
Legend : {{aws_ecs_task_id}}
Visualization: Gauge

Incoming queries on ListAdoptions:

Metrics: rate(petlistadoptions_requests_total[5m])
Legend : {{endpoint}}
Visualization: Default

You can explore other metrics and complete your dashboard

Custom dashboard

Application metrics

The PetSite front end and the ListAdoptions applications expose metrics in Prometheus format on the /metrics/ endpoint. The ADOT collector scrapes metrics from those endpoint and ingests them into the AMP workspace.

  1. Open the file /resources/petadoptions-grafana-dashboard.json file and copy the contents from it. (You may have to navigate to your Cloud9 environment to locate this file).

  2. Click the plus sign on the left navigation menu and select Import. Import link

  3. Paste the contents of the copied file into the Import via panel json textbox and click Load.

  4. Click Import.

Import PetAdoptions Dashboard

You should now be able to see the PetAdoptions Dashboard as shown below.

PetAdoptions Dashboard

This concludes this section. You may continue on to the next section.