Skip to main content
LibreChat is joining ClickHouse to power the open-source Agentic Data Stack 🎉 Learn more
LibreChat

Metrics

This document explains how to add a metrics exporter for Prometheus to LibreChat.

General

Active users in LibreChat

You can use Prometheus or any other OpenMetrics compatible monitoring tool to get metrics about active usage of LibreChat. This includes technical information like the usage of tokens, but also information about end users like the number of total or active users.

LibreChat also exposes built-in Prometheus metrics from the API server at /metrics when METRICS_SECRET is configured. Scrape it with Authorization: Bearer <METRICS_SECRET>. Browser RUM proxy outcomes are reported as rum_proxy_requests_total{endpoint,result}, where endpoint is traces, logs, or unknown, and result can be success, auth_drop, auth_error, bad_request, not_configured, collector_4xx, collector_5xx, collector_error, or collector_timeout.

The metrics exporter is available at virtUOS/librechat_exporter. It is a separate tool you deploy alongside LibreChat.

Setup

To deploy the exporter, just add the necessary container to your compose configuration like this:

services:
  metrics:
    image: ghcr.io/virtuos/librechat_exporter:main
    depends_on:
      - mongodb
    ports:
      - '8000:8000'
    restart: unless-stopped

You can optionally also configure the exporter. But usually, the defaults should be just fine.

services:
  metrics:
    environment:
      - MONGODB_URI=mongodb://mongodb:27017/
      - LOGGING_LEVEL=info

Usage

You can now add the exporter to your Prometheus scrape configuration:

- job_name: librechat
  static_configs:
    - targets:
        - 'librechat.example.com:8000'

Once scraping the metrics has started, look for librechat_* metrics (e.g., librechat_registered_users). The exporter provides several metrics.

Have fun building your Grafana dashboard!

How is this guide?

On this page