Skip to content

Commit

Permalink
[Stack Monitoring] Fix displaying ES version for external collection (#…
Browse files Browse the repository at this point in the history
…131194)

* [Stack Monitoring] Fix displaying ES version for external collection (#126741)

* Sort node versions and join into display string

* Update test fixture

* Update second test fixture

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
miltonhultgren and kibanamachine authored May 16, 2022
1 parent 8f4f4cd commit aefb58d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
ElasticsearchModifiedSource,
ElasticsearchLegacySource,
ElasticsearchSourceKibanaStats,
ElasticsearchMetricbeatSource,
} from '../../../common/types/es';
// @ts-ignore
import { calculateOverallStatus } from '../calculate_overall_status';
Expand Down Expand Up @@ -47,7 +48,7 @@ export function getClustersSummary(
} = cluster;

const license = cluster.license || cluster.elasticsearch?.cluster?.stats?.license;
const version = cluster.version || cluster.elasticsearch?.version;
const version = cluster.version || ecsFormatVersion(cluster);
const clusterUuid = cluster.cluster_uuid || cluster.elasticsearch?.cluster?.id;
const clusterStatsLegacy = cluster.cluster_stats;
const clusterStatsMB = cluster.elasticsearch?.cluster?.stats;
Expand Down Expand Up @@ -161,3 +162,9 @@ export function getClustersSummary(
};
});
}

function ecsFormatVersion(cluster: ElasticsearchMetricbeatSource) {
const versions = cluster.elasticsearch?.cluster?.stats?.nodes?.versions || [];
const sortedVersions = [...versions].sort().reverse();
return sortedVersions.join('/');
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"cluster_uuid": "__standalone_cluster__",
"version": "",
"license": {},
"elasticsearch": {
"cluster_stats": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
{
"isSupported": true,
"cluster_uuid": "__standalone_cluster__",
"version": "",
"license": {},
"elasticsearch": {
"cluster_stats": {
Expand Down

0 comments on commit aefb58d

Please sign in to comment.