Start Prometheus exporter along with the Rails server

This commit is contained in:
Eugene Burmakin 2024-11-20 13:25:58 +01:00
parent c888ff23df
commit da19196660
5 changed files with 10 additions and 3 deletions

View file

@ -1 +1 @@
0.16.5
0.16.6

View file

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
# 0.16.6 - 2024-11-20
### Added
- Dawarich now exports metrics to Prometheus. You can find the metrics at `/metrics` endpoint. The metrics are being exported in the Prometheus format and can be scraped by Prometheus server. You can find an example of how to scrape the metrics in the `docker-compose.yml` file in the repository.
# 0.16.5 - 2024-11-18
### Changed

View file

@ -6,7 +6,6 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby File.read('.ruby-version').strip
gem 'bootsnap', require: false
gem 'prometheus_exporter'
gem 'chartkick'
gem 'data_migrate'
gem 'devise'
@ -19,6 +18,7 @@ gem 'kaminari'
gem 'lograge'
gem 'oj'
gem 'pg'
gem 'prometheus_exporter'
gem 'puma'
gem 'pundit'
gem 'rails'

View file

@ -1 +1,2 @@
web: bin/rails server -p 3000 -b 0.0.0.0
prometheus_exporter: bundle exec prometheus_exporter

View file

@ -42,7 +42,7 @@ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
# Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart
# in unicorn/puma/passenger be sure to run a new process instrumenter after fork
# Promethues exporter
after_worker_boot do
require 'prometheus_exporter/instrumentation'
PrometheusExporter::Instrumentation::Process.start(type:"web")