diff --git a/.app_version b/.app_version index 1cf0537c..41915c79 100644 --- a/.app_version +++ b/.app_version @@ -1 +1 @@ -0.19.0 +0.19.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index c6e923d2..b4cb6251 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,13 @@ 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.19.0 - 2024-12-03 +# 0.19.1 - 2024-12-04 + +### Fixed + +- Sidekiq is now being correctly exported to Prometheus with `PROMETHEUS_EXPORTER_ENABLED=true` env var in `dawarich_sidekiq` service. + +# 0.19.0 - 2024-12-04 ## The Photoprism integration release diff --git a/app/services/own_tracks/rec_parser.rb b/app/services/own_tracks/rec_parser.rb index 2b07a9a8..7e502263 100644 --- a/app/services/own_tracks/rec_parser.rb +++ b/app/services/own_tracks/rec_parser.rb @@ -9,7 +9,12 @@ class OwnTracks::RecParser def call file.split("\n").map do |line| - JSON.parse(line.split("\t* \t")[1]) - end + parts = line.split("\t") + if parts.size > 2 && parts[1].strip == '*' + JSON.parse(parts[2]) + else + nil + end + end.compact end end diff --git a/config/initializers/02_version_cache.rb b/config/initializers/02_version_cache.rb new file mode 100644 index 00000000..c6fed3b3 --- /dev/null +++ b/config/initializers/02_version_cache.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +Rails.cache.delete('dawarich/app-version-check') diff --git a/config/initializers/prometheus.rb b/config/initializers/prometheus.rb index 0a3e1b37..3573fb84 100644 --- a/config/initializers/prometheus.rb +++ b/config/initializers/prometheus.rb @@ -7,7 +7,7 @@ if !Rails.env.test? && ENV['PROMETHEUS_EXPORTER_ENABLED'].to_s == 'true' # This reports stats per request like HTTP status and timings Rails.application.middleware.unshift PrometheusExporter::Middleware - # this reports basic process stats like RSS and GC info + # This reports basic process stats like RSS and GC info PrometheusExporter::Instrumentation::Process.start(type: 'web') # Add ActiveRecord instrumentation diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 4ae6cc8d..9e54f2ab 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -6,14 +6,16 @@ Sidekiq.configure_server do |config| if ENV['PROMETHEUS_EXPORTER_ENABLED'].to_s == 'true' require 'prometheus_exporter/instrumentation' + # Add middleware for collecting job-level metrics config.server_middleware do |chain| chain.add PrometheusExporter::Instrumentation::Sidekiq end + # Capture metrics for failed jobs config.death_handlers << PrometheusExporter::Instrumentation::Sidekiq.death_handler + # Start Prometheus instrumentation config.on :startup do - PrometheusExporter::Instrumentation::Process.start type: 'sidekiq' PrometheusExporter::Instrumentation::SidekiqProcess.start PrometheusExporter::Instrumentation::SidekiqQueue.start PrometheusExporter::Instrumentation::SidekiqStats.start @@ -25,6 +27,4 @@ Sidekiq.configure_client do |config| config.redis = { url: ENV['REDIS_URL'] } end -if (defined?(Rails::Server) || Sidekiq.server?) && PHOTON_API_HOST == 'photon.komoot.io' - Sidekiq::Queue['reverse_geocoding'].limit = 1 -end +Sidekiq::Queue['reverse_geocoding'].limit = 1 if Sidekiq.server? && PHOTON_API_HOST == 'photon.komoot.io' diff --git a/spec/fixtures/files/owntracks/2024-03.rec b/spec/fixtures/files/owntracks/2024-03.rec index 2f2508b1..473591f7 100644 --- a/spec/fixtures/files/owntracks/2024-03.rec +++ b/spec/fixtures/files/owntracks/2024-03.rec @@ -6,5 +6,8 @@ 2024-03-01T18:33:03Z * {"cog":18,"batt":85,"lon":13.337,"acc":5,"bs":1,"p":100.347,"vel":4,"vac":3,"lat":52.230,"topic":"owntracks/test/iPhone 12 Pro","conn":"m","m":1,"tst":1709317983,"alt":36,"_type":"location","tid":"RO","_http":true} 2024-03-01T18:40:11Z * {"cog":43,"batt":85,"lon":13.338,"acc":5,"bs":1,"p":100.348,"vel":6,"vac":3,"lat":52.231,"topic":"owntracks/test/iPhone 12 Pro","conn":"m","m":1,"tst":1709318411,"alt":37,"_type":"location","tid":"RO","_http":true} 2024-03-01T18:42:57Z * {"cog":320,"batt":85,"lon":13.339,"acc":5,"bs":1,"p":100.353,"vel":3,"vac":3,"lat":52.232,"topic":"owntracks/test/iPhone 12 Pro","t":"v","conn":"m","m":1,"tst":1709318577,"alt":37,"_type":"location","tid":"RO","_http":true} +2024-03-01T18:40:08Z lwt {"_type":"lwt","tst":1717459208} +2024-03-01T18:40:09Z waypoints {"_type":"waypoint","desc":"Home","lat":52.232,"lon":13.339,"rad":50,"tst":1717459768} +2024-03-01T18:40:10Z event {"_type":"transition","acc":5,"desc":"Home","event":"enter","lat":52.232,"lon":13.339,"t":"l","tid":"s8","tst":1717460098,"wtst":1717459768} 2024-03-01T18:40:11Z * {"cog":43,"batt":85,"lon":13.338,"acc":5,"bs":1,"p":100.348,"vel":6,"vac":3,"lat":52.231,"topic":"owntracks/test/iPhone 12 Pro","conn":"m","m":1,"tst":1709318411,"alt":37,"_type":"location","tid":"RO","_http":true} 2024-03-01T18:40:11Z * {"cog":43,"batt":85,"lon":13.341,"acc":5,"bs":1,"p":100.348,"created_at":1709318940,"vel":6,"vac":3,"lat":52.234,"topic":"owntracks/test/iPhone 12 Pro","conn":"m","m":1,"tst":1709318411,"alt":37,"_type":"location","tid":"RO","_http":true}