Skip to content

Commit

Permalink
Update apm data (#12242)
Browse files Browse the repository at this point in the history
* Update to apm-data version to handle empty rquest bodies gracefully

* Update apm-data to wrap processor errors

* Update apm-data to require one exception.{type,message} for log exceptions
  • Loading branch information
simitt authored and amannocci committed Dec 28, 2023
1 parent 13de016 commit bf079ca
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 44 deletions.
4 changes: 2 additions & 2 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected].20231019120308-82201b991ae5/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected].20231120111210-bd8f3ecad5bb/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down
3 changes: 3 additions & 0 deletions changelogs/8.12.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
4 changes: 2 additions & 2 deletions internal/beater/api/intake/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"accepted": 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"accepted": 0,
"errors": [
{
"message": "queue is full"
"message": "cannot handle stream: cannot process batch: queue is full"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"accepted": 0,
"errors": [
{
"message": "queue is full"
"message": "cannot handle stream: cannot process batch: queue is full"
}
]
}

This file was deleted.

This file was deleted.

12 changes: 2 additions & 10 deletions internal/beater/api/mux_intake_rum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
})
}

Expand Down
2 changes: 1 addition & 1 deletion systemtest/rum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit bf079ca

Please sign in to comment.