elastic / elastic/elastic-package

Missing `caused_by` when logging pipeline failures

Open
#2,845 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
72
Forks
141
Avg merge
19h 42m
Merged PRs (30d)
55

Description

The error message emitted by `elastic-package test pipeline` does not include the `caused_by` context of the error. This information is necessary to identify problem with invalid Painless scripts. As a developer, I have to pivot over to using the API directly to observe the problem with a failing script. For example, if I use the dev console, then I see this full error which tells me the method wasn't found

https://github.com/elastic/elastic-package/blob/8b801ac98fefdde3a581d532253a5809f5a47763/internal/elasticsearch/error.go#L70

```json
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "compile error",
"processor_type": "script",
"script_stack": [
"... fo;\nString[] lines = text.split(/ /);",
" ^---- HERE"
],
"script": "String text = ctx.winlog.event_data.ContextInfo;\nString[] lines = text.split(/ /);",
"lang": "painless",
"position": {
"offset": 70,
"start": 45,
"end": 82
}
}
],
"type": "script_exception",
"reason": "compile error",
"processor_type": "script",
"script_stack": [
"... fo;\nString[] lines = text.split(/ /);",
" ^---- HERE"
],
"script": "String text = ctx.winlog.event_data.ContextInfo;\nString[] lines = text.split(/ /);",
"lang": "painless",
"position": {
"offset": 70,
"start": 45,
"end": 82
},
"caused_by": {
"type": "illegal_argument_exception",
"reason": "member method [java.lang.String, split/1] not found"
}
},
"status": 400
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in internal/elasticsearch/error.go around line 70 and reproduce the failure with elastic-package test pipeline, using the example invalid Painless script as a reference. Verify that the command's emitted error includes the caused_by context and the underlying method-not-found reason.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.