kpi(4.3)

The kpi objects describe how metrics are linked to dimensions and threshold levels.

You may configure kpi objects to perform additional calculations based on metrics, e g ratios or sums of ratios.

The following JSON schema describes the data format of the kpi object type:

 Click here to expand...
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "KpiMgmt Kpi Schema",
  "type": "object",
  "minProperties": 1,
  "additionalProperties": {
    "$ref": "#/definitions/kpi"
  },
  "definitions": {
    "kpi": {
      "type": "object",
      "properties": {
        "node": {
          "type": "array",
          "minItems": 2,
          "items": {
            "type": "string"
          }
        },
        "immediateAlarm": {
          "type": "boolean"
        },
        "windowSize": {
          "type": "integer"
        },
        "threshold": {
          "type": "string"
        },
        "expr": {
          "$ref": "model_expression_schema.json"
        }
      },
      "additionalProperties": false,
      "required": [
        "node",
        "windowSize",
        "expr"
      ]
    }
  }
}
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "KpiMgmt Expression Schema",
  "type": "string"
}


The kpi object type has the following properties:

PropertyDescription
node

node must contain an array of strings that constitutes a path to a node in a tree object. The first value in the array must match the name of a tree object, and the subsequent values must match the name of the descendant nodes in the tree object.

immediateAlarm

When immediateAlarm is set to false, exceeded threshold levels will be indicated in a KPIOutput UDR at the end of a period. The UDR field outputType will be set to 0. This is the default behavior.

When immediateAlarm is set to true, a KPIOutput UDR with outputType 1 will be generated at the time of detection. Exceeded threshold levels will also be indicated in the output that is generated at the end of the period. Immediate alarm data are sent by Spark to the Kafka topic kpi-alarm.

windowSize

The incoming data is sorted into time periods based on the timestamp value of the KDR UDRs. The KPIs are calculated and generated according to these periods.

windowSize defines the length of the periods in the same time unit as the KDR timestamp.

A flooring algorithm is applied to timestamps in order to select the start time of a period:

period start = kdr.timestamp - (kdr.timestamp mod windowSize)

Note!

When the value of aggregated-output is false, kpi objects in your service model may have different window sizes. However, when the value of aggregated-output is true, all kpi objects in the model must have the same window size.

threshold

threshold may contain the name of a threshold object.

expr

expr must contain an arithmetic expression based on metric objects. You can use the expression to calculate e.g. ratios or sums of ratios.

Example - Expressions

"Plain" metric:  

"expr": "AvgLength"

Ratio:

"expr": "TotalAttempts/TotalSuccessful"

Sum of Ratios:

"expr": "(Type1Attempts/Type1Successful)+(Type2Attempts/Type2Successful)"

In the case of division by zero, the value of the output of the expression will be positive infinity, negative infinity, or NaN (Not a Number) as defined in the JVM specification.

Example - JSON Representation

"kpi": {
     "Region.AL": {
       "node": [
         "tree1",
         "Region"
       ],
       "windowSize": 60,
       "threshold": "Region.AL",
       "expr": "AvgLength"
     }
 }