Skip to content

Metrics Monitoring

Monitoring is a feature used for observing and tracking performance, availability, and health of the system. In scope of the Document Reader Web Server the metrics are collected by means of the Prometheus monitoring and alerting toolkit.

Note that for now, Windows is not supported.

How It Works

Prometheus server pulls (or "scrapes") time series data from the preconfigured HTTP endpoint named /metrics. Then the data is saved to time series database (TSDB) and can be later analyzed, exported, or visualized by means of Prometheus components or third-party tools. Additionally, an alert manager can be set up to trigger notifications.

We created a simple Grafana dashboard as an example to visualize Document Reader SDK Web API metrics. You can download and import this dashboard into your Grafana instance. For detailed instructions on installing Grafana and managing dashboards, refer to the official Grafana documentation.

Info

For more information about the toolkit ecosystem and architecture, see Prometheus overview.

Quick Start

To start collecting the system telemetry, follow the steps below.

1. Install the Prometheus server and customize its config prometheus.yml to scrape metrics from the target URL where your Document Reader Web Service instance is deployed. For details, see First steps with Prometheus.

2. Enable collecting metrics:

config.yaml
service:
  webServer:
    metrics:
      enabled: true
      path: "metrics"
Parameter Type Default Description
enabled boolean false
(Windows not supported)
Whether to collect Prometheus metrics.
path string "metrics" Specifies the custom file path to save metrics.

From now on, the metrics are automatically written into TSDB. In Prometheus ecosystem, you can retrieve data employing Prometheus Query Language (PromQL), visualize information via expression browser or integrating Grafana, or configure the notifications adding the alert manager.

Available Metrics

Document Reader SDK Web Service together with Prometheus provide you with numerous metrics for request-response analysis. See the overview and useful references further.

Regula Services Metrics

Gauge metrics

  • license_valid_hours — remaining license validity in hours

Gunicorn Server Metrics

Document Reader Web Service uses the Gunicorn HTTP server in its implementation. That gives you access to a number of metrics as follows:

Summary metrics

  • gunicorn_queue_time — the time a request spends in the queue (latency)
  • Sub-metrics:
    • gunicorn_queue_time_count — total count of requests in the queue
    • gunicorn_queue_time_sum — sum of the time spent by requests in the queue

Histogram metrics

  • gunicorn_request_time_histogram — histogram representation of the time a request spends in the queue
  • Sub-metrics:
    • gunicorn_request_time_histogram_count — total count of requests in the histogram
    • gunicorn_request_time_histogram_bucket — distribution of requests in different time intervals
    • gunicorn_request_time_histogram_sum — sum of the time spent by requests in the histogram

Flask HTTP Request Metrics

Document Reader Web Service runs the Flask framework to serve HTTP requests.

Counter metric

  • flask_http_request_total — total count of requests

Histogram metrics

  • flask_http_request_duration_seconds_bucket — duration of request execution in different time intervals
  • flask_http_request_duration_seconds_count — total count of requests in the histogram
  • flask_http_request_duration_seconds_sum — sum of the requests' durations in the histogram

Using PromQL you can filter the metrics by the status parameter, sorting out the requests by response codes (for example, 200, 404, etc.).