All Products
Search
Document Center

Managed Service for Prometheus:Add tags to the metrics of an ECS instance using a VPC

Last Updated:Jul 03, 2024

Alibaba Cloud Managed Service for Prometheus allows you to add custom tags to the metrics of an Elastic Compute Service (ECS) instance that uses a virtual private cloud (VPC). This way, you can organize, query, monitor, or analyze the metrics in a fine-grained manner when you use tools such as Grafana.

Prerequisites

Usage notes

  • A tag key cannot contain special characters, such as hyphens (-), periods (.), or percent signs (%). The special characters are used in the Prometheus functionality.

  • Tags must be specified in a format required by Prometheus.

Procedure

Use one of the following methods to add tags to metrics:

Method 1: Automatically add tags

You can automatically add custom tags with a specific prefix to metrics. Sample prefix: o11y.aliyun.dev/. Automatic tag injection helps you improve the observability and operability of metric exploration and further simplifies the management and filtering of metric data.

Note

The system automatically identifies tags prefixed with "o11y.aliyun.dev/" and injects them into the corresponding metrics.

  1. Configure the tags for the ECS instance. For more information, see Modify the tags of an instance.

    image

  2. On the Metric Exploration tab of the environment details page in the Integration Management module, tags have been added. For more information about how to explore metrics, see Explore the metric data of an environment.

    image

Note
  • You must first enable the ECS component. For more information, see Monitor ECS instances.

  • You can automatically add tags with a specific prefix only to metrics collected by the Node Exporter.

Method 2: Manually add tags

When you enable the ECS component, you can manually add custom tags. You can specify multiple tags by using commas (,).

  1. Configure the tags for the ECS instance. For more information, see Modify the tags of an instance.

    image

  2. In the Host Monitor panel, enter the tag keys configured in the preceding step in the Custom ECS Tag Injection field. For more information, see Monitor ECS instances.

    image

  3. On the Metric Exploration tab of the environment details page in the Integration Management module, tags have been added. For more information about how to explore metrics, see Explore the metric data of an environment.

    image