diff --git a/NOTICE.txt b/NOTICE.txt index 08b046d12e2..58bcb31d7dc 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -362,11 +362,11 @@ these terms. -------------------------------------------------------------------------------- Dependency : github.com/elastic/apm-data -Version: v0.1.1-0.20231019120308-82201b991ae5 +Version: v0.1.1-0.20231120111210-bd8f3ecad5bb Licence type (autodetected): Apache-2.0 -------------------------------------------------------------------------------- -Contents of probable licence file $GOMODCACHE/github.com/elastic/apm-data@v0.1.1-0.20231019120308-82201b991ae5/LICENSE: +Contents of probable licence file $GOMODCACHE/github.com/elastic/apm-data@v0.1.1-0.20231120111210-bd8f3ecad5bb/LICENSE: Apache License Version 2.0, January 2004 diff --git a/changelogs/8.12.asciidoc b/changelogs/8.12.asciidoc index ea2d8013de7..94abff210f4 100644 --- a/changelogs/8.12.asciidoc +++ b/changelogs/8.12.asciidoc @@ -17,6 +17,9 @@ https://github.com/elastic/apm-server/compare/8.11\...8.12[View commits] [float] ==== Bug fixes - Switch built-in ILM rollover policies from max_size to max_primary_shard_size {pull}11729[11729]. +- Handle empty request bodies gracefully {pull}12242[12242]. +- Wrap processor errors to provide more details {pull}12242[12242]. +- Require only one of exception.{type,message} for log exceptions {pull}12242[12242]. [float] ==== Added diff --git a/go.mod b/go.mod index 984bda2faec..714d1dee50c 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/dgraph-io/badger/v2 v2.2007.3-0.20201012072640-f5a7e0a1c83b github.com/dustin/go-humanize v1.0.1 github.com/elastic/apm-aggregation v0.0.0-20230815024520-e75a37d9ddd6 - github.com/elastic/apm-data v0.1.1-0.20231019120308-82201b991ae5 + github.com/elastic/apm-data v0.1.1-0.20231120111210-bd8f3ecad5bb github.com/elastic/beats/v7 v7.0.0-alpha2.0.20231218141841-a633696068ed github.com/elastic/elastic-agent-client/v7 v7.5.0 github.com/elastic/elastic-agent-libs v0.7.2 diff --git a/go.sum b/go.sum index 7fbf63ddec4..d87ed10ad75 100644 --- a/go.sum +++ b/go.sum @@ -132,8 +132,8 @@ github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFP github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/elastic/apm-aggregation v0.0.0-20230815024520-e75a37d9ddd6 h1:Js+C3HEE0a5BDFmhEmJV/Uo4uzj/paHjd7yl6+KYguw= github.com/elastic/apm-aggregation v0.0.0-20230815024520-e75a37d9ddd6/go.mod h1:ba3gaJCuhxXN/O5AuiI56xxd6DukQdVOK0NfpzBntNo= -github.com/elastic/apm-data v0.1.1-0.20231019120308-82201b991ae5 h1:URlDi0TZetSAo8KAIbaMZQhM5EG8+SDgs0jTen7WvMg= -github.com/elastic/apm-data v0.1.1-0.20231019120308-82201b991ae5/go.mod h1:z4iJVl8vyQa5v5o7UapWGHTsycBKsKfJfILuf2TZpYo= +github.com/elastic/apm-data v0.1.1-0.20231120111210-bd8f3ecad5bb h1:mpfOadQBl6amJQzbXa0d9oy9GTvrlx0kqAb4R1soNoU= +github.com/elastic/apm-data v0.1.1-0.20231120111210-bd8f3ecad5bb/go.mod h1:z4iJVl8vyQa5v5o7UapWGHTsycBKsKfJfILuf2TZpYo= github.com/elastic/beats/v7 v7.0.0-alpha2.0.20231218141841-a633696068ed h1:2ABWyeeCuBbi4ReJFeEAvfPUctfYLc0x5x3ZaQCAuWs= github.com/elastic/beats/v7 v7.0.0-alpha2.0.20231218141841-a633696068ed/go.mod h1:IyDGwc1d+ERmSiMOZZ2mJIJfCnFnIl85zQP7ZvtkSfY= github.com/elastic/elastic-agent-autodiscover v0.6.5 h1:5DeMpuNc8c/tN6HN0A4A2uOFTNFHSg7xrKApzfhvF1U= diff --git a/internal/beater/api/intake/handler_test.go b/internal/beater/api/intake/handler_test.go index cf15c2e7928..8cfa0c5a79d 100644 --- a/internal/beater/api/intake/handler_test.go +++ b/internal/beater/api/intake/handler_test.go @@ -64,14 +64,14 @@ func TestIntakeHandler(t *testing.T) { }(), code: http.StatusBadRequest, id: request.IDResponseErrorsValidate, }, - "BodyReader": { + "EmptyBody": { path: "errors.ndjson", r: func() *http.Request { req := httptest.NewRequest(http.MethodPost, "/", nil) req.Header.Set(headers.ContentType, "application/x-ndjson") return req }(), - code: http.StatusBadRequest, id: request.IDResponseErrorsValidate, + code: http.StatusAccepted, id: request.IDResponseValidAccepted, }, "CompressedBodyReaderDeflateInvalid": { path: "errors.ndjson", diff --git a/internal/beater/api/intake/test_approved/BodyReader.approved.json b/internal/beater/api/intake/test_approved/BodyReader.approved.json deleted file mode 100644 index fc636bfdcb3..00000000000 --- a/internal/beater/api/intake/test_approved/BodyReader.approved.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "accepted": 0, - "errors": [ - { - "message": "EOF while reading metadata" - } - ] -} diff --git a/internal/beater/api/intake/test_approved/EmptyBody.approved.json b/internal/beater/api/intake/test_approved/EmptyBody.approved.json new file mode 100644 index 00000000000..6b51efae3bf --- /dev/null +++ b/internal/beater/api/intake/test_approved/EmptyBody.approved.json @@ -0,0 +1,3 @@ +{ + "accepted": 0 +} diff --git a/internal/beater/api/intake/test_approved/FullQueue.approved.json b/internal/beater/api/intake/test_approved/FullQueue.approved.json index ce2dd7e6357..c163b675ec7 100644 --- a/internal/beater/api/intake/test_approved/FullQueue.approved.json +++ b/internal/beater/api/intake/test_approved/FullQueue.approved.json @@ -2,7 +2,7 @@ "accepted": 0, "errors": [ { - "message": "queue is full" + "message": "cannot handle stream: cannot process batch: queue is full" } ] } diff --git a/internal/beater/api/intake/test_approved/FullQueueLegacy.approved.json b/internal/beater/api/intake/test_approved/FullQueueLegacy.approved.json index ce2dd7e6357..c163b675ec7 100644 --- a/internal/beater/api/intake/test_approved/FullQueueLegacy.approved.json +++ b/internal/beater/api/intake/test_approved/FullQueueLegacy.approved.json @@ -2,7 +2,7 @@ "accepted": 0, "errors": [ { - "message": "queue is full" + "message": "cannot handle stream: cannot process batch: queue is full" } ] } diff --git a/internal/beater/api/intake/test_approved/integration/rum/TestRUMHandler_KillSwitchMiddleware/On.approved.json b/internal/beater/api/intake/test_approved/integration/rum/TestRUMHandler_KillSwitchMiddleware/On.approved.json deleted file mode 100644 index fc636bfdcb3..00000000000 --- a/internal/beater/api/intake/test_approved/integration/rum/TestRUMHandler_KillSwitchMiddleware/On.approved.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "accepted": 0, - "errors": [ - { - "message": "EOF while reading metadata" - } - ] -} diff --git a/internal/beater/api/intake/test_approved/integration/rum/TestRUMHandler_NoAuthorizationRequired.approved.json b/internal/beater/api/intake/test_approved/integration/rum/TestRUMHandler_NoAuthorizationRequired.approved.json deleted file mode 100644 index fc636bfdcb3..00000000000 --- a/internal/beater/api/intake/test_approved/integration/rum/TestRUMHandler_NoAuthorizationRequired.approved.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "accepted": 0, - "errors": [ - { - "message": "EOF while reading metadata" - } - ] -} diff --git a/internal/beater/api/mux_intake_rum_test.go b/internal/beater/api/mux_intake_rum_test.go index 946a6dfc373..f50f82d915a 100644 --- a/internal/beater/api/mux_intake_rum_test.go +++ b/internal/beater/api/mux_intake_rum_test.go @@ -75,11 +75,7 @@ func TestRUMHandler_NoAuthorizationRequired(t *testing.T) { cfg.AgentAuth.SecretToken = "1234" rec, err := requestToMuxerWithPattern(cfg, IntakeRUMPath) require.NoError(t, err) - assert.NotEqual(t, http.StatusUnauthorized, rec.Code) - - expected, err := os.ReadFile(approvalPathIntakeRUM(t.Name()) + ".approved.json") - require.NoError(t, err) - assert.JSONEq(t, string(expected), rec.Body.String()) + assert.Equal(t, http.StatusAccepted, rec.Code) } func TestRUMHandler_KillSwitchMiddleware(t *testing.T) { @@ -96,11 +92,7 @@ func TestRUMHandler_KillSwitchMiddleware(t *testing.T) { t.Run("On", func(t *testing.T) { rec, err := requestToMuxerWithPattern(cfgEnabledRUM(), IntakeRUMPath) require.NoError(t, err) - assert.NotEqual(t, http.StatusForbidden, rec.Code) - - expected, err := os.ReadFile(approvalPathIntakeRUM(t.Name()) + ".approved.json") - require.NoError(t, err) - assert.JSONEq(t, string(expected), rec.Body.String()) + assert.Equal(t, http.StatusAccepted, rec.Code) }) } diff --git a/systemtest/rum_test.go b/systemtest/rum_test.go index d082d0b12b2..d48659dc205 100644 --- a/systemtest/rum_test.go +++ b/systemtest/rum_test.go @@ -110,7 +110,7 @@ func TestRUMAllowServiceNames(t *testing.T) { respBody, _ := io.ReadAll(resp.Body) assert.Equal(t, http.StatusForbidden, resp.StatusCode, string(respBody)) - assert.Equal(t, `{"accepted":0,"errors":[{"message":"unauthorized: anonymous access not permitted for service \"disallowed\""}]}`+"\n", string(respBody)) + assert.Equal(t, `{"accepted":0,"errors":[{"message":"cannot handle stream: cannot process batch: unauthorized: anonymous access not permitted for service \"disallowed\""}]}`+"\n", string(respBody)) } func TestRUMRateLimit(t *testing.T) {