Software documentation#
This document describes the Quality-time software. It is aimed at Quality-time developers and maintainers.
Component overview#
Quality-time consists of seven Docker components, as depicted above. Each oval is a Docker component.
Bespoke components#
There are four bespoke components:
A frontend, serving the user interface. The frontend is written in JavaScript using ReactJS and Semantic UI React.
An API-server serving the API for the user interface. The API-server is written in Python using Bottle as web framework.
A collector to collect the measurements from the sources. The collector is written in Python using
aiohttp
as HTTP client library.A notifier to notify users about events such as metrics turning red. The notifier is written in Python.
Source code that is shared between the Python components lives in the shared data model and shared code components. These are not run-time components. The code of these components is shared at build time, when the Docker images are created. The data model is used by all Python components, i.e. the API-server, the collector, and the notifier. The shared code is used by the API-server.
Standard components#
Quality-time uses three standard components:
A proxy, routing traffic from and to the userâs browser. The proxy is based on Nginx.
A database, for storing reports and measurements. The database is based on MongoDB.
A renderer, to export reports to PDF. The renderer is based on Puppeteer.
In addition, unless forward authentication is used, an LDAP server is expected to be available to authenticate users.
Test components#
For testing purposes there a few additional components:
A web server serving test data.
A tool to administer users in the LDAP server (phpldapadmin).
A tool to view and edit the database contents (mongo-express).
Frontend#
The frontend contains the React frontend code. This component was bootstrapped using Create React App.
Health check#
As a health check, the favicon is downloaded.
Environment variables#
The frontend uses the following environment variables:
Name |
Default value |
Description |
---|---|---|
|
|
The port the frontend listens on. |
API-server#
API#
The API of the API-server is versioned. The version is not changed when backwards compatible changes are made, such as the addition of new endpoints. The public API is documented separately.
Health check#
The Dockerfile contains a health check that uses curl to retrieve an end-point (api/health) from the API-server. Officially, this end-point does not exist, but since the server returns an empty JSON file for non-existing endpoints it works for checking the health of the API-server.
Environment variables#
The API-server uses the following environment variables:
Name |
Default value |
Description |
---|---|---|
|
|
Port of the API-server. |
|
|
Log level. Allowed values are |
|
|
Mongo database connection URL. |
|
|
Mongo database connection username. This value is only used when |
|
|
Mongo database connection password. This value is only used when |
|
|
Mongo database connection hostname. This value is only used when |
|
|
Mongo database connection port. This value is only used when |
|
|
Comma-separated list of LDAP connection URL(s). |
|
|
LDAP root distinguished name. |
|
|
LDAP lookup user distinguished name. |
|
|
LDAP lookup user password. |
|
|
LDAP search filter. With this default search filter, users can use either their LDAP canonical name ( |
|
|
Whether or not to import example reports in the database on start up. |
|
|
Whether or not to enable forward authentication. |
|
|
Header to use for getting the username if forward authentication is turned on. |
|
|
Duration of user session in number of hours. |
Collector#
The collector is responsible for collecting measurement data from sources. It wakes up periodically and retrieves a list of all metrics from the database. For each metric, the collector gets the measurement data from each of its sources and stores a new measurement to the database.
If a metric has been recently measured and its parameters havenât been changed, the collector skips the metric.
By default, the collector measures metrics whose configuration hasnât been changed every 15 minutes and sleeps 60 seconds in between measurements. This can be changed using the environment variables listed below.
Health check#
Every time the collector wakes up, it writes the current date and time in ISO format to the health check file. This date and time is read by the Docker health check (see the Dockerfile). If the written date and time are too long ago, the collector container is considered to be unhealthy.
Environment variables#
The collector uses the following environment variables:
Name |
Default value |
Description |
---|---|---|
|
|
Log level. Allowed values are |
|
|
The maximum amount of time (in seconds) that the collector sleeps between collecting measurements. |
|
|
The amount of time (in seconds) after which a metric should be measured again. |
|
|
The maximum number of metrics that the collector measures each time it wakes up. If more metrics need to be measured, they will be measured the next time the collector wakes up. |
|
|
The amount of time (in seconds) after which a source connection should timeout. |
|
|
Mongo database connection URL. |
|
|
Mongo database connection username. This value is only used when |
|
|
Mongo database connection password. This value is only used when |
|
|
Mongo database connection hostname. This value is only used when |
|
|
Mongo database connection port. This value is only used when |
|
|
Path to the file used for health check. |
|
Proxy to use by the collector. |
See also
See the aiohttp
documentation for more information on proxy support.
Notifier#
The notifier is responsible for notifying users about significant events, such as metrics turning red. It wakes up periodically and asks the server for all reports. For each report, the notifier determines whether notification destinations have been configured, and whether events happened that need to be notified.
Health check#
Every time the notifier wakes up, it writes the current date and time in ISO format to the health check file. This date and time is read by the Docker health check (see the Dockerfile). If the written date and time are too long ago, the notifier container is considered to be unhealthy.
Environment variables#
The notifier uses the following environment variables:
Name |
Default value |
Description |
---|---|---|
|
|
Mongo database connection URL. |
|
|
Mongo database connection username. This value is only used when |
|
|
Mongo database connection password. This value is only used when |
|
|
Mongo database connection hostname. This value is only used when |
|
|
Mongo database connection port. This value is only used when |
|
|
Path to the file used for health check. |
|
|
Log level. Allowed values are |
|
|
The amount of time (in seconds) that the notifier sleeps between sending notifications. |
Proxy#
The proxy routes traffic from and to the userâs browser. Quality-time uses Nginx, but this can be replaced by another proxy if so desired.
The proxy Dockerfile adds the Quality-time configuration to the Nginx image.
Environment variables#
The proxy uses the following environment variables:
Name |
Default value |
Description |
---|---|---|
|
|
Port of the proxy, within the internal (Docker) network. |
|
|
The host name of the frontend. |
|
|
The port the frontend listens on. |
|
|
The hostname of the API-server. |
|
|
The port the API-server listens on. |
Database#
The database component consists of a MongoDB database to store reports and measurements.
The proxy Dockerfile wraps the MongoDB image in a Quality-time image so the MongoDB version number can be changed when needed.
Quality-time stores its data in a Mongo database using the following collections: datamodels
, measurements
, reports
, reports_overviews
, and sessions
.
Data models, reports, and reports overviews are temporal objects. Every time a new version of the data model is loaded or the user edits a report or the reports overview, an updated copy of the object (a âdocumentâ in Mongo-parlance) is added to the collection. Since each copy has a timestamp, this enables the API-server to retrieve the documents as they were at a specific moment in time and provide time-travel functionality.
Environment variables#
The database uses the following environment variables:
Name |
Default value |
Description |
---|---|---|
|
|
The MongoDB root username. |
|
|
The MongoDB root password. |
Renderer#
The renderer component is used to export quality reports to PDF. Quality-time uses puppeteer.
The renderer Dockerfile wraps puppeteer with a small API that uses puppeteer to convert a report URL into a PDF file.
Health check#
The Dockerfile contains a health check that uses curl to retrieve an API (api/health) from the renderer API server.
Environment variables#
The renderer uses the following environment variables:
Name |
Default value |
Description |
---|---|---|
|
|
Hostname of the proxy. The renderer uses this to access the reports that need to be exported to PDF. |
|
|
Port of the proxy, within the internal (Docker) network. The renderer uses this to access the reports that need to be exported to PDF. |
|
|
Protocol of the proxy. The renderer uses this to access the reports that need to be exported to PDF. |
|
Set the date format in the PDF export. For example, to get DD-MM-YYYY use: |
|
|
Make the PDF export use the correct timezone. For example, to get Central European Time use: |
Test data#
This component contains test data for the example reports. The Docker image is published as ictu/quality-time_testdata
on Docker Hub.
Running the test data component#
The test data component is started as part of the Docker-composition for development, see the developer manual.
To serve the test data locally, you can also start a web server from a console, for example:
python3 -m http.server
Adding test data#
Add the example file(s) to the test data reports and update one or more of the example reports in the shared code component.
Acknowledgements#
cobertura.xml
was copied from https://github.com/Bachmann1234/diff_cover/blob/main/diff_cover/tests/fixtures/dotnet_coverage.xml.testng-results.xml
was copied from https://github.com/richie-b/AtnApiTest/blob/master/test-output/testng-results.xml.
Test LDAP server#
A test LDAP server with test users is included for development and testing purposes. An admin interface (phpldapadmin) is included to administer users in this LDAP server.
LDAP users#
The LDAP database has two users:
User |
Email address |
Username |
Password |
---|---|---|---|
Jane Doe |
|
|
|
John Doe |
|
|
|