-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[APM] Reinstate ML multi-metric job #117836
Merged
dgieselaar
merged 9 commits into
elastic:main
from
dgieselaar:reinstate-multi-metric-job
Nov 11, 2021
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c4cd29f
Revert "[APM] Revert multi-metric ML job. (#114961)"
dgieselaar cff5142
Skip frozen tier
dgieselaar 96bb515
Merge branch 'main' of github.com:elastic/kibana into reinstate-multi…
dgieselaar fb1aaa4
Merge branch 'main' of github.com:elastic/kibana into reinstate-multi…
dgieselaar bb08ee1
Merge branch 'main' of github.com:elastic/kibana into reinstate-multi…
dgieselaar 09a59fa
Review feedback
dgieselaar 982b019
Merge branch 'main' of github.com:elastic/kibana into reinstate-multi…
dgieselaar 02e568b
Review feedback
dgieselaar 072d458
Merge branch 'main' into reinstate-multi-metric-job
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The manifest query will need to be
but as discussed, feel free to leave the
_tier
part out of the changes in this PR and I can include them when editing all the other ML modules as part of #116696.