Help Center/ FunctionGraph/ API Reference/ APIs/ Function Metrics/ Querying Instance Traffic Metrics of a Function
Updated on 2024-03-26 GMT+08:00

Querying Instance Traffic Metrics of a Function

Function

This API is used to query the instance traffic metrics of a function.

URI

GET /v2/{project_id}/fgs/functions/{func_urn}/slareports/{period}

Table 1 Path Parameters

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.

period

Yes

String

Interval (min)

Request Parameters

Table 2 Request header 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

Table 3 Response body parameters

Parameter

Type

Description

concurrency_num

Array of SlaReportsValue objects

Concurrency.

count

Array of SlaReportsValue objects

Number of invocations.

duration

Array of SlaReportsValue objects

Average latency, in milliseconds.

fail_count

Array of SlaReportsValue objects

Number of errors.

function_error_count

Array of SlaReportsValue objects

Number of function errors.

system_error_count

Array of SlaReportsValue objects

Number of system errors.

instance_num

Array of SlaReportsValue objects

Number of elastic instances.

max_duration

Array of SlaReportsValue objects

Maximum latency, in milliseconds.

min_duration

Array of SlaReportsValue objects

Minimum latency, in milliseconds.

reject_count

Array of SlaReportsValue objects

Number of throttles.

reserved_instance_num

Array of SlaReportsValue objects

Number of reserved instances.

Table 4 SlaReportsValue

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

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

Query instance traffic metrics of a function.

GET /v2/{project_id}/fgs/functions/{func_urn}/slareports/{period}

Example Responses

Status code: 200

ok

{
  "concurrency_num" : [ {
    "timestamp" : 1596679200000,
    "value" : -1
  }, {
    "timestamp" : 1596682800000,
    "value" : 2
  } ],
  "count" : [ {
    "timestamp" : 1596679200000,
    "value" : -1
  }, {
    "timestamp" : 1596682800000,
    "value" : 950
  } ],
  "duration" : [ {
    "timestamp" : 1596679200000,
    "value" : -1
  }, {
    "timestamp" : 1596682800000,
    "value" : 950
  } ],
  "fail_count" : [ {
    "timestamp" : 1596679200000,
    "value" : -1
  }, {
    "timestamp" : 1596682800000,
    "value" : 950
  } ],
  "function_error_count" : [ {
    "timestamp" : 1596679200000,
    "value" : -1
  }, {
    "timestamp" : 1596682800000,
    "value" : 950
  } ],
  "instance_num" : [ {
    "timestamp" : 1596679200000,
    "value" : -1
  }, {
    "timestamp" : 1596682800000,
    "value" : 950
  } ],
  "max_duration" : [ {
    "timestamp" : 1596679200000,
    "value" : -1
  }, {
    "timestamp" : 1596682800000,
    "value" : 950
  } ],
  "min_duration" : [ {
    "timestamp" : 1596679200000,
    "value" : -1
  }, {
    "timestamp" : 1596682800000,
    "value" : 950
  } ],
  "reject_count" : [ {
    "timestamp" : 1596679200000,
    "value" : -1
  }, {
    "timestamp" : 1596682800000,
    "value" : 950
  } ],
  "reserved_instance_num" : [ {
    "timestamp" : 1596679200000,
    "value" : -1
  }, {
    "timestamp" : 1596682800000,
    "value" : 950
  } ],
  "system_error_count" : [ {
    "timestamp" : 1596679200000,
    "value" : -1
  }, {
    "timestamp" : 1596682800000,
    "value" : 950
  } ]
}

Status Codes

Status Code

Description

200

ok

500

Internal server error.

Error Codes

See Error Codes.