Add Elasticsearch/OpenSearch version to “Software” in admin dashboard (#26652)
parent
e3825a13c1
commit
f2ec2876a4
|
@ -10,7 +10,7 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def perform_query
|
def perform_query
|
||||||
[mastodon_version, ruby_version, postgresql_version, redis_version]
|
[mastodon_version, ruby_version, postgresql_version, redis_version, elasticsearch_version].compact
|
||||||
end
|
end
|
||||||
|
|
||||||
def mastodon_version
|
def mastodon_version
|
||||||
|
@ -57,6 +57,22 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def elasticsearch_version
|
||||||
|
return unless Chewy.enabled?
|
||||||
|
|
||||||
|
client_info = Chewy.client.info
|
||||||
|
version = client_info.dig('version', 'number')
|
||||||
|
|
||||||
|
{
|
||||||
|
key: 'elasticsearch',
|
||||||
|
human_key: client_info.dig('version', 'distribution') == 'opensearch' ? 'OpenSearch' : 'Elasticsearch',
|
||||||
|
value: version,
|
||||||
|
human_value: version,
|
||||||
|
}
|
||||||
|
rescue Faraday::ConnectionFailed, Elasticsearch::Transport::Transport::Error
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
def redis_info
|
def redis_info
|
||||||
@redis_info ||= if redis.is_a?(Redis::Namespace)
|
@redis_info ||= if redis.is_a?(Redis::Namespace)
|
||||||
redis.redis.info
|
redis.redis.info
|
||||||
|
|
Reference in New Issue