dawarich/app/services/maps/tile_usage/track.rb

20 lines
408 B
Ruby
Raw Normal View History

2025-02-11 14:45:36 -05:00
# frozen_string_literal: true
2025-02-11 15:04:12 -05:00
class Maps::TileUsage::Track
2025-02-11 14:45:36 -05:00
def initialize(count = 1)
@count = count
end
def call
metric_data = {
type: 'counter',
2025-02-11 15:17:33 -05:00
name: 'dawarich_map_tiles_usage',
2025-02-11 14:45:36 -05:00
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