Querying Instance Usage Metrics of a Specified Function
Function
Query instance usage metrics of a function.
- The metric unit is minute. If the query time range is less than 1 hour, the metric period is 1 minute. If the query time range is less than 1 day, the metric period is 30 minutes. If the query time range is greater than 1 day, the metric period is 180 minutes.
- Metrics are classified into the following types: reservedinstancenum (usage of reserved instances) and concurrency (instance usage/concurrency).
URI
GET /v2/{project_id}/fgs/functions/{func_urn}/instancereports
Parameter | Mandatory | Type | Description |
|---|---|---|---|
project_id | Yes | String | Project ID. For details, see Obtaining a Project ID. |
func_urn | Yes | String | Function URN. For details, see the function model description. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
marker | No | String | Start position of the current query. The default value is 0. Default: 0 Minimum: 0 Maximum: 64 |
limit | No | String | Maximum number of data records returned in a request. Max.: 500. Default: 100. Default: 100 Minimum: 0 Maximum: 64 |
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 the user token. |
Content-Type | Yes | String | Message body type (format). |
Response Parameters
Status code: 200
Parameter | Type | Description |
|---|---|---|
instanceNum | Array of SlaReportsValue objects | Elastic instance metrics. |
reservedInstanceNum | Array of SlaReportsValue objects | Reserved instance metrics. |
Parameter | Type | Description |
|---|---|---|
timestamp | Integer | Timestamp. |
value | Double | Value. If the value is -1, the metric has no data in the current period. The possible cause is that the function is not executed. |
Status code: 500
Parameter | Type | Description |
|---|---|---|
error_code | String | Error code. |
error_msg | String | Error message. |
Example Requests
Query instance usage metrics of a function.
GET /v2/{project_id}/fgs/functions/{func_urn}/instancereports Example Responses
Status code: 200
ok
{
"instanceNum" : [ {
"timestamp" : 1596679200000,
"value" : -1
}, {
"timestamp" : 1596682800000,
"value" : 2
}, {
"timestamp" : 1596686400000,
"value" : -1
} ],
"reservedInstanceNum" : [ {
"timestamp" : 1596679200000,
"value" : -1
}, {
"timestamp" : 1596682800000,
"value" : 950
}, {
"timestamp" : 1596686400000,
"value" : -1
} ]
} Status Codes
Status Code | Description |
|---|---|
200 | ok |
500 | Internal server error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.

