tencent cloud

Cloud Log Service

Metric

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-05-18 20:21:15
Metrics (Metric) are measurements used to gauge the performance and operational status of systems and applications, such as CPU utilization, memory usage, access throughput, response latency, and success rate. Metrics are typically generated at regular intervals, with each timestamp corresponding to a value. These values form a sequence over time, which is generally referred to as a time series (TS).
Cloud Log Service (CLS) is compatible with the Prometheus metrics data model, storing timestamped metric data with the same metric name and labels as time series. Each data point in the time series is referred to as a sample, which consists of a timestamp and a sample value.
Example
For example, the total number of requests for a particular API at 15:35:23.123 on December 30, 2020 would be considered a sample, with the data as follows:
requests_total{method="POST", handler="/messages"} 217
It is composed of the following parts:
Metric name: requests_total
Dimensions: {method="POST", handler="/messages"}, meaning the API name is "messages" and the request method is POST.
Timestamp: 2020/12/30 15:35.123
Sample value: 217
The monitored system often has multiple metrics at the same time, with many different metric names and labels at a given moment. For example, Nginx monitoring metrics might include the following:
# HELP nginx_http_requests_total The total number of HTTP requests
# TYPE nginx_http_requests_total counter
nginx_http_requests_total 10234

# HELP nginx_http_requests_duration_seconds The HTTP request duration in seconds
# TYPE nginx_http_requests_duration_seconds histogram
nginx_http_requests_duration_seconds_bucket{le="0.005"} 2405
nginx_http_requests_duration_seconds_bucket{le="0.01"} 5643
nginx_http_requests_duration_seconds_bucket{le="0.025"} 7890
nginx_http_requests_duration_seconds_bucket{le="0.05"} 9234
nginx_http_requests_duration_seconds_bucket{le="0.1"} 10021
nginx_http_requests_duration_seconds_bucket{le="0.25"} 10234
nginx_http_requests_duration_seconds_bucket{le="0.5"} 10234
nginx_http_requests_duration_seconds_bucket{le="1"} 10234
nginx_http_requests_duration_seconds_bucket{le="2.5"} 10234
nginx_http_requests_duration_seconds_bucket{le="5"} 10234
nginx_http_requests_duration_seconds_bucket{le="10"} 10234
nginx_http_requests_duration_seconds_bucket{le="+Inf"} 10234
nginx_http_requests_duration_seconds_sum 243.56
nginx_http_requests_duration_seconds_count 10234

# HELP nginx_http_connections Number of HTTP connections
# TYPE nginx_http_connections gauge
nginx_http_connections{state="active"} 23
nginx_http_connections{state="reading"} 5
nginx_http_connections{state="writing"} 7
nginx_http_connections{state="waiting"} 11

# HELP nginx_http_response_count_total The total number of HTTP responses sent
# TYPE nginx_http_response_count_total counter
nginx_http_response_count_total{status="1xx"} 123
nginx_http_response_count_total{status="2xx"} 9123
nginx_http_response_count_total{status="3xx"} 456
nginx_http_response_count_total{status="4xx"} 567
nginx_http_response_count_total{status="5xx"} 65

# HELP nginx_up Is the Nginx server up
# TYPE nginx_up gauge
nginx_up 1
The meanings of the metrics are as follows:
nginx_http_requests_total: The total number of HTTP requests processed by Nginx.
nginx_http_requests_duration_seconds: The duration of HTTP requests, provided using the Histogram type, which shows the number of requests within different time intervals.
nginx_http_connections: The current number of HTTP connections in Nginx, categorized into active, reading, writing, and waiting status.
nginx_http_response_count_total: The total number of HTTP responses returned by Nginx, categorized by status code.
nginx_up: The operation status of the Nginx server, where 1 indicates running and 0 indicates not running.
Logs (Log) and metrics (Metric) are both methods for collecting and recording data in systems and applications, but they differ in data types and usage. In CLS, the main differences are as follows:
Data Type
Log (Log)
Metrics (Metric)
Data Format
No strict restrictions. Both plain text and structured data in json format can be reported as logs.
Must comply with the Prometheus metric data model.
Data collection
Supports collecting logs using LogListener, API, or SDK.
Requires converting raw logs to metrics through scheduled SQL analysis. For details, see Log to Metric
Data storage
Supports STANDARD storage, STANDARD_IA storage and log archiving, with different storage types having different features, performance, and pricing.
Makes no distinction between storage types
Index Configurations
Requires configuring indexes, including field name, data type, tokenizer, and so on.
Does not require configuring indexes.
Data query
Use search conditions to filter raw logs, and use SQL to perform statistical analysis on raw logs.
Use PromQL to query metrics.



도움말 및 지원

문제 해결에 도움이 되었나요?

피드백