mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Stack Monitoring] Fix shard size alerts (#114357)
* [Stack Monitoring] Fix shard size alerts * Removing the source filter for source_node.* * Removing superfluous types * Removing superfluous nodeId and nodeName from test
This commit is contained in:
parent
5de36a8229
commit
6d24de9d6e
3 changed files with 6 additions and 17 deletions
|
@ -208,9 +208,11 @@ export interface CCRReadExceptionsUIMeta extends CCRReadExceptionsStats {
|
|||
itemLabel: string;
|
||||
}
|
||||
|
||||
export interface IndexShardSizeStats extends AlertNodeStats {
|
||||
export interface IndexShardSizeStats {
|
||||
shardIndex: string;
|
||||
shardSize: number;
|
||||
clusterUuid: string;
|
||||
ccs?: string;
|
||||
}
|
||||
|
||||
export interface IndexShardSizeUIMeta extends IndexShardSizeStats {
|
||||
|
|
|
@ -85,14 +85,10 @@ describe('LargeShardSizeRule', () => {
|
|||
const shardSize = 0;
|
||||
const clusterUuid = 'abc123';
|
||||
const clusterName = 'testCluster';
|
||||
const nodeId = 'myNodeId';
|
||||
const nodeName = 'myNodeName';
|
||||
const stat = {
|
||||
shardIndex,
|
||||
shardSize,
|
||||
clusterUuid,
|
||||
nodeId,
|
||||
nodeName,
|
||||
};
|
||||
|
||||
const replaceState = jest.fn();
|
||||
|
|
|
@ -11,12 +11,8 @@ import { ElasticsearchIndexStats, ElasticsearchResponseHit } from '../../../comm
|
|||
import { ESGlobPatterns, RegExPatterns } from '../../../common/es_glob_patterns';
|
||||
import { Globals } from '../../static_globals';
|
||||
|
||||
interface SourceNode {
|
||||
name: string;
|
||||
uuid: string;
|
||||
}
|
||||
type TopHitType = ElasticsearchResponseHit & {
|
||||
_source: { index_stats?: Partial<ElasticsearchIndexStats>; source_node?: SourceNode };
|
||||
_source: { index_stats?: Partial<ElasticsearchIndexStats> };
|
||||
};
|
||||
|
||||
const memoizedIndexPatterns = (globPatterns: string) => {
|
||||
|
@ -90,8 +86,6 @@ export async function fetchIndexShardSize(
|
|||
'_index',
|
||||
'index_stats.shards.primaries',
|
||||
'index_stats.primaries.store.size_in_bytes',
|
||||
'source_node.name',
|
||||
'source_node.uuid',
|
||||
],
|
||||
},
|
||||
size: 1,
|
||||
|
@ -135,10 +129,10 @@ export async function fetchIndexShardSize(
|
|||
}
|
||||
const {
|
||||
_index: monitoringIndexName,
|
||||
_source: { source_node: sourceNode, index_stats: indexStats },
|
||||
_source: { index_stats: indexStats },
|
||||
} = topHit;
|
||||
|
||||
if (!indexStats || !indexStats.primaries || !sourceNode) {
|
||||
if (!indexStats || !indexStats.primaries) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -151,7 +145,6 @@ export async function fetchIndexShardSize(
|
|||
* We can only calculate the average primary shard size at this point, since we don't have
|
||||
* data (in .monitoring-es* indices) to give us individual shards. This might change in the future
|
||||
*/
|
||||
const { name: nodeName, uuid: nodeId } = sourceNode;
|
||||
const avgShardSize = primaryShardSizeBytes / totalPrimaryShards;
|
||||
if (avgShardSize < thresholdBytes) {
|
||||
continue;
|
||||
|
@ -161,8 +154,6 @@ export async function fetchIndexShardSize(
|
|||
shardIndex,
|
||||
shardSize,
|
||||
clusterUuid,
|
||||
nodeName,
|
||||
nodeId,
|
||||
ccs: monitoringIndexName.includes(':') ? monitoringIndexName.split(':')[0] : undefined,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue