Skip to content

Commit 3f7f20c

Browse files
committed
feat: use xxhash for error grouping key
bump apm-data and replace md5 with xxhash
1 parent 1261584 commit 3f7f20c

File tree

11 files changed

+24
-18
lines changed

11 files changed

+24
-18
lines changed

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/dgraph-io/badger/v2 v2.2007.4
99
github.com/dustin/go-humanize v1.0.1
1010
github.com/elastic/apm-aggregation v1.2.0
11-
github.com/elastic/apm-data v1.15.0
11+
github.com/elastic/apm-data v1.16.0
1212
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20241231140711-7806f1a2cb26
1313
github.com/elastic/elastic-agent-client/v7 v7.17.0
1414
github.com/elastic/elastic-agent-libs v0.18.1

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ github.com/ebitengine/purego v0.8.0 h1:JbqvnEzRvPpxhCJzJJ2y0RbiZ8nyjccVUrSM3q+Gv
126126
github.com/ebitengine/purego v0.8.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
127127
github.com/elastic/apm-aggregation v1.2.0 h1:UndqG3ccBTjyxTqHujBVjcbVLb9qG1clxRcrp9JRelI=
128128
github.com/elastic/apm-aggregation v1.2.0/go.mod h1:YllYwPYVV27pbuPfjRtQAKo6eSSrh13PZr38RKYd810=
129-
github.com/elastic/apm-data v1.15.0 h1:19qq8+OC+eyylUMtd2TrW1YVGrOgXb4d2OJQoqfmqow=
130-
github.com/elastic/apm-data v1.15.0/go.mod h1:PAkbYNARxvd4nhR+HjCskGv/ev30zZi7jglf8EmWtXc=
129+
github.com/elastic/apm-data v1.16.0 h1:LkJFoNkadIyqXNo3EMm98J38j9HWDMWUe6F74GaXtJ4=
130+
github.com/elastic/apm-data v1.16.0/go.mod h1:ST2P1yshhN2U3IbBYyn+Ni3VOFTifavNzMfh7E9zLHY=
131131
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20241231140711-7806f1a2cb26 h1:qyI4AIRfdnTwesqHN9KYdbGpcJ4m4lIKlR+f8zbKIO0=
132132
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20241231140711-7806f1a2cb26/go.mod h1:CgYrkUfXIWj/lcPc5ipnO0/2OEx4GmstkLzyUHilme8=
133133
github.com/elastic/elastic-agent-autodiscover v0.9.0 h1:+iWIKh0u3e8I+CJa3FfWe9h0JojNasPgYIA47gpuuns=

