ves-io-schema-service_policy-CustomDataAPI-ServicePolicyHitsLatency

Examples of performing service_policy CustomDataAPI ServicePolicyHitsLatency

Usecase:

Get Service Policy latency

Request:

Request using vesctl:

vesctl request rpc service_policy.CustomDataAPI.ServicePolicyHitsLatency -i request.yaml --uri /public/namespaces/system/service_policy/latency --http-method POST

where file request.yaml has following contents:

endTime: "1593622800"
groupBy:
- POLICY
labelFilter:
- label: VIRTUAL_HOST
  value: virtual-host-1
namespace: system
startTime: "1593619200"

vesctl yaml response:

data:
- id:
    policy: service-policy-1
  metric:
  - timestamp: 1593622800
    value: "0.02"
- id:
    policyRule: service-policy-2
  metric:
  - timestamp: 1593622800
    value: "0.04"

Request using curl:

curl -X 'POST' -d '{"namespace":"system","labelFilter":[{"label":"VIRTUAL_HOST","value":"virtual-host-1"}],"groupBy":["POLICY"],"startTime":"1593619200","endTime":"1593622800"}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build185306297_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/data/namespaces/system/service_policy/latency'

curl response:

HTTP/1.1 200 OK
Content-Length: 674
Content-Type: application/json
Date: Mon, 19 Oct 2020 09:49:11 GMT
Vary: Accept-Encoding

{
  "data": [
    {
      "id": {
        "namespace": "",
        "policy": "service-policy-1",
        "policy_rule": "",
        "policy_set": "",
        "action": "",
        "site": "",
        "virtual_host": ""
      },
      "metric": [
        {
          "timestamp": 1593622800,
          "value": "0.02"
        }
      ]
    },
    {
      "id": {
        "namespace": "",
        "policy": "",
        "policy_rule": "service-policy-2",
        "policy_set": "",
        "action": "",
        "site": "",
        "virtual_host": ""
      },
      "metric": [
        {
          "timestamp": 1593622800,
          "value": "0.04"
        }
      ]
    }
  ]
}