# Query Monitoring Metric Data Set - QueryMetricDataSet

## Overview

Query Monitoring Metrics Dataset






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `QueryMetricDataSet`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.scloudsg.com/uaccount/api_manage)                                             | **Yes** |
| **Signature**  | string  | User signature generated based on public key and API command, see [Signature Algorithm](/docs/api/summary/signature.md)  | **Yes** |

### Request Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Region** | string | Region. See [Region and Zone List](/docs/api/summary/regionlist) |**Yes**|
| **ProjectId** | string | Project ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the [GetProjectList interface](/docs/api/summary/get_project_list). |**Yes**|
| **ProductKey** | string | ProductKey， See[Product Introduce](https://docs.ucloud.cn/cloudwatch/metric/intro) |**Yes**|
| **StartTime** | int | Start Time，Value is a 10 digit timestamp |**Yes**|
| **EndTime** | int | EndTime，Value is a 10 digit timestamp |**Yes**|
| **CalcMethod** | string | CalcMethod，The enumeration values are: max, min, avg,sum |**Yes**|
| **Period** | int | Period, in seconds, refers to the time interval between data points returned during data queries. The period varies depending on the query time range:<br /><br />For 0 < time range ≤ 1h: Period is 1 minute/5 minutes, with corresponding enumeration values of 60 and 300.<br /><br />For 1h < time range ≤ 12h: Period is 1 minute/5 minutes/1 hour, with corresponding enumeration values of 60, 300, and 3600.<br /><br />For 12h < time range ≤ 24h: Period is 5 minutes/1 hour, with corresponding enumeration values of 300 and 3600.<br /><br />For 1 day < time range ≤ 30 days: Period is 1 hour/6 hours/24 hours, with corresponding enumeration values of 3600, 21600, and 86400. |**Yes**|
| **MetricInfos.N.Metric** | string | Metric Name |**Yes**|
| **MetricInfos.N.ResourceId** | string | Metric's associated resource id |**Yes**|
| **MetricInfos.N.TagList.N.TagKey** | string | The key of the Tag of the metric to be queried |No|
| **MetricInfos.N.TagList.N.TagValues.N** | string | To query the Value of the Tag of the metric |No|

### Response Field

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **RetCode** | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. |**Yes**|
| **Action** | string | Operation command name. |**Yes**|
| **Message** | string | Returns an error message, providing detailed description when `RetCode` is non-zero. |No|
| **TraceId** | string | Log Link ID |No|
| **Data** | [*QueryMetricDataResp*](#querymetricdataresp) | QueryMetricDataResp |No|

#### Data Model


#### QueryMetricDataResp

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **List** | array[[*QueryMetricDataRespItem*](#querymetricdatarespitem)] | Query Result Set |No|

#### QueryMetricDataRespItem

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Metric** | string | Metric Name |No|
| **Tags** | object | All tag keys and corresponding value arrays of the metric query results.<br /><br />The format of Tags is, the key is the tagkey string, and the value is an array of tagValue strings. |No|
| **Results** | array[[*MetricResult*](#metricresult)] |  |No|

#### MetricResult

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **ResourceId** | string | UUID of the resource |No|
| **TagMap** | object | TagMap is an object, both key and value are strings. <br />TagMap returns the key and value of all tags of the current series. |No|
| **Values** | array[[*MetricSample*](#metricsample)] |  |No|

#### MetricSample

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Timestamp** | int | timestamp |No|
| **Value** | float | Sample Value |No|

## Example

### Request Example
    
```
https://api.scloudsg.com/?Action=QueryMetricDataSet
&Region=cn-zj
&Zone=cn-zj-01
&ProjectId=lBXDBARv
&ProductKey=YoLcjjOJ
&StartTime=2
&EndTime=1
&MetricInfos.N.Metric=wBhLvIzA
&MetricInfos.N.ResourceId=pAlImMnm
&MetricInfos.N.TagList.N.TagKey=bYSOyCNH
&MetricInfos.N.TagList.N.TagValues.N=jNRAlNmm
&CalcMethod=row
&Period=60
```

### Response Example
    
```json
{
  "Action": "QueryMetricDataSetResponse",
  "Data": {
    "InvalidResourceIds": [],
    "List": [
      {
        "Metric": "uhost_cpu_used",
        "Results": [
          {
            "ResourceId": "uhost-xxx",
            "ResourceName": "测试主机",
            "TagMap": {},
            "Values": [
              {
                "Timestamp": 1755593820,
                "Value": 3
              },
              {
                "Timestamp": 1755593880,
                "Value": 4
              }
            ]
          }
        ],
        "Tags": {}
      }
    ]
  },
  "RetCode": 0,
  "TraceId": "6b51655d-4c06-4da2-bd17-a5e6fff7ad0a"
}
```





