mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-20 03:25:17 +01:00
Add Elasticsearch index size to Admin dashboard (#27301)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
parent
340c390849
commit
3171afc36a
@ -11,7 +11,7 @@ class Admin::Metrics::Dimension::SpaceUsageDimension < Admin::Metrics::Dimension
|
|||||||
protected
|
protected
|
||||||
|
|
||||||
def perform_query
|
def perform_query
|
||||||
[postgresql_size, redis_size, media_size]
|
[postgresql_size, redis_size, media_size, search_size].compact
|
||||||
end
|
end
|
||||||
|
|
||||||
def postgresql_size
|
def postgresql_size
|
||||||
@ -65,4 +65,22 @@ class Admin::Metrics::Dimension::SpaceUsageDimension < Admin::Metrics::Dimension
|
|||||||
redis.info
|
redis.info
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def search_size
|
||||||
|
return unless Chewy.enabled?
|
||||||
|
|
||||||
|
client_info = Chewy.client.info
|
||||||
|
|
||||||
|
value = Chewy.client.indices.stats['indices'].values.sum { |index_data| index_data['primaries']['store']['size_in_bytes'] }
|
||||||
|
|
||||||
|
{
|
||||||
|
key: 'search',
|
||||||
|
human_key: client_info.dig('version', 'distribution') == 'opensearch' ? 'OpenSearch' : 'Elasticsearch',
|
||||||
|
value: value.to_s,
|
||||||
|
unit: 'bytes',
|
||||||
|
human_value: number_to_human_size(value),
|
||||||
|
}
|
||||||
|
rescue Faraday::ConnectionFailed, Elasticsearch::Transport::Transport::Error
|
||||||
|
nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user