tencent cloud

Cloud Log Service

Release Notes and Announcements
Release Notes
Announcements
User Guide
Product Introduction
Overview
Features
Available Regions
Limits
Concepts
Service Regions and Service Providers
Purchase Guide
Billing Overview
Product Pricing
Pay-as-You-Go
Billing
Cleaning up CLS resources
Cost Optimization
FAQs
Getting Started
Getting Started in 1 Minute
Getting Started Guide
Quickly Trying out CLS with Demo
Operation Guide
Resource Management
Permission Management
Log Collection
Metric Collection
Log Storage
Metric Storage
Search and Analysis (Log Topic)
Search and Analysis (Metric Topic)
Dashboard
Data Processing documents
Shipping and Consumption
Monitoring Alarm
Cloud Insight
Independent DataSight console
Historical Documentation
Practical Tutorial
Log Collection
Search and Analysis
Dashboard
Monitoring Alarm
Shipping and Consumption
Cost Optimization
Developer Guide
Embedding CLS Console
CLS Connection to Grafana
API Documentation
History
Introduction
API Category
Making API Requests
Topic Management APIs
Log Set Management APIs
Index APIs
Topic Partition APIs
Machine Group APIs
Collection Configuration APIs
Log APIs
Metric APIs
Alarm Policy APIs
Data Processing APIs
Kafka Protocol Consumption APIs
CKafka Shipping Task APIs
Kafka Data Subscription APIs
COS Shipping Task APIs
SCF Delivery Task APIs
Scheduled SQL Analysis APIs
COS Data Import Task APIs
Data Types
Error Codes
FAQs
Health Check
Collection
Log Search
Others
CLS Service Level Agreement
CLS Policy
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Syntax Rules

PDF
Focus Mode
Font Size
Last updated: 2024-09-20 17:48:27
Metric topics use Prometheus’ PromQL syntax to query metric data. For detailed syntax, see the Prometheus official documentation. This document mainly describes some common syntax and directions to help you quickly understand the basic usage.
There are two types of metric queries:
Range queries: Also known as Prometheus Range queries. This method queries metric data at each time point within a specified time range based on the step. It is commonly used to observe trends in metric changes.
Note:
When the query step is less than the metric collection interval, the query results may contain duplicate data. For example, if the CPU utilization is reported every 15 seconds, and the query interval is set to 1 second, you will see 15 identical duplicate data.
Instant queries: Also known as Prometheus Instant queries, this method returns the latest metric data within the query time range. It is commonly used to retrieve the current value of a metric.

Common syntax

1. Specifies the metric name to query the trend of metric values for each dimension under that metric name. For example, querying the disk capacity (disk_total):
disk_total
Search for the required CAM policy as needed, and click to complete policy association.



2. Specifies the metric name and dimensions to query the trend of metric values for a specific dimension combination. For example, querying the disk capacity where the hostname is 6c74e00eb825 and the path is /etc/hostname:
disk_total{host="6c74e00eb825", path="/etc/hostname"}
Search for the required CAM policy as needed, and click to complete policy association.



3. Aggregates metric data by specific dimensions. For example, querying the total disk capacity for each host and each device:
sum by (host,device)(disk_total)
Search for the required CAM policy as needed, and click to complete policy association.



Note:
For more PromQL syntax, see the Prometheus official documentation, or see the query examples.

Directions

1. Log in to the Cloud Log Service console.
2. In the left navigation bar, select Search and Analysis, at the top, select the region where the metric topic is located, choose "Metric topic" as the subject type, and then select the required metric topic.
3. Enter the query statement in the input box, then click the

on the right to query metrics. You can also click Browse to query the names of existing metrics.

Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback