Skip to content

Commit

Permalink
mod: update elastic/mito to version v1.14.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 17, 2024
1 parent 942f8c7 commit a9006e3
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 18 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://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
*Heartbeat*


*Heartbeat*


*Metricbeat*

Expand Down Expand Up @@ -302,14 +300,15 @@ https://github.com/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.14.0. {pull}[]

*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.14.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.14.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.14.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.14.0 h1:QbyqIuob+JXvygqB01C9KlqEThGx5p8n55HiFTSiMm8=
github.com/elastic/mito v1.14.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.14.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

0 comments on commit a9006e3

Please sign in to comment.