{
  "id": "monitoring-guide",
  "title": "Monitoring guide",
  "url": "https://redis.io/docs/latest/integrate/write-behind/monitoring-guide/",
  "summary": "Monitor Write-behind engine and data processing jobs",
  "tags": [
    "docs",
    "integrate",
    "rs",
    "rdi"
  ],
  "last_updated": "2026-04-01T08:10:08-05:00",
  "page_type": "content",
  "content_hash": "89c051da6c21de918905723d2c1f3c40dbb6e46bcce7a75acdd783f8b459778a",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Write-behind accumulates operating statistics that you can:\n\n- Observe and analyze to discover various types of problems.\n- Use for optimization purposes."
    },
    {
      "id": "console-metrics",
      "title": "Console metrics",
      "role": "content",
      "text": "Write-behind can display its operating metrics in the console using the\n[`redis-di status`]()\ncommand. The command provides information about the current Write-behind engine status, target database configuration, and processing statistics broken down by stream. This tool is intended to be used by Operator to get the current snapshot of the system as well as monitoring ongoing data processing (when used in live mode)."
    },
    {
      "id": "prometheus-integration",
      "title": "Prometheus integration",
      "role": "content",
      "text": "Write-behind allows collecting and exporting its metrics to [Prometheus](https://prometheus.io/) and visualizing them in [Grafana](https://grafana.com/). Operator can start the built-in exporter using the\n[`redis-di monitor`]()\ncommand. The diagram describes this flow and the components involved:\n\n\n\n> Note: The host names and ports above are examples only and can be changed as needed."
    },
    {
      "id": "test-write-behind-metrics-exporter",
      "title": "Test Write-behind metrics exporter",
      "role": "content",
      "text": "Start the Write-behind metrics exporter using the command below:\n\n[code example]\n\n> Note: The default port for the exporter is `9121`. If you need to change it, use the `--exporter-port` option. The default metrics collection interval is 5 seconds. If you need to change it, use the `--collect-interval` option.\n\nThen navigate to `http://localhost:9121/` to see the exported metrics. You should be able to see the following metric:\n\n[code example]\n\n> Note: The actual value of the metric above can be 0 if you haven't started Write-behind engine yet (in which case, the `state` label should indicate that as well). You must have the Write-behind database created and configured before observing any metrics. If you are not seeing it or getting an error value instead, this indicates that the Write-behind database is not properly configured."
    },
    {
      "id": "configure-prometheus",
      "title": "Configure Prometheus",
      "role": "configuration",
      "text": "Next, configure the Prometheus scraper. Edit the `prometheus.yml` file to add the following scraper config:\n\n[code example]\n\n> Notes:\n\n- Make sure the `targets` value above points to the host and port you configured to run the Write-behind metrics exporter.\n- The `scrape_interval` setting in Prometheus should be the same or higher than the `collect_interval` setting for the exporter. For example, if the `collect_interval` is set to 5 seconds, the `scrape_interval` should also be set to 5 seconds or more. If the `scrape_interval` is set to less than the `collect_interval`, Prometheus will scrape the exporter before it has a chance to collect and refresh metrics, and you will see duplicated values in Prometheus."
    },
    {
      "id": "test-the-prometheus-scraper",
      "title": "Test the Prometheus scraper",
      "role": "content",
      "text": "After the scraper config is added to the Prometheus configuration, you should now be able to navigate to `http://<HOSTNAME>:9090/graph` (replace `<HOSTNAME>` with a valid Prometheus hostname or IP address).\n\nExplore Write-behind metrics using the [expression browser](https://prometheus.io/docs/visualization/browser/).\n\nIn the expression box, type in a metric name (for example, `rdi_engine_state`) and select `Enter` or the `Execute` button to see the following result:\n\n[code example]\n\n> Note: You may see more than just one Write-behind metric if Write-behind engine has already processed some data. If you do not see any metrics, check your scraper job configuration in Prometheus."
    },
    {
      "id": "use-grafana-to-analyze-metrics",
      "title": "Use Grafana to analyze metrics",
      "role": "content",
      "text": "Optionally, you may deploy the sample Grafana dashboard to monitor the status of Write-behind engine and its individual jobs. Follow these steps to import the dashboard:\n\n1. Download the **dashboard file** to your local machine.\n\n1. Log into Grafana and navigate to the list of dashboards, then choose **New > Import**:\n\n\n\n1. On the next screen, select **Upload JSON file** and upload the file you downloaded in step 1. Make sure you select the data source that is connected to the Write-behind metrics exporter:\n\n\n\n1. Select **Import** and make sure you choose the jobs to monitor from the drop-down list (this will be empty if you don't have any jobs running yet):"
    },
    {
      "id": "write-behind-metrics",
      "title": "Write-behind metrics",
      "role": "content",
      "text": "This list shows exported Write-behind metrics along with their descriptions:\n\n| Metric Name                 | Labels                                                                                                     | Values               | Description                                                                                                                                                                                                        |\n| --------------------------- | ---------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| rdi_engine_state            | {status=RUNNING \\| STOPPED, sync_mode=SNAPSHOT \\| STREAMING \\| UNKNOWN}                                    | 0, 1                 | Status of Write-behind engine. 0 - Write-behind engine is stopped, 1 - Write-behind engine is running. Sync mode label indicates the last reported ingest synchronization mode.                                                               |\n| rdi_incoming_entries        | {data_source=`<stream name>`, operation=pending \\| inserted \\| updated \\| deleted \\| filtered \\| rejected} | `<count of records>` | Counters, indicating the number of operations performed for each stream.                                                                                                                                           |\n| rdi_stream_event_latency_ms | {data_source=`<stream name>`}                                                                              | 0 - &infin;          | Latency calculated for each stream. Indicates the time in milliseconds the first available record has spent in the stream waiting to be processed by Write-behind engine. If no records pending it will always return zero. |"
    }
  ],
  "examples": [
    {
      "id": "test-write-behind-metrics-exporter-ex0",
      "language": "bash",
      "code": "redis-di monitor",
      "section_id": "test-write-behind-metrics-exporter"
    },
    {
      "id": "test-write-behind-metrics-exporter-ex1",
      "language": "plaintext",
      "code": "rdi_engine_state{state=\"RUNNING\",sync_mode=\"UNKNOWN\"} 1.0",
      "section_id": "test-write-behind-metrics-exporter"
    },
    {
      "id": "configure-prometheus-ex0",
      "language": "yaml",
      "code": "scrape_configs:\n  # scrape Write-behind metrics exporter\n  - job_name: rdi-exporter\n    static_configs:\n      - targets: [\"redis-exporter:9121\"]",
      "section_id": "configure-prometheus"
    },
    {
      "id": "test-the-prometheus-scraper-ex0",
      "language": "plaintext",
      "code": "rdi_engine_state{instance=\"redis-exporter:9121\", job=\"rdi-exporter\", status=\"RUNNING\", sync_mode=\"UNKNOWN\"} 1",
      "section_id": "test-the-prometheus-scraper"
    }
  ]
}
