KPI entity handler

Description of the KPI entity handler, a module in charge of calling aura-kpi-handler utility.

It is used by aura-authentication-api, aura-bot and aura-groot.

Introduction

One of the elements ready to be used across aura-bot is the kpi-handler, that is the aura-bot module in charge of calling aura-kpi-handler utility.

This kpi-handler is a singleton module that, during its initialization, starts a KpiHandler used to write the rows in the corresponding blob.

Methods

The kpi-handler provides a method to write each entity row that is used at the different stages of the activity processing: aura-bridge-outbound .

  • incomingMessage: generates a MessageEntity with the information available when the message enters aura-bot, if the user is properly authenticated.
  • extendedIncomingMessage: generates a ExtendedMessageEntity with the information available when the message enters aura-bot, if the user is properly authenticated.
  • unauthenticatedIncomingMessage: generates a ExtendedMessageEntity with the information available when the message enters aura-bot, if there is any error during the user’s authentication.
  • outgoingMessage: it is called once per activity returned by aura-bot as response of an incoming activity. It fills all the data generated during the activity processing.
  • extendedOutgoingMessage: it is called once per activity returned by aura-bot as response of an incoming activity. It fills all the data generated during the activity processing.
  • unauthenticatedOutgoingMessage: generates a MessageEntity with the information available when *aura-bot sends the response, if there is any error during the user’s authentication.
  • recognize: generates a RecognizerEntity row with the information of the execution of every recognizer called during the activity processing, this kpi is written by both the aura-bot and the aura-groot.
  • incomingGrootMessage: generates a GrootMessageEntity with the information available when the message enters aura-groot.
  • outgoingGrootMessage: it is called once per activity returned by aura-groot as response of an incoming activity. It fills all the data generated during the activity processing.

All the above-mentioned methods work following the same process:

  1. The information is gathered from their incoming parameters, from the TurnContext and from ConversationState and UserStage .
  2. Data is converted into the values and formats needed by aura-kpi-handler.
  3. The corresponding event handled by aura-kpi-handler is emitted, that is in charge of writing the row in the corresponding blob.
  4. aura-kpi-handler receives the event, processes the data in the corresponding entity and pushes it to the entity buffer stream. This stream is appended to the corresponding BlobFile every 10 seconds (configurable).
  5. If the POD is stopped, all the content in the buffer stream is appended automatically to the log.