mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
* [Monitoring/Metrics] clean up metric classes and getMetricFields static helpers * more pull out * more to break out * snapshot update
This commit is contained in:
parent
255085f37d
commit
bdf1f3c973
13 changed files with 46 additions and 48 deletions
|
@ -71,7 +71,7 @@ export async function getBeatSummary(req, beatsIndexPattern, { clusterUuid, beat
|
|||
query: createBeatsQuery({
|
||||
start,
|
||||
end,
|
||||
uuid: clusterUuid,
|
||||
clusterUuid,
|
||||
filters
|
||||
}),
|
||||
collapse: {
|
||||
|
|
|
@ -114,7 +114,7 @@ export async function getBeats(req, beatsIndexPattern, clusterUuid) {
|
|||
query: createBeatsQuery({
|
||||
start,
|
||||
end,
|
||||
uuid: clusterUuid
|
||||
clusterUuid
|
||||
}),
|
||||
collapse: {
|
||||
field: 'beats_stats.metrics.beat.info.ephemeral_id', // collapse on ephemeral_id to handle restarts
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
*/
|
||||
|
||||
import { checkParam } from '../error_missing_required';
|
||||
import { createBeatsQuery } from './create_beats_query.js';
|
||||
import { BeatsClusterMetric } from '../metrics';
|
||||
import { createBeatsQuery } from './create_beats_query';
|
||||
import {
|
||||
beatsAggFilterPath,
|
||||
beatsUuidsAgg,
|
||||
|
@ -50,7 +51,8 @@ export function getBeatsForClusters(req, beatsIndexPattern, clusters) {
|
|||
query: createBeatsQuery({
|
||||
start,
|
||||
end,
|
||||
uuid: clusterUuid,
|
||||
clusterUuid,
|
||||
metric: BeatsClusterMetric.getMetricFields() // override default of BeatMetric.getMetricFields
|
||||
}),
|
||||
aggs: beatsUuidsAgg(maxBucketSize)
|
||||
}
|
||||
|
@ -58,6 +60,6 @@ export function getBeatsForClusters(req, beatsIndexPattern, clusters) {
|
|||
|
||||
const { callWithRequest } = req.server.plugins.elasticsearch.getCluster('monitoring');
|
||||
const response = await callWithRequest(req, 'search', params);
|
||||
return handleResponse(clusterUuid, response, start, end);
|
||||
return handleResponse(clusterUuid, response);
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ export function getLatestStats(req, beatsIndexPattern, clusterUuid) {
|
|||
filterPath: 'aggregations',
|
||||
body: {
|
||||
query: createBeatsQuery({
|
||||
uuid: clusterUuid,
|
||||
clusterUuid,
|
||||
filters: [ lastDayFilter ],
|
||||
}),
|
||||
aggs: {
|
||||
|
|
|
@ -43,7 +43,7 @@ export async function getStats(req, beatsIndexPattern, clusterUuid) {
|
|||
query: createBeatsQuery({
|
||||
start,
|
||||
end,
|
||||
uuid: clusterUuid,
|
||||
clusterUuid,
|
||||
}),
|
||||
aggs: beatsUuidsAgg(maxBucketSize)
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import _ from 'lodash';
|
||||
import { checkParam } from '../error_missing_required';
|
||||
import { createQuery } from '../create_query.js';
|
||||
import { createQuery } from '../create_query';
|
||||
import { ElasticsearchMetric } from '../metrics';
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import Promise from 'bluebird';
|
||||
import { contains, get } from 'lodash';
|
||||
import { checkParam } from '../error_missing_required';
|
||||
import { createQuery } from '../create_query.js';
|
||||
import { createQuery } from '../create_query';
|
||||
import { ElasticsearchMetric } from '../metrics';
|
||||
import { ML_SUPPORTED_LICENSES } from '../../../common/constants';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { get } from 'lodash';
|
||||
import { checkParam } from '../../error_missing_required';
|
||||
import { createQuery } from '../../create_query.js';
|
||||
import { createQuery } from '../../create_query';
|
||||
import { ElasticsearchMetric } from '../../metrics';
|
||||
|
||||
export function handleResponse(shardStats, indexUuid) {
|
||||
|
|
|
@ -6,9 +6,8 @@
|
|||
|
||||
import { get } from 'lodash';
|
||||
import { checkParam } from '../../error_missing_required';
|
||||
import { createQuery } from '../../create_query.js';
|
||||
import { createQuery } from '../../create_query';
|
||||
import { ElasticsearchMetric } from '../../metrics';
|
||||
|
||||
import { getDefaultNodeFromId } from './get_default_node_from_id';
|
||||
import { calculateNodeType } from './calculate_node_type';
|
||||
import { getNodeTypeClassLabel } from './get_node_type_class_label';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import moment from 'moment';
|
||||
import { checkParam } from '../../../error_missing_required';
|
||||
import { createQuery } from '../../../create_query.js';
|
||||
import { createQuery } from '../../../create_query';
|
||||
import { calculateAuto } from '../../../calculate_auto';
|
||||
import { ElasticsearchMetric } from '../../../metrics';
|
||||
import { getMetricAggs } from './get_metric_aggs';
|
||||
|
|
|
@ -13,7 +13,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "Throughput",
|
||||
"units": "/s",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_cluster_output_events_ack_rate": Object {
|
||||
"aggs": Object {
|
||||
|
@ -519,7 +519,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "CPU Utilization",
|
||||
"units": "%",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_mem_alloc": Object {
|
||||
"app": "beats",
|
||||
|
@ -532,7 +532,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "Memory",
|
||||
"units": "B",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_mem_gc_next": Object {
|
||||
"app": "beats",
|
||||
|
@ -545,7 +545,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "Memory",
|
||||
"units": "B",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_mem_rss": Object {
|
||||
"app": "beats",
|
||||
|
@ -558,7 +558,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "Memory",
|
||||
"units": "B",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_output_events_ack_rate": Object {
|
||||
"app": "beats",
|
||||
|
@ -571,7 +571,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "Events Rate",
|
||||
"units": "/s",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_output_events_dropped_rate": Object {
|
||||
"app": "beats",
|
||||
|
@ -584,7 +584,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "Fail Rates",
|
||||
"units": "/s",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_output_events_total": Object {
|
||||
"app": "beats",
|
||||
|
@ -597,7 +597,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "Events Rate",
|
||||
"units": "/s",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_output_receiving_errors": Object {
|
||||
"app": "beats",
|
||||
|
@ -610,7 +610,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "Output Errors",
|
||||
"units": "/s",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_output_sending_errors": Object {
|
||||
"app": "beats",
|
||||
|
@ -623,7 +623,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "Output Errors",
|
||||
"units": "/s",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_output_write_bytes_rate": Object {
|
||||
"app": "beats",
|
||||
|
@ -636,7 +636,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "Throughput",
|
||||
"units": "/s",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_pipeline_events_dropped_rate": Object {
|
||||
"app": "beats",
|
||||
|
@ -649,7 +649,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "Fail Rates",
|
||||
"units": "/s",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_pipeline_events_emitted_rate": Object {
|
||||
"app": "beats",
|
||||
|
@ -662,7 +662,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "Events Rate",
|
||||
"units": "/s",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_pipeline_events_failed_rate": Object {
|
||||
"app": "beats",
|
||||
|
@ -675,7 +675,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "Fail Rates",
|
||||
"units": "/s",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_pipeline_events_retry_rate": Object {
|
||||
"app": "beats",
|
||||
|
@ -688,7 +688,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "Fail Rates",
|
||||
"units": "/s",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_pipeline_events_total_rate": Object {
|
||||
"app": "beats",
|
||||
|
@ -701,7 +701,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "Events Rate",
|
||||
"units": "/s",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_system_os_load_1": Object {
|
||||
"app": "beats",
|
||||
|
@ -714,7 +714,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "System Load",
|
||||
"units": "",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_system_os_load_15": Object {
|
||||
"app": "beats",
|
||||
|
@ -727,7 +727,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "System Load",
|
||||
"units": "",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"beat_system_os_load_5": Object {
|
||||
"app": "beats",
|
||||
|
@ -740,7 +740,7 @@ Object {
|
|||
"timestampField": "beats_stats.timestamp",
|
||||
"title": "System Load",
|
||||
"units": "",
|
||||
"uuidField": "cluster_uuid",
|
||||
"uuidField": "beats_stats.beat.uuid",
|
||||
},
|
||||
"cluster_index_latency": Object {
|
||||
"aggs": Object {
|
||||
|
@ -1719,6 +1719,7 @@ Object {
|
|||
"metricAgg": "max",
|
||||
"timestampField": "logstash_stats.timestamp",
|
||||
"units": "/s",
|
||||
"uuidField": "cluster_uuid",
|
||||
},
|
||||
"logstash_cluster_events_latency": Object {
|
||||
"aggs": Object {
|
||||
|
@ -1777,6 +1778,7 @@ Object {
|
|||
"metricAgg": "max",
|
||||
"timestampField": "logstash_stats.timestamp",
|
||||
"units": "ms",
|
||||
"uuidField": "cluster_uuid",
|
||||
},
|
||||
"logstash_cluster_events_output_rate": Object {
|
||||
"aggs": Object {
|
||||
|
@ -1816,6 +1818,7 @@ Object {
|
|||
"metricAgg": "max",
|
||||
"timestampField": "logstash_stats.timestamp",
|
||||
"units": "/s",
|
||||
"uuidField": "cluster_uuid",
|
||||
},
|
||||
"logstash_cluster_pipeline_nodes_count": Object {
|
||||
"app": "logstash",
|
||||
|
|
|
@ -71,14 +71,12 @@ export class ElasticsearchMetric extends Metric {
|
|||
super({
|
||||
...opts,
|
||||
app: 'elasticsearch',
|
||||
uuidField: 'source_node.uuid',
|
||||
timestampField: 'timestamp'
|
||||
...ElasticsearchMetric.getMetricFields()
|
||||
});
|
||||
|
||||
this.checkRequiredParams({ type: opts.type });
|
||||
}
|
||||
|
||||
// helper method
|
||||
static getMetricFields() {
|
||||
return {
|
||||
uuidField: 'source_node.uuid',
|
||||
|
@ -92,9 +90,7 @@ export class KibanaEventsRateClusterMetric extends Metric {
|
|||
super({
|
||||
...opts,
|
||||
app: 'kibana',
|
||||
uuidField: 'cluster_uuid',
|
||||
timestampField: 'kibana_stats.timestamp',
|
||||
metricAgg: 'max'
|
||||
...KibanaEventsRateClusterMetric.getMetricFields(),
|
||||
});
|
||||
|
||||
this.aggs = {
|
||||
|
@ -127,9 +123,9 @@ export class KibanaEventsRateClusterMetric extends Metric {
|
|||
};
|
||||
}
|
||||
|
||||
// helper method
|
||||
static getMetricFields() {
|
||||
return {
|
||||
metricAgg: 'max',
|
||||
uuidField: 'cluster_uuid',
|
||||
timestampField: 'kibana_stats.timestamp'
|
||||
};
|
||||
|
@ -495,13 +491,13 @@ export class LogstashClusterMetric extends Metric {
|
|||
super({
|
||||
...opts,
|
||||
app: 'logstash',
|
||||
timestampField: 'logstash_stats.timestamp'
|
||||
...LogstashClusterMetric.getMetricFields()
|
||||
});
|
||||
}
|
||||
|
||||
// helper method
|
||||
static getMetricFields() {
|
||||
return {
|
||||
uuidField: 'cluster_uuid',
|
||||
timestampField: 'logstash_stats.timestamp'
|
||||
};
|
||||
}
|
||||
|
@ -840,14 +836,13 @@ export class BeatsClusterMetric extends Metric {
|
|||
super({
|
||||
...opts,
|
||||
app: 'beats',
|
||||
timestampField: 'beats_stats.timestamp',
|
||||
uuidField: 'cluster_uuid'
|
||||
...BeatsClusterMetric.getMetricFields()
|
||||
});
|
||||
}
|
||||
|
||||
// helper method
|
||||
static getMetricFields() {
|
||||
return {
|
||||
uuidField: 'cluster_uuid',
|
||||
timestampField: 'beats_stats.timestamp'
|
||||
};
|
||||
}
|
||||
|
@ -908,15 +903,13 @@ export class BeatsMetric extends Metric {
|
|||
super({
|
||||
...opts,
|
||||
app: 'beats',
|
||||
uuidField: 'cluster_uuid',
|
||||
timestampField: 'beats_stats.timestamp'
|
||||
...BeatsMetric.getMetricFields()
|
||||
});
|
||||
}
|
||||
|
||||
// helper method
|
||||
static getMetricFields() {
|
||||
return {
|
||||
uuidField: 'cluster_uuid',
|
||||
uuidField: 'beats_stats.beat.uuid',
|
||||
timestampField: 'beats_stats.timestamp'
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ export {
|
|||
ElasticsearchMetric,
|
||||
LogstashClusterMetric,
|
||||
BeatsMetric,
|
||||
BeatsClusterMetric,
|
||||
} from './classes';
|
||||
export { metrics } from './metrics';
|
||||
export { serializeMetric } from './serialize_metric';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue