Skip to content
This repository was archived by the owner on Jul 19, 2022. It is now read-only.

Indicator Registry API

Vera Reynolds edited this page Sep 25, 2019 · 2 revisions

Querying Indicators

HTTP Request

GET /v1/indicator-documents

Query Parameters

If no parameters are provided, all documents will be returned. If multiple parameters are provided, only documents that match all provided parameters will be returned.

  • product-name [optional]: filter documents by product name. For example ?product-name=redis will return only documents with product: {name: redis}
  • metadata tags [optional]: filter documents by any number of metadata tags. For example ?deployment=cf-123 will return only documents with metadata: {deployment: cf-123}

Example Request

curl -X GET https://localhost:8091/v1/indicator-documents?deployment=cf-0123456789 \
  --cert client.pem \
  --key client.key \
  --cacert ca.pem

Example Response

[
  {
    "apiVersion": "indicatorprotocol.io/v1",
    "uid": "my-product-b25baef861986f0854e6c3d7e2db878d5123b3ca",
    "kind": "IndicatorDocument",
    "metadata": {
      "labels": {
        "deployment": "cf-0123456789",
        "source_id": "my-metric-source"
      }
    },
    "spec": {
      "product": {
        "name": "my-product",
        "version": "1.2.3"
      },
      "indicators": [
        {
          "name": "doc_performance_indicator",
          "type": "kpi",
          "promql": "avg_over_time(demo_latency{source_id=\"my-metric-source\",deployment=\"cf-0123456789\"}[5m])",
          "thresholds": [
            {
              "level": "critical",
              "operator": "gt",
              "value": 176
            }
          ],
          "alert": {
            "for": "1m",
            "step": "1m"
          },
          "presentation": {
            "chartType": "step",
            "currentValue": false,
            "frequency": 0,
            "labels": [],
            "units": ""
          },
          "status": {
            "value": "healthy",
            "updatedAt": "0001-01-01T00:00:00Z"
          }
        }
      ],
      "layout": {
        "title": "Hello Indicators",
        "description": "",
        "sections": [
          {
            "title": "Metrics",
            "description": "",
            "indicators": [
              "doc_performance_indicator"
            ]
          }
        ],
        "owner": ""
      }
    }
  }
]

Creating and Updating Indicators

HTTP Request

curl -X POST /v1/register

Data

The data attached to this request must be a valid Indicator Document.

Example Request

curl -X POST https://localhost:8091/v1/register \
  --cert client.pem \
  --key client.key \
  --cacert ca.pem \
  --data-binary @example_indicators.yml

Example Response

200 OK

Clone this wiki locally