tencent cloud

피드백

QueryMetric

마지막 업데이트 시간:2024-04-15 19:58:29

1. API Description

Domain name for API request: cls.tencentcloudapi.com.

This API is used to query the latest metric value at a specified time.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: QueryMetric.
Version Yes String Common Params. The value used for this API: 2020-10-16.
Region No String Common Params. This parameter is not required for this API.
Query Yes String Query statement, using PromQL syntax
TopicId Yes String Metric Topic ID
Time No Integer Query time, Unix Timestamp in seconds

3. Output Parameters

Parameter Name Type Description
ResultType String Metric Query Result Type
Result String Metric Query Result
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Querying the Latest Value of a Metric

Input Example

POST / HTTP/1.1
Host: cls.tencentcloudapi.com
Content-Type: application/json
X-TC-Action:  QueryMetric
<Common request parameters>
{
    "TopicId": "8e7c3bd9-xxxx-xxxx-xxxx-207971e1f80f",
    "Query": "access_evaluation_duration_bucket",
    "Time": 1695197431
}

Output Example

{
    "Response": {
        "RequestId": "1ee38aa1-xxxx-xxxx-xxxx-b1961a464c99",
        "ResultType": "vector",
        "Result": "[{\"metric\":{\"__name__\":\"access_evaluation_duration_bucket\",\"container\":\"grafana\",\"endpoint\":\"http\",\"instance\":\"172.17.0.6:3000\",\"job\":\"grafana\",\"le\":\"0.00064\",\"namespace\":\"monitoring\",\"pod\":\"grafana-6676ccf9c9-zjk62\",\"prometheus\":\"monitoring/k8s\",\"prometheus_replica\":\"prometheus-k8s-0\",\"service\":\"grafana\"},\"value\":[1695197431,\"5808\"]},{\"metric\":{\"__name__\":\"access_evaluation_duration_bucket\",\"container\":\"grafana\",\"endpoint\":\"http\",\"instance\":\"172.17.0.6:3000\",\"job\":\"grafana\",\"le\":\"0.01024\",\"namespace\":\"monitoring\",\"pod\":\"grafana-6676ccf9c9-zjk62\",\"prometheus\":\"monitoring/k8s\",\"prometheus_replica\":\"prometheus-k8s-0\",\"service\":\"grafana\"},\"value\":[1695197431,\"5808\"]},{\"metric\":{\"__name__\":\"access_evaluation_duration_bucket\",\"container\":\"grafana\",\"endpoint\":\"http\",\"instance\":\"172.17.0.6:3000\",\"job\":\"grafana\",\"le\":\"0.04096\",\"namespace\":\"monitoring\",\"pod\":\"grafana-6676ccf9c9-zjk62\",\"prometheus\":\"monitoring/k8s\",\"prometheus_replica\":\"prometheus-k8s-0\",\"service\":\"grafana\"},\"value\":[1695197431,\"5808\"]},{\"metric\":{\"__name__\":\"access_evaluation_duration_bucket\",\"container\":\"grafana\",\"endpoint\":\"http\",\"instance\":\"172.17.0.6:3000\",\"job\":\"grafana\",\"le\":\"0.65536\",\"namespace\":\"monitoring\",\"pod\":\"grafana-6676ccf9c9-zjk62\",\"prometheus\":\"monitoring/k8s\",\"prometheus_replica\":\"prometheus-k8s-0\",\"service\":\"grafana\"},\"value\":[1695197431,\"5808\"]},{\"metric\":{\"__name__\":\"access_evaluation_duration_bucket\",\"container\":\"grafana\",\"endpoint\":\"http\",\"instance\":\"172.17.0.6:3000\",\"job\":\"grafana\",\"le\":\"2.62144\",\"namespace\":\"monitoring\",\"pod\":\"grafana-6676ccf9c9-zjk62\",\"prometheus\":\"monitoring/k8s\",\"prometheus_replica\":\"prometheus-k8s-0\",\"service\":\"grafana\"},\"value\":[1695197431,\"5808\"]},{\"metric\":{\"__name__\":\"access_evaluation_duration_bucket\",\"container\":\"grafana\",\"endpoint\":\"http\",\"instance\":\"172.17.0.6:3000\",\"job\":\"grafana\",\"le\":\"0.00016\",\"namespace\":\"monitoring\",\"pod\":\"grafana-6676ccf9c9-zjk62\",\"prometheus\":\"monitoring/k8s\",\"prometheus_replica\":\"prometheus-k8s-0\",\"service\":\"grafana\"},\"value\":[1695197431,\"5805\"]},{\"metric\":{\"__name__\":\"access_evaluation_duration_bucket\",\"container\":\"grafana\",\"endpoint\":\"http\",\"instance\":\"172.17.0.6:3000\",\"job\":\"grafana\",\"le\":\"+Inf\",\"namespace\":\"monitoring\",\"pod\":\"grafana-6676ccf9c9-zjk62\",\"prometheus\":\"monitoring/k8s\",\"prometheus_replica\":\"prometheus-k8s-0\",\"service\":\"grafana\"},\"value\":[1695197431,\"5808\"]},{\"metric\":{\"__name__\":\"access_evaluation_duration_bucket\",\"container\":\"grafana\",\"endpoint\":\"http\",\"instance\":\"172.17.0.6:3000\",\"job\":\"grafana\",\"le\":\"0.00256\",\"namespace\":\"monitoring\",\"pod\":\"grafana-6676ccf9c9-zjk62\",\"prometheus\":\"monitoring/k8s\",\"prometheus_replica\":\"prometheus-k8s-0\",\"service\":\"grafana\"},\"value\":[1695197431,\"5808\"]},{\"metric\":{\"__name__\":\"access_evaluation_duration_bucket\",\"container\":\"grafana\",\"endpoint\":\"http\",\"instance\":\"172.17.0.6:3000\",\"job\":\"grafana\",\"le\":\"0.16384\",\"namespace\":\"monitoring\",\"pod\":\"grafana-6676ccf9c9-zjk62\",\"prometheus\":\"monitoring/k8s\",\"prometheus_replica\":\"prometheus-k8s-0\",\"service\":\"grafana\"},\"value\":[1695197431,\"5808\"]},{\"metric\":{\"__name__\":\"access_evaluation_duration_bucket\",\"container\":\"grafana\",\"endpoint\":\"http\",\"instance\":\"172.17.0.6:3000\",\"job\":\"grafana\",\"le\":\"1e-05\",\"namespace\":\"monitoring\",\"pod\":\"grafana-6676ccf9c9-zjk62\",\"prometheus\":\"monitoring/k8s\",\"prometheus_replica\":\"prometheus-k8s-0\",\"service\":\"grafana\"},\"value\":[1695197431,\"5593\"]},{\"metric\":{\"__name__\":\"access_evaluation_duration_bucket\",\"container\":\"grafana\",\"endpoint\":\"http\",\"instance\":\"172.17.0.6:3000\",\"job\":\"grafana\",\"le\":\"4e-05\",\"namespace\":\"monitoring\",\"pod\":\"grafana-6676ccf9c9-zjk62\",\"prometheus\":\"monitoring/k8s\",\"prometheus_replica\":\"prometheus-k8s-0\",\"service\":\"grafana\"},\"value\":[1695197431,\"5787\"]}]"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation Operation failed.
FailedOperation.QueryError The query statement failed to run.
FailedOperation.Timeout Operation timed out
InternalError Internal error.
InternalError.SearchError Retrieval error
InternalError.SearchFailed Retrieval failed
InvalidParameter Incorrect parameter.
MissingParameter Missing parameter.
ResourceNotFound.TopicNotExist The log topic does not exist.
문의하기

고객의 업무에 전용 서비스를 제공해드립니다.

기술 지원

더 많은 도움이 필요하시면, 티켓을 통해 연락 바랍니다. 티켓 서비스는 연중무휴 24시간 제공됩니다.

연중무휴 24시간 전화 지원