2021-10-14 21:44:59 +03: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 14:07:38 +02:00
|
|
|
tag_servers: Admin::Metrics::Dimension::TagServersDimension,
|
|
|
|
tag_languages: Admin::Metrics::Dimension::TagLanguagesDimension,
|
2022-03-09 09:52:32 +02:00
|
|
|
instance_accounts: Admin::Metrics::Dimension::InstanceAccountsDimension,
|
|
|
|
instance_languages: Admin::Metrics::Dimension::InstanceLanguagesDimension,
|
2021-10-14 21:44:59 +03:00
|
|
|
}.freeze
|
|
|
|
|
2021-11-25 14:07:38 +02:00
|
|
|
def self.retrieve(dimension_keys, start_at, end_at, limit, params)
|
|
|
|
Array(dimension_keys).map do |key|
|
|
|
|
klass = DIMENSIONS[key.to_sym]
|
|
|
|
klass&.new(start_at, end_at, limit, klass.with_params? ? params.require(key.to_sym) : nil)
|
|
|
|
end.compact
|
2021-10-14 21:44:59 +03:00
|
|
|
end
|
|
|
|
end
|