Skip to content

Commit

Permalink
mod: update elastic/mito to version v1.15.0
Browse files Browse the repository at this point in the history
This brings error-handling improvements.

* better error localisation in error snippets
* fixed handling of errors containing Go fmt verb syntax
  • Loading branch information
efd6 committed Jul 19, 2024
1 parent 942f8c7 commit e38263c
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 22 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ https:/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
*Heartbeat*


*Heartbeat*


*Metricbeat*

Expand Down Expand Up @@ -302,14 +300,15 @@ https:/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Allow elision of set and append failure logging. {issue}34544[34544] {pull}39929[39929]
- Add ability to remove request trace logs from CEL input. {pull}39969[39969]
- Add ability to remove request trace logs from HTTPJSON input. {pull}40003[40003]
- Update CEL mito extensions to v1.13.0 {pull}40035[40035]
- Update CEL mito extensions to v1.13.0. {pull}40035[40035]
- Add Jamf entity analytics provider. {pull}39996[39996]
- Add ability to remove request trace logs from http_endpoint input. {pull}40005[40005]
- Add ability to remove request trace logs from entityanalytics input. {pull}40004[40004]
- Relax constraint on Base DN in entity analytics Active Directory provider. {pull}40054[40054]
- Implement Elastic Agent status and health reporting for Netflow Filebeat input. {pull}40080[40080]
- Enhance input state reporting for CEL evaluations that return a single error object in events. {pull}40083[40083]
- Allow absent credentials when using GCS with Application Default Credentials. {issue}39977[39977] {pull}40072[40072]
- Update CEL mito extensions to v1.15.0. {pull}40294[40294]

*Auditbeat*

Expand Down
4 changes: 2 additions & 2 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15785,11 +15785,11 @@ limitations under the License.

--------------------------------------------------------------------------------
Dependency : github.com/elastic/mito
Version: v1.13.0
Version: v1.15.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/mito@v1.13.0/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/elastic/mito@v1.15.0/LICENSE:


