[Usage Collection] [schema] alerts (#78933)

This commit is contained in:
Alejandro Fernández Haro 2020-10-02 17:45:47 +01:00 committed by GitHub
parent d679624532
commit 7afb8b4d7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 248 additions and 2 deletions

View file

@ -2,7 +2,6 @@
"output": "plugins/telemetry_collection_xpack/schema/xpack_plugins.json",
"root": "plugins/",
"exclude": [
"plugins/alerts/server/usage/alerts_usage_collector.ts",
"plugins/apm/server/lib/apm_telemetry/index.ts"
]
}

View file

@ -4,11 +4,44 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { MakeSchemaFrom, UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { get } from 'lodash';
import { TaskManagerStartContract } from '../../../task_manager/server';
import { AlertsUsage } from './types';
const byTypeSchema: MakeSchemaFrom<AlertsUsage>['count_by_type'] = {
// TODO: Find out an automated way to populate the keys or reformat these into an array (and change the Remote Telemetry indexer accordingly)
DYNAMIC_KEY: { type: 'long' },
// Known alerts (searching the use of the alerts API `registerType`:
// Built-in
'__index-threshold': { type: 'long' },
// APM
apm__error_rate: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
apm__transaction_error_rate: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
apm__transaction_duration: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
apm__transaction_duration_anomaly: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
// Infra
metrics__alert__threshold: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
metrics__alert__inventory__threshold: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
logs__alert__document__count: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
// Monitoring
monitoring_alert_cluster_health: { type: 'long' },
monitoring_alert_cpu_usage: { type: 'long' },
monitoring_alert_disk_usage: { type: 'long' },
monitoring_alert_elasticsearch_version_mismatch: { type: 'long' },
monitoring_alert_kibana_version_mismatch: { type: 'long' },
monitoring_alert_license_expiration: { type: 'long' },
monitoring_alert_logstash_version_mismatch: { type: 'long' },
monitoring_alert_nodes_changed: { type: 'long' },
// Security Solution
siem__signals: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
siem__notifications: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
// Uptime
xpack__uptime__alerts__monitorStatus: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
xpack__uptime__alerts__tls: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
xpack__uptime__alerts__durationAnomaly: { type: 'long' }, // eslint-disable-line @typescript-eslint/naming-convention
};
export function createAlertsUsageCollector(
usageCollection: UsageCollectionSetup,
taskManager: TaskManagerStartContract
@ -50,6 +83,28 @@ export function createAlertsUsageCollector(
};
}
},
schema: {
count_total: { type: 'long' },
count_active_total: { type: 'long' },
count_disabled_total: { type: 'long' },
throttle_time: {
min: { type: 'long' },
avg: { type: 'float' },
max: { type: 'long' },
},
schedule_time: {
min: { type: 'long' },
avg: { type: 'float' },
max: { type: 'long' },
},
connectors_per_alert: {
min: { type: 'long' },
avg: { type: 'float' },
max: { type: 'long' },
},
count_active_by_type: byTypeSchema,
count_by_type: byTypeSchema,
},
});
}

View file

@ -78,6 +78,198 @@
}
}
},
"alerts": {
"properties": {
"count_total": {
"type": "long"
},
"count_active_total": {
"type": "long"
},
"count_disabled_total": {
"type": "long"
},
"throttle_time": {
"properties": {
"min": {
"type": "long"
},
"avg": {
"type": "float"
},
"max": {
"type": "long"
}
}
},
"schedule_time": {
"properties": {
"min": {
"type": "long"
},
"avg": {
"type": "float"
},
"max": {
"type": "long"
}
}
},
"connectors_per_alert": {
"properties": {
"min": {
"type": "long"
},
"avg": {
"type": "float"
},
"max": {
"type": "long"
}
}
},
"count_active_by_type": {
"properties": {
"DYNAMIC_KEY": {
"type": "long"
},
"__index-threshold": {
"type": "long"
},
"apm__error_rate": {
"type": "long"
},
"apm__transaction_error_rate": {
"type": "long"
},
"apm__transaction_duration": {
"type": "long"
},
"apm__transaction_duration_anomaly": {
"type": "long"
},
"metrics__alert__threshold": {
"type": "long"
},
"metrics__alert__inventory__threshold": {
"type": "long"
},
"logs__alert__document__count": {
"type": "long"
},
"monitoring_alert_cluster_health": {
"type": "long"
},
"monitoring_alert_cpu_usage": {
"type": "long"
},
"monitoring_alert_disk_usage": {
"type": "long"
},
"monitoring_alert_elasticsearch_version_mismatch": {
"type": "long"
},
"monitoring_alert_kibana_version_mismatch": {
"type": "long"
},
"monitoring_alert_license_expiration": {
"type": "long"
},
"monitoring_alert_logstash_version_mismatch": {
"type": "long"
},
"monitoring_alert_nodes_changed": {
"type": "long"
},
"siem__signals": {
"type": "long"
},
"siem__notifications": {
"type": "long"
},
"xpack__uptime__alerts__monitorStatus": {
"type": "long"
},
"xpack__uptime__alerts__tls": {
"type": "long"
},
"xpack__uptime__alerts__durationAnomaly": {
"type": "long"
}
}
},
"count_by_type": {
"properties": {
"DYNAMIC_KEY": {
"type": "long"
},
"__index-threshold": {
"type": "long"
},
"apm__error_rate": {
"type": "long"
},
"apm__transaction_error_rate": {
"type": "long"
},
"apm__transaction_duration": {
"type": "long"
},
"apm__transaction_duration_anomaly": {
"type": "long"
},
"metrics__alert__threshold": {
"type": "long"
},
"metrics__alert__inventory__threshold": {
"type": "long"
},
"logs__alert__document__count": {
"type": "long"
},
"monitoring_alert_cluster_health": {
"type": "long"
},
"monitoring_alert_cpu_usage": {
"type": "long"
},
"monitoring_alert_disk_usage": {
"type": "long"
},
"monitoring_alert_elasticsearch_version_mismatch": {
"type": "long"
},
"monitoring_alert_kibana_version_mismatch": {
"type": "long"
},
"monitoring_alert_license_expiration": {
"type": "long"
},
"monitoring_alert_logstash_version_mismatch": {
"type": "long"
},
"monitoring_alert_nodes_changed": {
"type": "long"
},
"siem__signals": {
"type": "long"
},
"siem__notifications": {
"type": "long"
},
"xpack__uptime__alerts__monitorStatus": {
"type": "long"
},
"xpack__uptime__alerts__tls": {
"type": "long"
},
"xpack__uptime__alerts__durationAnomaly": {
"type": "long"
}
}
}
}
},
"canvas": {
"properties": {
"workpads": {