Reviewed-by: Topchii, Maria <mtopchii@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Co-committed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
23 KiB
Querying Monitoring Data
Function
This API is used to query the monitoring metric data at a specified granularity in a specified period of time.
Calling Method
For details, see Calling APIs.
URI
GET /v2/{project_id}/apigw/instances/{instance_id}/metric-data
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain it, see Obtaining a Project ID. |
instance_id |
Yes |
String |
Gateway ID, which can be obtained from the gateway information on the APIG console. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
dim |
Yes |
String |
Metric dimension.
Enumeration values:
|
metric_name |
Yes |
String |
Metric name.
Enumeration values:
|
from |
Yes |
String |
Start time of the query. The time is a UNIX timestamp and the unit is ms. |
to |
Yes |
String |
End time of the query. The time is a UNIX timestamp and the unit is ms. The value of parameter from must be earlier than that of parameter to. |
period |
Yes |
Integer |
Monitoring data granularity.
Enumeration values:
|
filter |
Yes |
String |
Data rollup mode.
Enumeration values:
|
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is a token. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
datapoints |
Array of MetricData objects |
Metric data. |
Parameter |
Type |
Description |
---|---|---|
average |
Integer |
Average value of metric data within a rollup period. This parameter is supported only when the value of filter in the request is average. |
max |
Integer |
Maximum value of metric data within a rollup period. This parameter is supported only when the value of filter in the request is max. |
min |
Integer |
Minimum value of metric data within a rollup period. This parameter is supported only when the value of filter in the request is min. |
sum |
Integer |
Sum of metric data within a rollup period. This parameter is supported only when the value of filter in the request is sum. |
variance |
Integer |
Variance value of metric data within a rollup period. This parameter is supported only when the value of filter in the request is variance. |
timestamp |
Long |
Time when the metric is collected. It is a UNIX timestamp in milliseconds. |
unit |
String |
Metric unit. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Example Requests
None
Example Responses
Status code: 200
OK
{ "datapoints" : [ { "average" : 5, "timestamp" : 1665304920000, "unit" : "Byte" } ] }
Status code: 400
Bad Request
{ "error_code" : "APIG.2012", "error_msg" : "Invalid parameter value,parameterName:api_id. Please refer to the support documentation" }
Status code: 401
Unauthorized
{ "error_code" : "APIG.1002", "error_msg" : "Incorrect token or token resolution failed" }
Status code: 403
Forbidden
{ "error_code" : "APIG.1005", "error_msg" : "No permissions to request this method" }
Status code: 404
Not Found
{ "error_code" : "APIG.3002", "error_msg" : "API 39bce6d25a3f470e8cf7b2c97174f7d9 does not exist" }
Status code: 500
Internal Server Error
{ "error_code" : "APIG.9999", "error_msg" : "System error" }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
500 |
Internal Server Error |
Error Codes
See Error Codes.