Help Center> FunctionGraph> API Reference> APIs> Function Metrics> Querying Top Functions for a Specified Metric
Updated on 2024-03-14 GMT+08:00

Querying Top Functions for a Specified Metric

Function

This API is used to query the top functions for a specified metric.

By default, the top ten functions with the most errors in the last day are queried.

URI

GET /v2/{project_id}/fgs/function/report

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

type

No

String

Metric type. Default value: failcount.

start_time

No

String

Start time.

end_time

No

String

End time.

limit

No

String

Metric type. Default value: failcount.

Request Parameters

Table 3 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 4 Response body parameters

Parameter

Type

Description

values

Array of FunctionMetric objects

Function URN and metrics.

next_marker

Long

Next read location.

count

Long

Total number of functions returned.

Table 5 FunctionMetric

Parameter

Type

Description

key

String

Function URN.

value

Integer

Metric value.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

Query the top functions for a specified metric.

GET /v2/{project_id}/fgs/function/report

Example Responses

Status code: 200

Query successful.

{
  "next_marker" : 2,
  "count" : 2,
  "values" : [ {
    "key" : "funcUrn1",
    "value" : 1
  }, {
    "key" : "funcUrn2",
    "value" : 2
  } ]
}

Status Codes

Status Code

Description

200

Query successful.

400

Bad Request

Error Codes

See Error Codes.