Skip to main content

Monitoring with Prometheus

Dawarich exports application and Sidekiq metrics in the Prometheus exposition format. Since 1.7.7, the metrics backend is Yabeda (replacing discourse/prometheus_exporter). Metrics are now served in-process by each application — no separate exporter container or sidecar is required.

If you're upgrading from a version before 1.7.7, see the 1.7.7 entry in the Updating guides for the metric-name rename table and the env-var changes you need to apply.

Configuration

Enable the exporter

Set the same flag on both the dawarich_app and dawarich_sidekiq services in your docker-compose.yml:

VariableDefaultDescription
PROMETHEUS_EXPORTER_ENABLEDfalseMaster on/off switch. Must be true on both services.
METRICS_USERNAME(unset)HTTP basic auth username Prometheus uses to scrape /metrics. Required.
METRICS_PASSWORD(unset)HTTP basic auth password. Required.
PROMETHEUS_EXPORTER_PORT9394Port on dawarich_sidekiq that serves the in-process Sidekiq metrics endpoint.
SIDEKIQ_METRICS_URLhttp://dawarich_sidekiq:9394/metricsInternal URL the web container uses to fetch Sidekiq metrics. Override on Dokku/Kubernetes or any deployment where the worker hostname differs from the compose default.

Behaviour notes:

  • Single scrape target. Prometheus scrapes dawarich_app:3000/metrics. The web service fetches Sidekiq metrics over the internal network and concatenates them into the same response.
  • Graceful Sidekiq fallback. If Sidekiq is unreachable during a scrape, the web container returns its own metrics only and logs a warning. Prometheus sees a momentary gap in sidekiq_* series instead of a failed scrape.
  • Basic auth is required. Requests without valid METRICS_USERNAME / METRICS_PASSWORD credentials return 401.
  • No more PROMETHEUS_EXPORTER_HOST / PROMETHEUS_EXPORTER_HOST_SIDEKIQ. These environment variables were removed in 1.7.7 — metrics are no longer hosted by a separate process, so there is nothing to bind to.

Prometheus scrape config

scrape_configs:
- job_name: dawarich
metrics_path: /metrics
basic_auth:
username: prometheus # value of METRICS_USERNAME
password: prometheus # value of METRICS_PASSWORD
static_configs:
- targets: ['dawarich_app:3000']

If you're scraping from outside the Docker network, replace dawarich_app:3000 with the host and port you exposed for the dawarich_app service.

Metrics

HTTP / Rails

TypeNameDescription
Counterrails_requests_totalTotal HTTP requests handled by the web app.
Histogramrails_request_durationEnd-to-end request duration in seconds.

Sidekiq

TypeNameDescription
Countersidekiq_jobs_executed_totalJobs executed (per worker class / queue).
Countersidekiq_jobs_failed_totalJobs that raised an exception.
Histogramsidekiq_job_runtime_secondsPer-job runtime in seconds.
Gaugesidekiq_queue_latencyOldest enqueued job's wait time per queue, in seconds.
Gaugesidekiq_jobs_waiting_countJobs sitting in each queue (backlog).
Gaugesidekiq_active_processesSidekiq processes currently up.

Puma

TypeNameDescription
Gaugepuma_workersActive Puma worker processes.
Gaugepuma_backlogRequests waiting on the listen socket.
Gaugepuma_pool_capacityRemaining thread-pool capacity.

ActiveRecord

TypeNameDescription
Gaugeactiverecord_connection_pool_sizeMaximum allowed pool size.

Dawarich-specific

dawarich_archive_* metric names are unchanged from the pre-Yabeda era — existing dashboards and alerts built on them continue to work.

Additional examples:

# HELP ruby_dawarich_map_tiles_usage
# TYPE ruby_dawarich_map_tiles_usage counter
ruby_dawarich_map_tiles_usage 99

The ruby_dawarich_map_tiles_usage counter tracks total map tiles loaded across users. You can find a chart of this in the user map settings.

Process / GC metrics

Process and GC metrics that prometheus_exporter used to emit by default (ruby_rss, ruby_heap_live_slots, etc.) are not emitted by default under Yabeda. If you need them, register a custom Yabeda group in your fork or wait for them to be added upstream.

Migrating from prometheus_exporter (pre-1.7.7)

If you have dashboards or alerts that reference the old metric names, update them per this table:

CategoryBefore (prometheus_exporter)After (Yabeda)
HTTP requests totalruby_http_requests_totalrails_requests_total
HTTP request durationruby_http_request_duration_secondsrails_request_duration
Sidekiq jobs totalruby_sidekiq_jobs_totalsidekiq_jobs_executed_total
Sidekiq failed jobsruby_sidekiq_failed_jobs_totalsidekiq_jobs_failed_total
Sidekiq job durationruby_sidekiq_job_duration_secondssidekiq_job_runtime_seconds
Sidekiq queue latencyruby_sidekiq_queue_latency_secondssidekiq_queue_latency
Sidekiq queue backlogruby_sidekiq_queue_backlog_totalsidekiq_jobs_waiting_count
Sidekiq process countruby_sidekiq_process_countsidekiq_active_processes
Puma workersruby_puma_workerspuma_workers
Puma backlogruby_puma_request_backlogpuma_backlog
Puma thread-pool capacityruby_puma_thread_pool_capacitypuma_pool_capacity
ActiveRecord pool sizeactive_record_connection_pool_connectionsactiverecord_connection_pool_size
Process / GCvarious ruby_* seriesnot emitted by default; register a custom Yabeda group

For deployment-side changes (env-var renames, removed sidecar), see the 1.7.7 Updating guide entry.