mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 02:14:54 +00:00
[ML] Add explanation so far to file structure finder exceptions (#38191)
The explanation so far can be invaluable for troubleshooting as incorrect decisions made early on in the structure analysis can result in seemingly crazy decisions or timeouts later on. Relates elastic/kibana#29821
This commit is contained in:
parent
e49b593c81
commit
fb6a176caf
@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.filestructurefinder;
|
||||
|
||||
import com.ibm.icu.text.CharsetDetector;
|
||||
import com.ibm.icu.text.CharsetMatch;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.ElasticsearchTimeoutException;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
@ -148,6 +149,14 @@ public final class FileStructureFinderManager {
|
||||
Math.max(MIN_SAMPLE_LINE_COUNT, idealSampleLineCount), timeoutChecker);
|
||||
|
||||
return makeBestStructureFinder(explanation, sampleInfo.v1(), charsetName, sampleInfo.v2(), overrides, timeoutChecker);
|
||||
} catch (Exception e) {
|
||||
// Add a dummy exception containing the explanation so far - this can be invaluable for troubleshooting as incorrect
|
||||
// decisions made early on in the structure analysis can result in seemingly crazy decisions or timeouts later on
|
||||
if (explanation.isEmpty() == false) {
|
||||
e.addSuppressed(
|
||||
new ElasticsearchException(explanation.stream().collect(Collectors.joining("]\n[", "Explanation so far:\n[", "]\n"))));
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user