ves-io-schema-graph-site-CustomAPI-Query

Examples of performing graph_site CustomAPI Query

Usecase:

Site Graph

Request:

Request using vesctl:

vesctl request rpc graph_site.CustomAPI.Query -i request.yaml --uri /public/namespaces/ns1/graph/site --http-method POST

where file request.yaml has following contents:

endTime: "1580407200"
fieldSelector:
  edge:
    metric:
      types:
      - HTTP_REQUEST_RATE
      - HTTP_ERROR_RATE
      - TCP_CONNECTION_RATE
      - TCP_ERROR_RATE
  node:
    metric:
      downstream:
      - HTTP_REQUEST_RATE
      - HTTP_ERROR_RATE
      - TCP_CONNECTION_RATE
      - TCP_ERROR_RATE
      upstream:
      - HTTP_REQUEST_RATE
      - HTTP_ERROR_RATE
      - TCP_CONNECTION_RATE
      - TCP_ERROR_RATE
range: 1h
startTime: "1580403600"

vesctl yaml response:

data:
  edges:
  - data:
      metric:
        data:
        - type: HTTP_REQUEST_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "50"
            trend: []
        - type: HTTP_ERROR_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "0"
            trend: []
        - type: TCP_CONNECTION_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "5"
            trend: []
        - type: TCP_ERROR_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "0"
            trend: []
    dstId:
      site: site1
    srcId:
      site: site1
  - data:
      metric:
        data:
        - type: HTTP_REQUEST_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "5"
            trend: []
        - type: HTTP_ERROR_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "0"
            trend: []
        - type: TCP_CONNECTION_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "10"
            trend: []
        - type: TCP_ERROR_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "1"
            trend: []
    dstId:
      site: site2
    srcId:
      site: site2
  - data:
      metric:
        data:
        - type: HTTP_REQUEST_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "50"
            trend: []
        - type: HTTP_ERROR_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "1"
            trend: []
        - type: TCP_CONNECTION_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "5"
            trend: []
        - type: TCP_ERROR_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "1"
            trend: []
    dstId:
      site: site1
    srcId:
      site: site2
  nodes:
  - data:
      healthscore:
        data: []
      metric:
        downstream:
        - type: HTTP_REQUEST_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "50"
            trend: []
        - type: HTTP_ERROR_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "0"
            trend: []
        - type: TCP_CONNECTION_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "5"
            trend: []
        - type: TCP_ERROR_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "0"
            trend: []
        upstream:
        - type: HTTP_REQUEST_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "100"
            trend: []
        - type: HTTP_ERROR_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "1"
            trend: []
        - type: TCP_CONNECTION_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "10"
            trend: []
        - type: TCP_ERROR_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "1"
            trend: []
    id:
      site: site1
  - data:
      healthscore:
        data: []
      metric:
        downstream:
        - type: HTTP_REQUEST_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "55"
            trend: []
        - type: HTTP_ERROR_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "1"
            trend: []
        - type: TCP_CONNECTION_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "15"
            trend: []
        - type: TCP_ERROR_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "2"
            trend: []
        upstream:
        - type: HTTP_REQUEST_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "5"
            trend: []
        - type: HTTP_ERROR_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "0"
            trend: []
        - type: TCP_CONNECTION_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "10"
            trend: []
        - type: TCP_ERROR_RATE
          value:
            anomaly: []
            confidenceLowerBound: []
            confidenceUpperBound: []
            healthscore: []
            raw:
            - timestamp: 1580407200
              value: "1"
            trend: []
    id:
      site: site2

Request using curl:

curl -X 'POST' -d '{"fieldSelector":{"node":{"metric":{"upstream":["HTTP_REQUEST_RATE","HTTP_ERROR_RATE","TCP_CONNECTION_RATE","TCP_ERROR_RATE"],"downstream":["HTTP_REQUEST_RATE","HTTP_ERROR_RATE","TCP_CONNECTION_RATE","TCP_ERROR_RATE"]}},"edge":{"metric":{"types":["HTTP_REQUEST_RATE","HTTP_ERROR_RATE","TCP_CONNECTION_RATE","TCP_ERROR_RATE"]}}},"startTime":"1580403600","endTime":"1580407200","range":"1h"}' -H 'Content-Type: application/json' -H 'X-Volterra-Useragent: v1/pgm=_tmp_go-build743694289_b001_apidocs.test/host=docker-desktop' 'https://acmecorp.console.ves.volterra.io/api/data/namespaces/ns1/graph/site'

curl response:

HTTP/1.1 200 OK
Content-Type: application/json
Date: Thu, 02 Jul 2020 15:53:06 GMT
Vary: Accept-Encoding

{
  "data": {
    "nodes": [
      {
        "id": {
          "site": "site1"
        },
        "data": {
          "metric": {
            "upstream": [
              {
                "type": "HTTP_REQUEST_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "100"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "HTTP_ERROR_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "1"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "TCP_CONNECTION_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "10"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "TCP_ERROR_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "1"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              }
            ],
            "downstream": [
              {
                "type": "HTTP_REQUEST_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "50"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "HTTP_ERROR_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "0"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "TCP_CONNECTION_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "5"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "TCP_ERROR_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "0"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              }
            ]
          },
          "healthscore": {
            "data": [
            ]
          }
        }
      },
      {
        "id": {
          "site": "site2"
        },
        "data": {
          "metric": {
            "upstream": [
              {
                "type": "HTTP_REQUEST_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "5"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "HTTP_ERROR_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "0"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "TCP_CONNECTION_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "10"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "TCP_ERROR_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "1"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              }
            ],
            "downstream": [
              {
                "type": "HTTP_REQUEST_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "55"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "HTTP_ERROR_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "1"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "TCP_CONNECTION_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "15"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "TCP_ERROR_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "2"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              }
            ]
          },
          "healthscore": {
            "data": [
            ]
          }
        }
      }
    ],
    "edges": [
      {
        "src_id": {
          "site": "site1"
        },
        "dst_id": {
          "site": "site1"
        },
        "data": {
          "metric": {
            "data": [
              {
                "type": "HTTP_REQUEST_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "50"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "HTTP_ERROR_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "0"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "TCP_CONNECTION_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "5"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "TCP_ERROR_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "0"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              }
            ]
          },
          "healthscore": null
        }
      },
      {
        "src_id": {
          "site": "site2"
        },
        "dst_id": {
          "site": "site2"
        },
        "data": {
          "metric": {
            "data": [
              {
                "type": "HTTP_REQUEST_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "5"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "HTTP_ERROR_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "0"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "TCP_CONNECTION_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "10"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "TCP_ERROR_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "1"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              }
            ]
          },
          "healthscore": null
        }
      },
      {
        "src_id": {
          "site": "site2"
        },
        "dst_id": {
          "site": "site1"
        },
        "data": {
          "metric": {
            "data": [
              {
                "type": "HTTP_REQUEST_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "50"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "HTTP_ERROR_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "1"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "TCP_CONNECTION_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "5"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              },
              {
                "type": "TCP_ERROR_RATE",
                "value": {
                  "raw": [
                    {
                      "timestamp": 1580407200,
                      "value": "1"
                    }
                  ],
                  "confidence_upper_bound": [
                  ],
                  "confidence_lower_bound": [
                  ],
                  "anomaly": [
                  ],
                  "trend": [
                  ],
                  "healthscore": [
                  ]
                }
              }
            ]
          },
          "healthscore": null
        }
      }
    ]
  }
}