# 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.genesissai.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,The value of N in the parameters ranges from 0 to 9. |**Yes**|
| **MetricInfos.N.ResourceId** | string | Metric's associated resource id,The value of N in the parameters ranges from 0 to 9. |**Yes**|
| **MetricInfos.N.TagOperation** | string | How multiple tag conditions are combined: and (default) or or. At most three tags are supported with or. |No|
| **MetricInfos.N.TagList.N.TagKey** | string | The key of the Tag of the metric to be queried,The value of N in the parameters ranges from 0 to 9. |No|
| **MetricInfos.N.TagList.N.TagValues.N** | string | To query the Value of the Tag of the metric,The value of N in the parameters ranges from 0 to 9. |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 |
|:---|:---|:---|:---|
| **InvalidResourceIds** | array[string] | IDs of invalid or unauthorized resources |No|
| **List** | array[[*QueryMetricDataRespItem*](#querymetricdatarespitem)] | Query Result Set |No|

#### QueryMetricDataRespItem

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Metric** | string | Metric Name |No|
| **ErrCode** | int | Processing status code for this metric |No|
| **ErrMsg** | string | Status message for this metric |No|
| **TagEntries** | array[[*TagEntry*](#tagentry)] | Tag list. Each TagEntry contains TagName and KeyList (all candidate values). |No|
| **Results** | array[[*MetricResult*](#metricresult)] | List of returned time series |No|

#### TagEntry

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **TagName** | string | Tag entry name |No|
| **KeyList** | array[string] | Tag candidate values |No|

#### MetricResult

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **ResourceId** | string | UUID of the resource |No|
| **ResourceName** | string | Resource name |No|
| **TagList** | array[[*TagListItem*](#taglistitem)] | Resource tag list. Each TagListItem contains Tag and TagValue. |No|
| **Values** | array[[*MetricSample*](#metricsample)] | Metric data points; each item is a MetricPoint |No|

#### TagListItem

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Tag** | string | Tag name |No|
| **TagValue** | string | Tag value |No|

#### MetricSample

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

## Example

### Request Example
    
```
https://api.genesissai.com/?Action=QueryMetricDataSet
&Region=cn-zj
&ProjectId=TZlpcuPd
&ProductKey=TXBudhdd
&StartTime=2
&EndTime=8
&CalcMethod=raw
&Period=60
&MetricInfos.N.Metric=lDyFSEBQ
&MetricInfos.N.ResourceId=UESwYyop
&MetricInfos.N.TagOperation=mBNWMyvw
&MetricInfos.N.TagList.N.TagKey=lfwRldQl
&MetricInfos.N.TagList.N.TagValues.N=jAHCAMhA
```

### Response Example
    
```json
{
  "Action": "QueryMetricDataSetResponse",
  "Data": {
    "InvalidResourceIds": [
      "cfsvrea"
    ],
    "List": [
      {
        "ErrCode": 0,
        "ErrMsg": "",
        "Metric": "affsvsasxac",
        "Results": [
          {
            "ResourceId": "ascevrv",
            "ResourceName": "JDWNIC",
            "TagList": [
              {
                "Tag": "dadedfv",
                "TagValue": "bgdbngnyny"
              },
              {
                "Tag": "mfruvfunt",
                "TagValue": "adsfrv"
              }
            ],
            "Values": [
              {
                "Timestamp": 1787306795,
                "Value": 5.85
              },
              {
                "Timestamp": 1787307095,
                "Value": 5.85
              }
            ]
          },
          {
            "ResourceId": "fvrvse",
            "ResourceName": "DKDWIWO",
            "TagList": [
              {
                "Tag": "mfruvfunt",
                "TagValue": "fxvsa"
              },
              {
                "Tag": "dadedfv",
                "TagValue": "nfnyfd"
              }
            ],
            "Values": [
              {
                "Timestamp": 1787306795,
                "Value": 9.46
              },
              {
                "Timestamp": 1787307095,
                "Value": 9.46
              }
            ]
          },
          {
            "ResourceId": "okafvrcneb",
            "ResourceName": "CIVNFE",
            "TagList": [
              {
                "Tag": "dadedfv",
                "TagValue": "vgbtvre"
              },
              {
                "Tag": "mfruvfunt",
                "TagValue": "brnfnt"
              }
            ],
            "Values": [
              {
                "Timestamp": 1787306795,
                "Value": 0
              },
              {
                "Timestamp": 1787307095,
                "Value": 0
              }
            ]
          }
        ],
        "TagEntries": [
          {
            "KeyList": [
              "adsfrv",
              "fxvsa",
              "vgbtvre"
            ],
            "TagName": "mfruvfunt"
          },
          {
            "KeyList": [
              "bgdbngnyny",
              "nfnyfd",
              "brnfnt"
            ],
            "TagName": "dadedfv"
          }
        ]
      }
    ]
  },
  "Message": "JFxyLBMB",
  "RetCode": 0,
  "TraceId": "ojqCOcTb"
}
```





