Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Stack Monitoring] remove cluster_stats dependency #147183

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const getColumns = (
name: i18n.translate('xpack.monitoring.cluster.listing.nodesColumnTitle', {
defaultMessage: 'Nodes',
}),
field: 'elasticsearch.cluster_stats.nodes.count.total',
field: 'elasticsearch.count',
'data-test-subj': 'nodesCount',
sortable: true,
render: (total, cluster) => (
Expand All @@ -138,44 +138,55 @@ const getColumns = (
),
},
{
name: i18n.translate('xpack.monitoring.cluster.listing.indicesColumnTitle', {
defaultMessage: 'Indices',
name: i18n.translate('xpack.monitoring.cluster.listing.logstashColumnTitle', {
defaultMessage: 'Logstash',
}),
field: 'elasticsearch.cluster_stats.indices.count',
'data-test-subj': 'indicesCount',
field: 'logstash.count',
'data-test-subj': 'logstashCount',
sortable: true,
render: (count, cluster) => (
<IsClusterSupported {...cluster}>{numeral(count).format('0,0')}</IsClusterSupported>
),
},
{
name: i18n.translate('xpack.monitoring.cluster.listing.dataColumnTitle', {
defaultMessage: 'Data',
name: i18n.translate('xpack.monitoring.cluster.listing.kibanaColumnTitle', {
defaultMessage: 'Kibana',
}),
field: 'elasticsearch.cluster_stats.indices.store.size_in_bytes',
'data-test-subj': 'dataSize',
field: 'kibana.count',
'data-test-subj': 'kibanaCount',
sortable: true,
render: (size, cluster) => (
<IsClusterSupported {...cluster}>{numeral(size).format('0,0[.]0 b')}</IsClusterSupported>
render: (count, cluster) => (
<IsClusterSupported {...cluster}>{numeral(count).format('0,0')}</IsClusterSupported>
),
},
{
name: i18n.translate('xpack.monitoring.cluster.listing.logstashColumnTitle', {
defaultMessage: 'Logstash',
name: i18n.translate('xpack.monitoring.cluster.listing.beatsColumnTitle', {
defaultMessage: 'Apm',
}),
field: 'logstash.node_count',
'data-test-subj': 'logstashCount',
field: 'apm.count',
'data-test-subj': 'apmCount',
sortable: true,
render: (count, cluster) => (
<IsClusterSupported {...cluster}>{numeral(count).format('0,0')}</IsClusterSupported>
),
},
{
name: i18n.translate('xpack.monitoring.cluster.listing.kibanaColumnTitle', {
defaultMessage: 'Kibana',
name: i18n.translate('xpack.monitoring.cluster.listing.beatsColumnTitle', {
defaultMessage: 'Beats',
}),
field: 'kibana.count',
'data-test-subj': 'kibanaCount',
field: 'beats.count',
'data-test-subj': 'beatsCount',
sortable: true,
render: (count, cluster) => (
<IsClusterSupported {...cluster}>{numeral(count).format('0,0')}</IsClusterSupported>
),
},
{
name: i18n.translate('xpack.monitoring.cluster.listing.beatsColumnTitle', {
defaultMessage: 'Enterprise search',
}),
field: 'enterprisesearch.count',
'data-test-subj': 'enterprisesearchCount',
sortable: true,
render: (count, cluster) => (
<IsClusterSupported {...cluster}>{numeral(count).format('0,0')}</IsClusterSupported>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ export function Overview(props) {

{!isFromStandaloneCluster ? (
<Fragment>
<ElasticsearchPanel
{...props.cluster.elasticsearch}
version={props.cluster.version}
ml={props.cluster.ml}
license={props.cluster.license}
setupMode={props.setupMode}
showLicenseExpiration={props.showLicenseExpiration}
alerts={props.alerts}
/>
{props.cluster.elasticsearch.cluster_stats.nodes.count.total > 0 ? (
<ElasticsearchPanel
{...props.cluster.elasticsearch}
version={props.cluster.version}
ml={props.cluster.ml}
license={props.cluster.license}
setupMode={props.setupMode}
showLicenseExpiration={props.showLicenseExpiration}
alerts={props.alerts}
/>
) : null}
<KibanaPanel
{...props.cluster.kibana}
setupMode={props.setupMode}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { STANDALONE_CLUSTER_CLUSTER_UUID } from '../../../common/constants';
import {
getBeatDataset,
getElasticsearchDataset,
getKibanaDataset,
getLogstashDataset,
} from './get_index_patterns';

export function findMonitoredClustersQuery(options: { start?: number; end?: number }) {
return {
query: {
range: {
'@timestamp': {
gte: options.start,
lte: options.end,
},
},
},
aggs: {
cluster_uuid: {
terms: {
field: 'cluster_uuid',
size: 10,
missing: STANDALONE_CLUSTER_CLUSTER_UUID,
},
aggs: {
elasticsearch: {
filter: {
bool: {
should: [
{ term: { type: 'cluster_stats' } },
{ term: { 'metricset.name': 'cluster_stats' } },
{ term: { 'data_stream.dataset': getElasticsearchDataset('cluster_stats') } },
],
},
},
aggs: {
latest_doc: {
top_hits: {
size: 1,
sort: [
{
'@timestamp': {
order: 'desc',
},
},
],
},
},
},
},
kibana: {
filter: {
bool: {
must: [
{ exists: { field: 'kibana_stats' } },
{
bool: {
should: [
{ term: { type: 'kibana_stats' } },
{ term: { 'metricset.name': 'stats' } },
{ term: { 'data_stream.dataset': getKibanaDataset('stats') } },
],
},
},
],
},
},
aggs: {
instance_count: {
cardinality: {
field: 'kibana_stats.kibana.uuid',
},
},
},
},
apm: {
filter: {
bool: {
must: [
{ term: { [`beats_stats.beat.type`]: 'apm-server' } },
{ exists: { field: 'beats_stats' } },
{
bool: {
should: [
{ term: { type: 'beats_stats' } },
{ term: { 'metricset.name': 'stats' } },
{ term: { 'data_stream.dataset': getBeatDataset('stats') } },
],
},
},
],
},
},
aggs: {
instance_count: {
cardinality: {
field: 'beats_stats.beat.uuid',
},
},
},
},
beats: {
filter: {
bool: {
must_not: { term: { [`beats_stats.beat.type`]: 'apm-server' } },
must: [
{ exists: { field: 'beats_stats' } },
{
bool: {
should: [
{ term: { type: 'beats_stats' } },
{ term: { 'metricset.name': 'stats' } },
{ term: { 'data_stream.dataset': getBeatDataset('stats') } },
],
},
},
],
},
},
aggs: {
instance_count: {
cardinality: {
field: 'beats_stats.beat.uuid',
},
},
},
},
logstash: {
filter: {
bool: {
must: [
{
exists: {
field: 'logstash_stats',
},
},
{
bool: {
should: [
{ term: { type: 'logstash_stats' } },
{ term: { 'metricset.name': 'stats' } },
{ term: { 'data_stream.dataset': getLogstashDataset('stats') } },
],
},
},
],
},
},
aggs: {
instance_count: {
cardinality: {
field: 'logstash_stats.logstash.uuid',
},
},
},
},
enterprisesearch: {
filter: {
bool: {
must: [
{
exists: {
field: 'enterprisesearch',
},
},
{
bool: {
should: [{ term: { 'metricset.name': 'stats' } }],
},
},
],
},
},
aggs: {
instance_count: {
cardinality: {
field: 'host.name',
},
},
},
},
},
},
},
};
}
Loading