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
A VPC is built. For more information, see Create a VPC with an IPv4 CIDR block.
An ECS instance is created in the VPC. For more information, see Create an instance.
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.
The system automatically identifies tags prefixed with "o11y.aliyun.dev/" and injects them into the corresponding metrics.
Configure the tags for the ECS instance. For more information, see Modify the tags of an instance.
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.
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 (,).
Configure the tags for the ECS instance. For more information, see Modify the tags of an instance.
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.
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.