Add caching layer to metrics (#17617)

This commit is contained in:
Eugen Rochko 2022-02-22 15:27:08 +01:00 committed by GitHub
parent 8338826963
commit b377022cf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 165 additions and 55 deletions

View file

@ -8,12 +8,12 @@ class Admin::Metrics::Dimension::SpaceUsageDimension < Admin::Metrics::Dimension
'space_usage'
end
def data
protected
def perform_query
[postgresql_size, redis_size, media_size]
end
private
def postgresql_size
value = ActiveRecord::Base.connection.execute('SELECT pg_database_size(current_database())').first['pg_database_size']