From da19196660b2ac1a1f29478f997802ebcc78ad02 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Wed, 20 Nov 2024 13:25:58 +0100 Subject: [PATCH] Start Prometheus exporter along with the Rails server --- .app_version | 2 +- CHANGELOG.md | 6 ++++++ Gemfile | 2 +- Procfile.dev | 1 + config/puma.rb | 2 +- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.app_version b/.app_version index 19270385..c3f65805 100644 --- a/.app_version +++ b/.app_version @@ -1 +1 @@ -0.16.5 +0.16.6 diff --git a/CHANGELOG.md b/CHANGELOG.md index e1863d71..47a89c8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/Gemfile b/Gemfile index d831ec9d..a1a27f8c 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/Procfile.dev b/Procfile.dev index e6096674..2f1921fb 100644 --- a/Procfile.dev +++ b/Procfile.dev @@ -1 +1,2 @@ web: bin/rails server -p 3000 -b 0.0.0.0 +prometheus_exporter: bundle exec prometheus_exporter diff --git a/config/puma.rb b/config/puma.rb index 08673ab4..683d0ba0 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -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")