mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
* Add immediate verification and count validation to raw data archiving * Remove verifying job * Add archive metrics reporting * Disable RailsPulse in Self-hosted Environments * Remove user_id and points_count parameters from Metrics::Archives::Operation and related calls.
28 lines
690 B
Ruby
28 lines
690 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Metrics::Archives::Operation
|
|
OPERATIONS = %w[archive verify clear restore].freeze
|
|
|
|
def initialize(operation:, status:)
|
|
@operation = operation
|
|
@status = status # 'success' or 'failure'
|
|
end
|
|
|
|
def call
|
|
return unless DawarichSettings.prometheus_exporter_enabled?
|
|
|
|
metric_data = {
|
|
type: 'counter',
|
|
name: 'dawarich_archive_operations_total',
|
|
value: 1,
|
|
labels: {
|
|
operation: @operation,
|
|
status: @status
|
|
}
|
|
}
|
|
|
|
PrometheusExporter::Client.default.send_json(metric_data)
|
|
rescue StandardError => e
|
|
Rails.logger.error("Failed to send archive operation metric: #{e.message}")
|
|
end
|
|
end
|