2021-10-14 20:44:59 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Admin::Metrics::Dimension
|
|
|
|
DIMENSIONS = {
|
2024-03-11 10:16:19 +01:00
|
|
|
languages: LanguagesDimension,
|
|
|
|
sources: SourcesDimension,
|
|
|
|
servers: ServersDimension,
|
|
|
|
space_usage: SpaceUsageDimension,
|
|
|
|
software_versions: SoftwareVersionsDimension,
|
|
|
|
tag_servers: TagServersDimension,
|
|
|
|
tag_languages: TagLanguagesDimension,
|
|
|
|
instance_accounts: InstanceAccountsDimension,
|
|
|
|
instance_languages: InstanceLanguagesDimension,
|
2021-10-14 20:44:59 +02:00
|
|
|
}.freeze
|
|
|
|
|
2021-11-25 13:07:38 +01:00
|
|
|
def self.retrieve(dimension_keys, start_at, end_at, limit, params)
|
2023-05-23 10:49:12 +02:00
|
|
|
Array(dimension_keys).filter_map do |key|
|
2021-11-25 13:07:38 +01:00
|
|
|
klass = DIMENSIONS[key.to_sym]
|
|
|
|
klass&.new(start_at, end_at, limit, klass.with_params? ? params.require(key.to_sym) : nil)
|
2023-05-23 10:49:12 +02:00
|
|
|
end
|
2021-10-14 20:44:59 +02:00
|
|
|
end
|
|
|
|
end
|