Apache License
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ require (
github.com/elastic/elastic-agent-system-metrics v0.10.3
github.com/elastic/go-elasticsearch/v8 v8.14.0
github.com/elastic/go-sfdc v0.0.0-20240621062639-bcc8456508ff
github.com/elastic/mito v1.13.0
github.com/elastic/mito v1.15.0
github.com/elastic/tk-btf v0.1.0
github.com/elastic/toutoumomoma v0.0.0-20221026030040-594ef30cb640
github.com/foxcpp/go-mockdns v0.0.0-20201212160233-ede2f9158d15
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,8 @@ github.com/elastic/gopacket v1.1.20-0.20211202005954-d412fca7f83a h1:8WfL/X6fK11
github.com/elastic/gopacket v1.1.20-0.20211202005954-d412fca7f83a/go.mod h1:riddUzxTSBpJXk3qBHtYr4qOhFhT6k/1c0E3qkQjQpA=
github.com/elastic/gosigar v0.14.3 h1:xwkKwPia+hSfg9GqrCUKYdId102m9qTJIIr7egmK/uo=
github.com/elastic/gosigar v0.14.3/go.mod h1:iXRIGg2tLnu7LBdpqzyQfGDEidKCfWcCMS0WKyPWoMs=
github.com/elastic/mito v1.13.0 h1:8S75e9UQ/r4S2Ch/oxgrFxquvPsFifoQgHEnI2VzZTE=
github.com/elastic/mito v1.13.0/go.mod h1:J+wCf4HccW2YoSFmZMGu+d06gN+WmnIlj5ehBqine74=
github.com/elastic/mito v1.15.0 h1:MicOxLSVkgU2Aonbh3i+++66Wl5wvD8y9gALK8PQDYs=
github.com/elastic/mito v1.15.0/go.mod h1:J+wCf4HccW2YoSFmZMGu+d06gN+WmnIlj5ehBqine74=
github.com/elastic/pkcs8 v1.0.0 h1:HhitlUKxhN288kcNcYkjW6/ouvuwJWd9ioxpjnD9jVA=
github.com/elastic/pkcs8 v1.0.0/go.mod h1:ipsZToJfq1MxclVTwpG7U/bgeDtf+0HkUiOxebk95+0=
github.com/elastic/ristretto v0.1.1-0.20220602190459-83b0895ca5b3 h1:ChPwRVv1RR4a0cxoGjKcyWjTEpxYfm5gydMIzo32cAw=
Expand Down
2 changes: 1 addition & 1 deletion x-pack/filebeat/docs/inputs/input-cel.asciidoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[role="xpack"]

:type: cel
:mito_version: v1.13.0
:mito_version: v1.15.0
:mito_docs: https://pkg.go.dev/github.com/elastic/mito@{mito_version}

[id="{beatname_lc}-input-{type}"]
Expand Down
38 changes: 29 additions & 9 deletions x-pack/filebeat/input/cel/input_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1550,14 +1550,32 @@ var inputTests = []struct {

// Programmer error.
{
name: "type_error_message",
name: "type_error_message_compile_time",
server: newChainTestServer(httptest.NewServer),
config: map[string]interface{}{
"interval": 1,
"program": `
bytes(get(state.url).Body).decode_json().records.map(r,
bytes(get(state.url+'/'+r.id).Body).decode_json()).as(events, {
// ^~~~ r.id not converted to string: can't add integer to string.
get(state.url).Body.decode_json().records.map(r,
get(state.url+'/'+int(r.id)).Body.decode_json()).as(events, {
// ^~~~ r.id converted to incorrect type.
"events": events,
})
`,
},
handler: defaultHandler(http.MethodGet, ""),
wantErr: fmt.Errorf(`failed to check program: failed compilation: ERROR: <input>:3:20: found no matching overload for '_+_' applied to '(string, int)'
| get(state.url+'/'+int(r.id)).Body.decode_json()).as(events, {
| ...................^ accessing config`),
},
{
name: "type_error_message_run_time",
server: newChainTestServer(httptest.NewServer),
config: map[string]interface{}{
"interval": 1,
"program": `
get(state.url).Body.decode_json().records.map(r,
get(state.url+'/'+r.id).Body.decode_json()).as(events, {
// ^~~~ r.id not converted to string: can't add integer to string.
"events": events,
})
`,
Expand All @@ -1566,10 +1584,9 @@ var inputTests = []struct {
want: []map[string]interface{}{
{
"error": map[string]interface{}{
// This is the best we get for some errors from CEL.
"message": `failed eval: ERROR: <input>:3:56: no such overload
| bytes(get(state.url+'/'+r.id).Body).decode_json()).as(events, {
| .......................................................^`,
"message": `failed eval: ERROR: <input>:3:26: no such overload
| get(state.url+'/'+r.id).Body.decode_json()).as(events, {
| .........................^`,
},
},
},
Expand Down Expand Up @@ -1648,7 +1665,10 @@ func TestInput(t *testing.T) {
conf.Redact = &redact{} // Make sure we pass the redact requirement.
err := cfg.Unpack(&conf)
if err != nil {
t.Fatalf("unexpected error unpacking config: %v", err)
if fmt.Sprint(err) != fmt.Sprint(test.wantErr) {
t.Fatalf("unexpected error unpacking config: %v", err)
}
return
}

var tempDir string
Expand Down
8 changes: 4 additions & 4 deletions x-pack/filebeat/input/cel/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ func TestCheckinV2(t *testing.T) {
"streams": map[string]interface{}{
"cel-cel.cel-1e8b33de-d54a-45cd-90da-23ed71c482e2": map[string]interface{}{
"status": "DEGRADED",
"error": "failed evaluation: failed eval: ERROR: <input>:1:30: failed to unmarshal JSON message: invalid character 'i' looking for beginning of value\n | bytes(get(state.url).Body).as(body,{\"events\":[body.decode_json()]})\n | .............................^",
"error": "failed evaluation: failed eval: ERROR: <input>:1:63: failed to unmarshal JSON message: invalid character 'i' looking for beginning of value\n | bytes(get(state.url).Body).as(body,{\"events\":[body.decode_json()]})\n | ..............................................................^",
},
"cel-cel.cel-1e8b33de-d54a-45cd-90da-ffffffc482e2": map[string]interface{}{
"status": "HEALTHY",
Expand All @@ -339,11 +339,11 @@ func TestCheckinV2(t *testing.T) {
"streams": map[string]interface{}{
"cel-cel.cel-1e8b33de-d54a-45cd-90da-23ed71c482e2": map[string]interface{}{
"status": "DEGRADED",
"error": "failed evaluation: failed eval: ERROR: <input>:1:30: failed to unmarshal JSON message: invalid character 'i' looking for beginning of value\n | bytes(get(state.url).Body).as(body,{\"events\":[body.decode_json()]})\n | .............................^",
"error": "failed evaluation: failed eval: ERROR: <input>:1:63: failed to unmarshal JSON message: invalid character 'i' looking for beginning of value\n | bytes(get(state.url).Body).as(body,{\"events\":[body.decode_json()]})\n | ..............................................................^",
},
"cel-cel.cel-1e8b33de-d54a-45cd-90da-ffffffc482e2": map[string]interface{}{
"status": "DEGRADED",
"error": "failed evaluation: failed eval: ERROR: <input>:1:30: failed to unmarshal JSON message: invalid character 'i' looking for beginning of value\n | bytes(get(state.url).Body).as(body,{\"events\":[body.decode_json()]})\n | .............................^",
"error": "failed evaluation: failed eval: ERROR: <input>:1:63: failed to unmarshal JSON message: invalid character 'i' looking for beginning of value\n | bytes(get(state.url).Body).as(body,{\"events\":[body.decode_json()]})\n | ..............................................................^",
},
},
}, payload) {
Expand Down Expand Up @@ -394,7 +394,7 @@ func TestCheckinV2(t *testing.T) {
},
"cel-cel.cel-1e8b33de-d54a-45cd-90da-ffffffc482e2": map[string]interface{}{
"status": "DEGRADED",
"error": "failed evaluation: failed eval: ERROR: <input>:1:30: failed to unmarshal JSON message: invalid character 'i' looking for beginning of value\n | bytes(get(state.url).Body).as(body,{\"events\":[body.decode_json()]})\n | .............................^",
"error": "failed evaluation: failed eval: ERROR: <input>:1:63: failed to unmarshal JSON message: invalid character 'i' looking for beginning of value\n | bytes(get(state.url).Body).as(body,{\"events\":[body.decode_json()]})\n | ..............................................................^",
},
},
}, payload) {
Expand Down

0 comments on commit e38263c

Please sign in to comment.