# METRICS AyaNova 8+ automatically tracks server metrics for ongoing server maintenance, monitoring and troubleshooting. ## OVERVIEW Metrics are statistical and other information gathered automatically during server operation that can be used to assess the health of an AyaNova server. This information is typically useful to the Operations staff who are responsible for maintaining the AyaNova server in good working condition. When the AyaNova server is booted it starts gathering snapshots of statistical data during regular intervals that can be viewed to observe the current state of the server and some historical data from the point it was last rebooted. Some examples of the metrics gathered include: - Performance per API endpoint routes - Error rates per HTTP error code and API endpoint route - Transactions per endpoint - Database records per table of significance - Count and size of user files (attachments) stored at the server - Count and size of operations files (backups, import/export etc) stored at the server - Job operations data about background process jobs (notifications, backups, maintenance etc) running, succeeded and failed - Memory usage of the server - And more ## ROLES AND RIGHTS Metrics are available to users with the `OPS - full` or `OPS - limited` roles. ## INFORMATION SECURITY AND PRIVACY By design and policy no personally identifiable information is gathered for metrics. The data about API routes consists of consolidated information gathered over multiple users and does not track per IP address. ## VIEWING SNAPSHOT METRICS View a current metrics snapshot directly on the server via the [API Explorer](api-console.md) tool: ![API Explorer](img/v8ServerMetricsSnapshotText.png) TODO: VIEW METRICS IN AYANOVA CLIENT UI ## TAKING IT TO THE NEXT LEVEL - STORING METRICS AND VIEWING GRAPHICALLY AyaNova has built in support to send metrics snapshots automatically to the open source time series database [InfluxDB](https://www.influxdata.com/) and can be viewed with the open source analytics and monitoring tool [Grafana](https://grafana.com/) Example of a testing run of AyaNova during development visualized with Grafana and InfluxDB hosted in a Docker container: ![Grafana in Docker](img/v8ServerMetricsDashboard.png) ### Configuration settings for InfluxDB Use of InfluxDB for metrics is controlled with [environment variables](ops-config-environment-variables.md) read during startup of the AyaNova server: - `AYANOVA_METRICS_USE_INFLUXDB` true / false value, default is `false` set to `true` to turn on metrics reporting to InfluxDB - `AYANOVA_METRICS_INFLUXDB_BASEURL` string value uri to your InfluxDB server default value is `http://127.0.0.1:8086` - `AYANOVA_METRICS_INFLUXDB_DBNAME` string value name of database to use with InfluxDB server default value is `AyaNova` - `AYANOVA_METRICS_INFLUXDB_CONSISTENCY` string value name of InfluxDB consistency policy to use with InfluxDB server default value is empty and not set - `AYANOVA_METRICS_INFLUXDB_USERNAME` string value user name of account to connect to database default value is `root` - `AYANOVA_METRICS_INFLUXDB_PASSWORD` string value password of account to connect to database default value is `root` - `AYANOVA_METRICS_INFLUXDB_RETENTION_POLICY` string value name of InfluxDB retention policy to use with InfluxDB server default value is empty and not set - `AYANOVA_METRICS_INFLUXDB_CREATE_DATABASE_IF_NOT_EXISTS` true / false value, default is `true` set to `true` to automatically create database in InfluxDB if it doesn't exist ### Setting up a Grafana dashboard TODO: dashboard setup and mention of docker