Querying Metrics

Function

This API is used to query recommendation effect metrics.

URI

GET /v1/{project_id}/query-indicators/{job_id}

Table 1 describes the URI parameters.

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which is used for resource isolation. For details about how to obtain the project ID, see Obtaining a Project ID.

job_id

Yes

String

Job ID, which is used to distinguish jobs.

Request

N/A

Response

Table 2 describes the response parameters.

Table 2 Response parameters

Parameter

Type

Description

is_success

Boolean

Whether the request is successful

indicator_values

Map [String, Map[String, Map[String, String]]]

Queried effect metric. The key of the map in the including layer indicates the metric type, the key of the map in the included layer indicates the timestamp, and value indicates the corresponding metric value.

error_msg

String

Error message that indicates a request has failed. This parameter is unavailable when a request is successful.

error_code

String

Error code that indicates a request has failed. This parameter is unavailable when a request is successful.

Example

  • Example of a successful response
    {
        "is_success": true,
        "indicator_values": {
            "service1": {
                "flowA": {
                    "clickUV": {
                        "1559318400": "0.000",
                        "1559404800": "12.000",
                        "1559491200": "0.000",
                        "1559577600": "45.000"
                    },
                    "indicator1": {
                        "1559318400": "12.000",
                        "1559404800": "0.000",
                        "1559491200": "5.000",
                        "1559577600": "0.000"
                    },
                    "indicator2": {
                        "1559318400": "1.000",
                        "1559404800": "0.000",
                        "1559491200": "3.000",
                        "1559577600": "0.000"
                    }
                }
            }
        }
    }
  • Example of a failed response
    { 
        "is_success": false, 
        "error_code": "res.xxxx", 
        "error_msg": "Failed to query indicators." 
    }

Status Code

For details about status codes, see Status Codes.