dawarich/app/services/tile_usage/track.rb

20 lines
396 B
Ruby
Raw Normal View History

2025-02-11 14:45:36 -05:00
# frozen_string_literal: true
class TileUsage::Track
def initialize(count = 1)
@count = count
end
def call
metric_data = {
type: 'counter',
name: 'dawarich_map_tiles',
value: @count
}
PrometheusExporter::Client.default.send_json(metric_data)
rescue StandardError => e
Rails.logger.error("Failed to send tile usage metric: #{e.message}")
end
end