-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Closes #101734. This reverts commit 008421f. Additionally, incorporate suggested changes from #101734 (comment). Co-authored-by: Dario Gieselaar <[email protected]>
- Loading branch information
1 parent
8512657
commit 9ac0a34
Showing
13 changed files
with
225 additions
and
81 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
x-pack/plugins/apm/common/anomaly_detection/apm_ml_anomaly_query.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* 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 { ApmMlDetectorIndex } from './apm_ml_detectors'; | ||
|
||
export function apmMlAnomalyQuery(detectorIndex: ApmMlDetectorIndex) { | ||
return [ | ||
{ | ||
bool: { | ||
filter: [ | ||
{ | ||
terms: { | ||
result_type: ['model_plot', 'record'], | ||
}, | ||
}, | ||
{ | ||
term: { detector_index: detectorIndex }, | ||
}, | ||
], | ||
}, | ||
}, | ||
]; | ||
} |
12 changes: 12 additions & 0 deletions
12
x-pack/plugins/apm/common/anomaly_detection/apm_ml_detectors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export const enum ApmMlDetectorIndex { | ||
txLatency = 0, | ||
txThroughput = 1, | ||
txFailureRate = 2, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletions
18
x-pack/plugins/ml/server/models/data_recognizer/modules/apm_transaction/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
{ | ||
"id": "apm_transaction", | ||
"title": "APM", | ||
"description": "Detect anomalies in transactions from your APM services.", | ||
"description": "Detect anomalies in transaction latency, throughput and failure rate from your APM services for metric data.", | ||
"type": "Transaction data", | ||
"logoFile": "logo.json", | ||
"defaultIndexPattern": "apm-*-transaction", | ||
"defaultIndexPattern": "apm-*-metric,metrics-apm*", | ||
"query": { | ||
"bool": { | ||
"filter": [ | ||
{ "term": { "processor.event": "transaction" } }, | ||
{ "exists": { "field": "transaction.duration" } } | ||
{ "term": { "processor.event": "metric" } }, | ||
{ "term": { "metricset.name": "transaction" } } | ||
] | ||
} | ||
}, | ||
"jobs": [ | ||
{ | ||
"id": "high_mean_transaction_duration", | ||
"file": "high_mean_transaction_duration.json" | ||
"id": "apm_tx_metrics", | ||
"file": "apm_tx_metrics.json" | ||
} | ||
], | ||
"datafeeds": [ | ||
{ | ||
"id": "datafeed-high_mean_transaction_duration", | ||
"file": "datafeed_high_mean_transaction_duration.json", | ||
"job_id": "high_mean_transaction_duration" | ||
"id": "datafeed-apm_tx_metrics", | ||
"file": "datafeed_apm_tx_metrics.json", | ||
"job_id": "apm_tx_metrics" | ||
} | ||
] | ||
} |
53 changes: 53 additions & 0 deletions
53
...k/plugins/ml/server/models/data_recognizer/modules/apm_transaction/ml/apm_tx_metrics.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"job_type": "anomaly_detector", | ||
"groups": [ | ||
"apm" | ||
], | ||
"description": "Detects anomalies in transaction latency, throughput and error percentage for metric data.", | ||
"analysis_config": { | ||
"bucket_span": "15m", | ||
"summary_count_field_name" : "doc_count", | ||
"detectors" : [ | ||
{ | ||
"detector_description" : "high latency by transaction type for an APM service", | ||
"function" : "high_mean", | ||
"field_name" : "transaction_latency", | ||
"by_field_name" : "transaction.type", | ||
"partition_field_name" : "service.name" | ||
}, | ||
{ | ||
"detector_description" : "transaction throughput for an APM service", | ||
"function" : "mean", | ||
"field_name" : "transaction_throughput", | ||
"by_field_name" : "transaction.type", | ||
"partition_field_name" : "service.name" | ||
}, | ||
{ | ||
"detector_description" : "failed transaction rate for an APM service", | ||
"function" : "high_mean", | ||
"field_name" : "failed_transaction_rate", | ||
"by_field_name" : "transaction.type", | ||
"partition_field_name" : "service.name" | ||
} | ||
], | ||
"influencers" : [ | ||
"transaction.type", | ||
"service.name" | ||
] | ||
}, | ||
"analysis_limits": { | ||
"model_memory_limit": "32mb" | ||
}, | ||
"data_description": { | ||
"time_field" : "@timestamp", | ||
"time_format" : "epoch_ms" | ||
}, | ||
"model_plot_config": { | ||
"enabled" : true, | ||
"annotations_enabled" : true | ||
}, | ||
"results_index_name" : "custom-apm", | ||
"custom_settings": { | ||
"created_by": "ml-module-apm-transaction" | ||
} | ||
} |
98 changes: 98 additions & 0 deletions
98
.../ml/server/models/data_recognizer/modules/apm_transaction/ml/datafeed_apm_tx_metrics.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
{ | ||
"job_id": "JOB_ID", | ||
"indices": [ | ||
"INDEX_PATTERN_NAME" | ||
], | ||
"chunking_config" : { | ||
"mode" : "off" | ||
}, | ||
"query": { | ||
"bool": { | ||
"filter": [ | ||
{ "term": { "processor.event": "metric" } }, | ||
{ "term": { "metricset.name": "transaction" } } | ||
] | ||
} | ||
}, | ||
"aggregations" : { | ||
"buckets" : { | ||
"composite" : { | ||
"size" : 5000, | ||
"sources" : [ | ||
{ | ||
"date" : { | ||
"date_histogram" : { | ||
"field" : "@timestamp", | ||
"fixed_interval" : "90s" | ||
} | ||
} | ||
}, | ||
{ | ||
"transaction.type" : { | ||
"terms" : { | ||
"field" : "transaction.type" | ||
} | ||
} | ||
}, | ||
{ | ||
"service.name" : { | ||
"terms" : { | ||
"field" : "service.name" | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"aggs" : { | ||
"@timestamp" : { | ||
"max" : { | ||
"field" : "@timestamp" | ||
} | ||
}, | ||
"transaction_throughput" : { | ||
"rate" : { | ||
"unit" : "minute" | ||
} | ||
}, | ||
"transaction_latency" : { | ||
"avg" : { | ||
"field" : "transaction.duration.histogram" | ||
} | ||
}, | ||
"error_count" : { | ||
"filter" : { | ||
"term" : { | ||
"event.outcome" : "failure" | ||
} | ||
}, | ||
"aggs" : { | ||
"actual_error_count" : { | ||
"value_count" : { | ||
"field" : "event.outcome" | ||
} | ||
} | ||
} | ||
}, | ||
"success_count" : { | ||
"filter" : { | ||
"term" : { | ||
"event.outcome" : "success" | ||
} | ||
} | ||
}, | ||
"failed_transaction_rate" : { | ||
"bucket_script" : { | ||
"buckets_path" : { | ||
"failure_count" : "error_count>_count", | ||
"success_count" : "success_count>_count" | ||
}, | ||
"script" : "if ((params.failure_count + params.success_count)==0){return 0;}else{return 100 * (params.failure_count/(params.failure_count + params.success_count));}" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"indices_options": { | ||
"ignore_unavailable": true | ||
} | ||
} |
17 changes: 0 additions & 17 deletions
17
...s/data_recognizer/modules/apm_transaction/ml/datafeed_high_mean_transaction_duration.json
This file was deleted.
Oops, something went wrong.
35 changes: 0 additions & 35 deletions
35
...ver/models/data_recognizer/modules/apm_transaction/ml/high_mean_transaction_duration.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.