-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] Updates APM Module to Work with Service Maps #70361
Changes from 3 commits
8df17b2
dc38f88
96b1b35
4a49cc5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
{ | ||
"id": "apm_transaction", | ||
"title": "APM", | ||
"description": "Detect anomalies in high mean of transaction duration (ECS).", | ||
"description": "Detect anomalies in transactions from your APM services.", | ||
"type": "Transaction data", | ||
"logoFile": "logo.json", | ||
"defaultIndexPattern": "apm-*", | ||
"defaultIndexPattern": "apm-*-transaction", | ||
"query": { | ||
"bool": { | ||
"filter": [ | ||
{ "term": { "processor.event": "transaction" } }, | ||
{ "term": { "transaction.type": "request" } } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was the previous job tied to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That change happened in #30820 - does that mean ML did not work for other transaction types for the past 1.5 years? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, if the jobs were created via the ML job creation process, then the datafeed filtered for |
||
{ "exists": { "field": "transaction.duration" } } | ||
] | ||
} | ||
}, | ||
"jobs": [ | ||
{ | ||
"id": "high_mean_response_time", | ||
"file": "high_mean_response_time.json" | ||
"id": "high_mean_transaction_duration", | ||
"file": "high_mean_transaction_duration.json" | ||
} | ||
], | ||
"datafeeds": [ | ||
{ | ||
"id": "datafeed-high_mean_response_time", | ||
"file": "datafeed_high_mean_response_time.json", | ||
"job_id": "high_mean_response_time" | ||
"id": "datafeed-high_mean_transaction_duration", | ||
"file": "datafeed_high_mean_transaction_duration.json", | ||
"job_id": "high_mean_transaction_duration" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
"bool": { | ||
"filter": [ | ||
{ "term": { "processor.event": "transaction" } }, | ||
{ "term": { "transaction.type": "request" } } | ||
{ "exists": { "field": "transaction.duration.us" } } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given the following request to create a new ML job: POST /api/ml/modules/setup/apm_transaction
{
// tagging the job with service.environment
"custom_settings": {
"service.environment": "production"
},
// tagging the job with app name
"groups": ["apm"],
// specifying the indicies to query
"indexPatternName": "apm-*-transaction-*",
// create job and start immediately
"startDatafeed": true,
// limit job to specific environment
"query": {
"bool": {
"filter": [{ "term": { "service.environment": "production" } }]
}
}
} Will the "query": {
"bool": {
"filter": [
{ "term": { "processor.event": "transaction" } },
{ "exists": { "field": "transaction.duration.us" } }
{ "term": { "service.environment": "production" } }]
}
} ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Btw. overall does the request look correct? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the here’s a suggestion for the setup request. POST /api/ml/modules/setup/apm_transaction
{
// tagging the job with service.environment
"jobOverrides": {
"custom_settings": {
"job_tags": {
"service.environment": "production"
}
}
},
// specifying the indicies to query
"indexPatternName": "apm-*-transaction-*",
// create job and start immediately
"startDatafeed": true,
// limit job to specific environment
"query": {
"bool": {
"filter": [
{ "term": { "processor.event": "transaction" } },
{ "exists": { "field": "transaction.duration.us" } }
{ "term": { "service.environment": "production" } }]
}
}
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks @jgowdyelastic ! Is POST /api/ml/modules/setup/apm_transaction
{
"custom_settings": {
"job_tags": {
"service.environment": "production"
}
}
//...
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, with it you can override any part of the job. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, so do we then also need it for the other attributes like {
"jobOverrides": {
"query": {
"bool": {
"filter": [
{ "term": { "processor.event": "transaction" } },
{ "exists": { "field": "transaction.duration.us" } },
{ "term": { "service.environment": "production" } }
]
}
}
}
}
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, only for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay - that sounds a bit inconsistent to me. Is the intention to align this? Is it documented somewhere which fields need to be wrapped in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
] | ||
} | ||
} | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"job_type": "anomaly_detector", | ||
"groups": [ | ||
"apm" | ||
], | ||
"description": "Detect transaction duration anomalies across transaction types for your APM services.", | ||
"analysis_config": { | ||
"bucket_span": "15m", | ||
"detectors": [ | ||
{ | ||
"detector_description": "high duration by transaction type for an APM service", | ||
"function": "high_mean", | ||
"field_name": "transaction.duration.us", | ||
"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" | ||
}, | ||
"model_plot_config": { | ||
"enabled": true | ||
}, | ||
"custom_settings": { | ||
"created_by": "ml-module-apm-transaction" | ||
} | ||
} |
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.
Just checking that this only has the
*
wildcard in the middle of the pattern, and not at the end too, as we haveapm-*-transaction-*
in the example provided to the setup endpoint.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.
there are two index patterns in the test data provided by @dgieselaar :
apm-*
andapm-*-transaction
. I went with the latter since the moduleapm_transaction
focuses only on transaction data. @dgieselaar willapm-*-transaction
reliably exist? If not, @peteharverson are there any potential consequences of having a nonexistent index pattern here?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.
@blaklaybul it's configurable, so no guarantees (for both
apm-*
andapm-*-transaction
). I'm assuming we set this when we create the job (have to check but can't find the code right now).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.
@blaklaybul the
defaultIndexPattern
supplied in the modulemanifest.json
is just used as a fallback by our module endpoints if noindexPatternName
is supplied to the endpoint. So for the common use case, where the index pattern is supplied to thesetup
endpoint to create the jobs, this value from the manifest won't be used.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.
thanks @peteharverson