> For the complete documentation index, see [llms.txt](https://algolytics-technologies.gitbook.io/algolytics/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://algolytics-technologies.gitbook.io/algolytics/event-engine-user/visualisation.md).

# Visualisation

## How it works <a href="#how-it-works" id="how-it-works"></a>

To perform visualization, the Event Engine needs **influxDB** and **grafana** (tested on influxDB 1.1.1 and grafana 4.0.2 versions) or **Power BI**. Metrics are passed to **influxDB** by **EVE\_Core** application, and then they are visualized by **grafana**. All requests processed by **EVE\_Core** in specified time are passed to **Metric Processor**, that counts statistics and saves them in **influxDB** database. **EVE\_Core** passes a JSON request, JSON response, clientId and request type to the **Metric Processor**. In **grafana**, **influx** is defined as **DataSource**, from which metrics are downloaded. **EVE\_Core** do not connect with **grafana**.

## Configuration <a href="#configuration" id="configuration"></a>

**Influx** parameters are defined in **EVE\_Core** config file, as well as other parameters for metrics.

List of parameters:

* **metrics\_destination** - INFLUX\_DB if statistics will be sent to influx, POWER\_BI if statistics will be sent to Power BI, NONE if statistics will not be counted
* **influx\_db\_url** - url address of influx, for example: <http://127.0.0.1:8086>
* **influx\_db\_user** - user name
* **influx\_db\_password** - user password
* **influx\_db\_database** - database name
* **influx\_db\_retention\_policy** - retention policy name (retention policy describes how long InfluxDB keeps data)
* **custom\_request\_fields** - fields from an incoming event used as grouping in metrics' values aggregation
* **metric\_processed\_times** - defines how often the number of events occured will be counted
* **metric\_time\_window** - defines how often metrics will be sent to influx, defined in seconds
* **aggregate\_time\_window** - used by MeanScoreMetric, counts average value of score in given time window, defined in seconds (can't be less then metric\_time\_window)
* **max\_metric\_calculation\_threads** - maximum number of threads used to count metrics. The number of threads is set by the number of calculated metrics, but can't be bigger then maximum number of threads.
* **event\_request\_metrics** - metrics names for events of EVENT type, available metrics:
  * MeanScoreMetric
  * ProcessedRequestsMetric
  * WinPrcMetric
  * BidPrcMetric
* **profile\_request\_metrics** - metrics names for events of PROFILE type

## Available metrics <a href="#available-metrics" id="available-metrics"></a>

**Processed Requests Metric**

This metric presents the number of processed requests in specified time window (defined as **metric\_time\_window** parameter), including the number of incorrect requests and scored request. Statistics are aggregated per clientId and fields defined in **custom\_request\_fields**.

Fields in JSON send to grafana (influx name: processed\_requests, all fields are numeric):

* processed
* processed\_time\_\[number from config]
* scored
* errors
* min\_time
* max\_time
* mean\_time
* sum\_time

<figure><img src="https://2784301415-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZKEXabVqsSUGdA72pv7B%2Fuploads%2F5gtI3QMcy2kv3zkkLzoT%2FProcessedRequestsMetric.webp?alt=media&amp;token=912bf0db-e07d-43cb-9bf1-a3dd32460eb3" alt=""><figcaption></figcaption></figure>

**Mean Score Metric**

This metric presents mean score for every clientId and modelId and fields defined in **custom\_request\_fields**.Time window is defined in **aggregate\_time\_window**, with shift defined in **metric\_time\_window** parameter.

In programmatic, a suggested bidding price is returned instead of score.

Fields in JSON send to grafana (influx name: score, all fields except of modelId are numeric):

* min\_score
* max\_score
* mean\_score
* sum\_score
* scores\_count
* modelId (text)

<figure><img src="https://2784301415-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZKEXabVqsSUGdA72pv7B%2Fuploads%2FmbncFfQNatxhvnjCYQme%2FMeanScoreMetric.webp?alt=media&amp;token=ed58d753-0f46-43ed-9b7a-f820d54b42b5" alt=""><figcaption></figcaption></figure>

**WinPrcMetric\***

WinPrcMetric - price paid for a won view

Fields in JSON send to grafana (influx name: win\_prc, all fields are numeric):

* min\_win\_prc
* max\_win\_prc
* mean\_win\_prc
* sum\_win\_prc
* count\_win\_prc

**BidPrcMetric\***

BidPrcMetric - bidded price (from bid response)

Fields in JSON send to grafana (influx name: bid\_prc, all fields are numeric):

* min\_bid\_prc
* max\_bid\_prc
* mean\_bid\_prc
* sum\_bid\_prc
* count\_bid\_prc

\*(Metrics only used in programmatic)
