2021-10-15 05:44:59 +11:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Admin::Metrics::Dimension
|
|
|
|
DIMENSIONS = {
|
|
|
|
languages: Admin::Metrics::Dimension::LanguagesDimension,
|
|
|
|
sources: Admin::Metrics::Dimension::SourcesDimension,
|
|
|
|
servers: Admin::Metrics::Dimension::ServersDimension,
|
|
|
|
space_usage: Admin::Metrics::Dimension::SpaceUsageDimension,
|
|
|
|
software_versions: Admin::Metrics::Dimension::SoftwareVersionsDimension,
|
2021-11-25 23:07:38 +11:00
|
|
|
tag_servers: Admin::Metrics::Dimension::TagServersDimension,
|
|
|
|
tag_languages: Admin::Metrics::Dimension::TagLanguagesDimension,
|
2022-03-09 18:52:32 +11:00
|
|
|
instance_accounts: Admin::Metrics::Dimension::InstanceAccountsDimension,
|
|
|
|
instance_languages: Admin::Metrics::Dimension::InstanceLanguagesDimension,
|
2021-10-15 05:44:59 +11:00
|
|
|
}.freeze
|
|
|
|
|
2021-11-25 23:07:38 +11:00
|
|
|
def self.retrieve(dimension_keys, start_at, end_at, limit, params)
|
2023-05-23 18:49:12 +10:00
|
|
|
Array(dimension_keys).filter_map do |key|
|
2021-11-25 23:07:38 +11: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 18:49:12 +10:00
|
|
|
end
|
2021-10-15 05:44:59 +11:00
|
|
|
end
|
|
|
|
end
|