internal/beater/beater.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ import (
2222
"encoding/json"
2323
"errors"
2424
"fmt"
25+
"hash"
2526
"net"
2627
"net/http"
2728
"os"
2829
"runtime"
2930
"strconv"
3031
"time"
3132

33+
"github.com/cespare/xxhash/v2"
3234
"github.com/dustin/go-humanize"
3335
"go.elastic.co/apm/module/apmgrpc/v2"
3436
"go.elastic.co/apm/module/apmotel/v2"
@@ -471,7 +473,11 @@ func (s *Runner) Run(ctx context.Context) error {
471473
// aggregation, sampling, and indexing.
472474
modelprocessor.SetHostHostname{},
473475
modelprocessor.SetServiceNodeName{},
474-
modelprocessor.SetGroupingKey{},
476+
modelprocessor.SetGroupingKey{
477+
NewHash: func() hash.Hash {
478+
return xxhash.New()
479+
},
480+
},
475481
modelprocessor.SetErrorMessage{},
476482
}
477483
if s.config.DefaultServiceEnvironment != "" {

systemtest/approvals/TestErrorIngest.approved.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"logs"
7777
],
7878
"error.grouping_key": [
79-
"d6b3f958dfea98dc9ed2b57d5f0c48bb"
79+
"5be7ecce1b964f32"
8080
],
8181
"error.grouping_name": [
8282
"Cannot read property 'baz' of undefined"

systemtest/approvals/TestIntake/Errors.approved.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
"ConnectionError"
119119
],
120120
"error.grouping_key": [
121-
"d72b25a26fde3f3aaad1c86950acd070"
121+
"637be2ded470655b"
122122
],
123123
"error.grouping_name": [
124124
"My service could not talk to the database named foobar"
@@ -439,7 +439,7 @@
439439
"Cannot read property 'baz' no defined"
440440
],
441441
"error.grouping_key": [
442-
"ae0232fed4cb40e7ebc62a585a421d60"
442+
"89f9636ef3381842"
443443
],
444444
"error.grouping_name": [
445445
"Cannot read property 'baz' no defined"
@@ -655,7 +655,7 @@
655655
"logs"
656656
],
657657
"error.grouping_key": [
658-
"dc8dd667f7036ec5f0bae87bf2188243"
658+
"256d70df2f0019ed"
659659
],
660660
"error.grouping_name": [
661661
"no user found"
@@ -880,7 +880,7 @@
880880
"DbError"
881881
],
882882
"error.grouping_key": [
883-
"c3868d6704b923014eaffea034e70a3d"
883+
"60b29d2f9dafe754"
884884
],
885885
"error.id": [
886886
"cdefab0123456780"
@@ -1096,7 +1096,7 @@
10961096
"logs"
10971097
],
10981098
"error.grouping_key": [
1099-
"d6b3f958dfea98dc9ed2b57d5f0c48bb"
1099+
"5be7ecce1b964f32"
11001100
],
11011101
"error.grouping_name": [
11021102
"Cannot read property 'baz' of undefined"

systemtest/approvals/TestIntake/ErrorsTxID.approved.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"ConnectionError"
5959
],
6060
"error.grouping_key": [
61-
"9a4054e958afe722b5877e8fac578ff3"
61+
"676837116a6f59d2"
6262
],
6363
"error.grouping_name": [
6464
"Request method 'POST' not supported"

systemtest/approvals/TestIntake/Events.approved.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"ConnectionError"
6262
],
6363
"error.grouping_key": [
64-
"9a4054e958afe722b5877e8fac578ff3"
64+
"676837116a6f59d2"
6565
],
6666
"error.grouping_name": [
6767
"Request method 'POST' not supported"

systemtest/approvals/TestIntake/MinimalEvents.approved.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"logs"
2323
],
2424
"error.grouping_key": [
25-
"0b9cba09845a097a271c6beb4c6207f3"
25+
"e7427150b064c482"
2626
],
2727
"error.grouping_name": [
2828
"error log message"
@@ -90,7 +90,7 @@
9090
"error exception message"
9191
],
9292
"error.grouping_key": [
93-
"3a1fb5609458fbb132b44d8fc7cde104"
93+
"5914882bfc6424ff"
9494
],
9595
"error.grouping_name": [
9696
"error exception message"
@@ -152,7 +152,7 @@
152152
"error exception type"
153153
],
154154
"error.grouping_key": [
155-
"fa405fa2bd848dab17207e7b544d9ad4"
155+
"0726afd6fffc5433"
156156
],
157157
"error.id": [
158158
"abcdef0123456791"

systemtest/approvals/TestOTLPGRPCTraces.approved.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"*errors.errorString"
3232
],
3333
"error.grouping_key": [
34-
"14f4d08792a45fce53a46c93851e36e1"
34+
"7f440eedb20ba958"
3535
],
3636
"error.grouping_name": [
3737
"kablamo"

systemtest/approvals/TestRUMErrorSourcemapping/absolute_bundle_filepath/standalone.approved.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"Error"
3535
],
3636
"error.grouping_key": [
37-
"89e23da755c2dd759d2d529e37c92b8f"
37+
"9b83ced5381eaafe"
3838
],
3939
"error.grouping_name": [
4040
"Uncaught Error: log timeout test error"

systemtest/approvals/TestRUMErrorSourcemapping/relative_bundle_filepath/standalone.approved.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"Error"
3535
],
3636
"error.grouping_key": [
37-
"89e23da755c2dd759d2d529e37c92b8f"
37+
"9b83ced5381eaafe"
3838
],
3939
"error.grouping_name": [
4040
"Uncaught Error: log timeout test error"

0 commit comments

Comments
 (0)