# App dymetrics

# Get a list of application dynamic metrics

# Description

Get a list of application dynamic metrics

# Uri
GET /admin-api/applications/http/{app_id}/aggrs
# Uri Parameters
  • detail

    type: integer

    required: no

    description: Are detailed results required (default 0)

  • page

    type: integer

    required: no

    description: Results page (default 1)

  • page_size

    type: integer

    required: no

    description: Results page size (default 20)

# Example Request
# Shell
curl \
  -H "API-token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{admin-site}/admin-api/applications/http/{app_id}/aggrs?page=1&page_size=20&detail=1

# Example Response
Status: 200 OK
{
    "status": 0,
    "data": {
        "data": [
            {
                "_created_unix": 1615599380.883,
                "_modified_unix": 1615599380.883,
                "id": 5, // aggr id
                "el": {
                    "description": "request latency",
                    "charts_type": {
                        "hist_linear": {
                            "unit": "s"
                        }
                    },
                    "code": "aggregate $aggr_req_latency :resolution(0.1), :hist-linear(0, 1), :description(\"request latency\"), :unit('s'), :title('req latency');\n\ntrue => $aggr_req_latency <<< req-latency;",
                    "title": "req latency",
                    "var_name": "aggr_req_latency"
                }
            }
        ],
        "meta": {
            "count": 1
        }
    }
}

# New application dynamic metrics

# Description

Using the edgelang language to create application dynamic metrics, here we provide an example of counting the maximum, minimum and average upstream response times of the application for each node

# Uri
POST /admin-api/applications/http/{app_id}/aggrs
# Json Body Parameters
{
    "el": {
        "code": "aggregate $upstream_response_time :title('upstream response time'), :min, :max, :avg, :unit('ms');true => $upstream_response_time <<< server-addr <<< to-num(upstream-total-response-time) * 1000;"
    }
}
# Example Request
# Shell
curl \
  -H "API-token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{admin-site}/admin-api/applications/http/1/aggrs \
  -d $'{"el":{"code":"aggregate $upstream_response_time :title(\'upstream response time\'), :min, :max, :avg, :unit(\'ms\');true => $upstream_response_time <<< server-addr <<< to-num(upstream-total-response-time) * 1000;"}}'

# Example Response
Status: 200 OK

{"status":0,"data":{"id":1}}

# Delete the application dynamic metrics

# Description

Delete the application dynamic metrics

# Uri
DELETE /admin-api/applications/http/{app_id}/aggrs/{aggr_id}
# Example Request
# Shell
curl -X delete \
  -H "API-token: 1df87165-3593-4eca-a910-9ac20005e6ec" \
  http://{admin-site}/admin-api/applications/http/1/aggrs/1
# Example Response
Status: 200 OK

{"status":0}