View a markdown version of this page

Discover profile types, services, and labels - Amazon CloudWatch

Discover profile types, services, and labels

Before you retrieve a flame graph or a time series, you need a profile type ID and a label selector. The discovery operations return the profile types, label names, and label values in your account for a time range. For more information about profile type IDs and labels, see Profile type IDs and labels.

You can discover your profile data in the CloudWatch console or with the query API. This topic describes the console first, and then the API.

Prerequisites

Before you begin, make sure that you have the following:

Discover profile data in the CloudWatch console

In the CloudWatch console, each option in the Service list shows a service and its profile types. The Filters panel groups the label names and their values, for example, under Host and Kubernetes.

To see which services and profile types have data in the CloudWatch console
  1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. In the navigation pane, choose Profiles.

  3. In the navigation bar at the top, select the Region where you send your profile data.

  4. At the top of the page, choose the time range to search, for example, 1h.

  5. To see the services and their profile types, open the Service list.

  6. Select a service, for example, example-java-service.

  7. To see the profile types for that service, open the Profile type list.

To browse label names and values in the CloudWatch console
  1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.

  2. In the navigation pane, choose Profiles.

  3. In the navigation bar at the top, select the Region where you send your profile data.

  4. For Service, select a service, for example, example-java-service.

  5. In the Filters panel, expand a group, such as Host or Kubernetes.

Each group lists its label names, such as k8s.namespace.name or k8s.pod.name, with a check box for each value of the label. The groups are Service, Process, Host, Kubernetes, Cloud, Thread & CPU, Other resource attributes, Other sample labels, AWS, and Instrumentation.

Find the data to query

To find the data to query with the API, use the discovery operations.

The following procedure finds the profile types for one service. The examples after it show each request.

To find the profile types for a service
  1. List the services that sent profile data by calling LabelValues with the label name service_name.

  2. List the profile types for one service by calling LabelValues with the label name __profile_type__ and a matcher for the service.

  3. Use the returned profile type ID and the service label selector in a flame graph or time series query.

For the request fields of these operations, see ProfileTypes, LabelNames, LabelValues, and Series in the query API reference.

Each example uses the request format described in Authentication. Replace the start and end values with your own time range.

Example: list the services that sent profile data

This request calls LabelValues for the service_name label.

curl --request POST \ --aws-sigv4 "aws:amz:us-east-1:monitoring" \ --user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY" \ --header "x-amz-security-token: $AWS_SESSION_TOKEN" \ --header "Content-Type: application/json" \ --data '{"name": "service_name", "start": 1793793600000, "end": 1793797200000}' \ https://monitoring.us-east-1.amazonaws.com/querier.v1.QuerierService/LabelValues

Example response:

{"names": ["example-cpu-service", "example-aggregator", "example-processor", "example-java-service"]}
Example: list the profile types for one service

This request calls LabelValues for the __profile_type__ label, filtered to example-java-service. Use this request to find the types for a service, because ProfileTypes doesn't filter by service.

curl --request POST \ --aws-sigv4 "aws:amz:us-east-1:monitoring" \ --user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY" \ --header "x-amz-security-token: $AWS_SESSION_TOKEN" \ --header "Content-Type: application/json" \ --data '{ "name": "__profile_type__", "matchers": ["{service_name=\"example-java-service\"}"], "start": 1793793600000, "end": 1793797200000 }' \ https://monitoring.us-east-1.amazonaws.com/querier.v1.QuerierService/LabelValues

Example response:

{"names": ["process_cpu:cpu:nanoseconds:cpu:nanoseconds"]}
Example: list every profile type in the account

This request body for ProfileTypes takes only a time range. The response lists every profile type in the account, with its parts.

{"start": 1793793600000, "end": 1793797200000}

Example response (trimmed):

{ "profileTypes": [ { "ID": "process_cpu:cpu:nanoseconds:cpu:nanoseconds", "name": "process_cpu", "sampleType": "cpu", "sampleUnit": "nanoseconds", "periodType": "cpu", "periodUnit": "nanoseconds" }, { "ID": "process_samples:samples:count:cpu:nanoseconds", "name": "process_samples", "sampleType": "samples", "sampleUnit": "count", "periodType": "cpu", "periodUnit": "nanoseconds" } ] }
Example: list label names

This request body for LabelNames returns every label name in the time range.

{"start": 1793793600000, "end": 1793797200000}

Example response (trimmed):

{"names": ["@aws.account", "@aws.region", "@resource.host.name", "@resource.service.name", "__profile_type__", "service_name"]}
Example: list the hosts that run a service

This request body for Series returns one entry for each unique combination of the labels in labelNames. In this example, the request lists the hosts that sent profile data for example-java-service.

{ "matchers": ["{service_name=\"example-java-service\"}"], "labelNames": ["service_name", "__profile_type__", "@resource.host.name"], "start": 1793793600000, "end": 1793797200000 }

Example response (trimmed):

{ "labelsSet": [ { "labels": [ {"name": "@resource.host.name", "value": "host-a.example.internal"}, {"name": "__profile_type__", "value": "process_cpu:cpu:nanoseconds:cpu:nanoseconds"}, {"name": "service_name", "value": "example-java-service"} ] }, { "labels": [ {"name": "@resource.host.name", "value": "host-b.example.internal"}, {"name": "__profile_type__", "value": "process_cpu:cpu:nanoseconds:cpu:nanoseconds"}, {"name": "service_name", "value": "example-java-service"} ] } ] }