Skip to content

Commit

Permalink
feat: use xxhash for error grouping key (#15211)
Browse files Browse the repository at this point in the history
* feat: use xxhash for error grouping key

bump apm-data and replace md5 with xxhash

* lint: regenerate notice
  • Loading branch information
kruskall authored Jan 13, 2025
1 parent f97a528 commit a5447ff
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 20 deletions.
4 changes: 2 additions & 2 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,11 @@ these terms.

--------------------------------------------------------------------------------
Dependency : github.com/elastic/apm-data
Version: v1.15.0
Version: v1.16.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/apm-data@v1.15.0/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/elastic/apm-data@v1.16.0/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/dgraph-io/badger/v2 v2.2007.4
github.com/dustin/go-humanize v1.0.1
github.com/elastic/apm-aggregation v1.2.0
github.com/elastic/apm-data v1.15.0
github.com/elastic/apm-data v1.16.0
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20241231140711-7806f1a2cb26
github.com/elastic/elastic-agent-client/v7 v7.17.0
github.com/elastic/elastic-agent-libs v0.18.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ github.com/ebitengine/purego v0.8.0 h1:JbqvnEzRvPpxhCJzJJ2y0RbiZ8nyjccVUrSM3q+Gv
github.com/ebitengine/purego v0.8.0/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ=
github.com/elastic/apm-aggregation v1.2.0 h1:UndqG3ccBTjyxTqHujBVjcbVLb9qG1clxRcrp9JRelI=
github.com/elastic/apm-aggregation v1.2.0/go.mod h1:YllYwPYVV27pbuPfjRtQAKo6eSSrh13PZr38RKYd810=
github.com/elastic/apm-data v1.15.0 h1:19qq8+OC+eyylUMtd2TrW1YVGrOgXb4d2OJQoqfmqow=
github.com/elastic/apm-data v1.15.0/go.mod h1:PAkbYNARxvd4nhR+HjCskGv/ev30zZi7jglf8EmWtXc=
github.com/elastic/apm-data v1.16.0 h1:LkJFoNkadIyqXNo3EMm98J38j9HWDMWUe6F74GaXtJ4=
github.com/elastic/apm-data v1.16.0/go.mod h1:ST2P1yshhN2U3IbBYyn+Ni3VOFTifavNzMfh7E9zLHY=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20241231140711-7806f1a2cb26 h1:qyI4AIRfdnTwesqHN9KYdbGpcJ4m4lIKlR+f8zbKIO0=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20241231140711-7806f1a2cb26/go.mod h1:CgYrkUfXIWj/lcPc5ipnO0/2OEx4GmstkLzyUHilme8=
github.com/elastic/elastic-agent-autodiscover v0.9.0 h1:+iWIKh0u3e8I+CJa3FfWe9h0JojNasPgYIA47gpuuns=
Expand Down
8 changes: 7 additions & 1 deletion internal/beater/beater.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ import (
"encoding/json"
"errors"
"fmt"
"hash"
"net"
"net/http"
"os"
"runtime"
"strconv"
"time"

"github.com/cespare/xxhash/v2"
"github.com/dustin/go-humanize"
"go.elastic.co/apm/module/apmgrpc/v2"
"go.elastic.co/apm/module/apmotel/v2"
Expand Down Expand Up @@ -471,7 +473,11 @@ func (s *Runner) Run(ctx context.Context) error {
// aggregation, sampling, and indexing.
modelprocessor.SetHostHostname{},
modelprocessor.SetServiceNodeName{},
modelprocessor.SetGroupingKey{},
modelprocessor.SetGroupingKey{
NewHash: func() hash.Hash {
return xxhash.New()
},
},
modelprocessor.SetErrorMessage{},
}
if s.config.DefaultServiceEnvironment != "" {
Expand Down
2 changes: 1 addition & 1 deletion systemtest/approvals/TestErrorIngest.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"logs"
],
"error.grouping_key": [
"d6b3f958dfea98dc9ed2b57d5f0c48bb"
"5be7ecce1b964f32"
],
"error.grouping_name": [
"Cannot read property 'baz' of undefined"
Expand Down
10 changes: 5 additions & 5 deletions systemtest/approvals/TestIntake/Errors.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"ConnectionError"
],
"error.grouping_key": [
"d72b25a26fde3f3aaad1c86950acd070"
"637be2ded470655b"
],
"error.grouping_name": [
"My service could not talk to the database named foobar"
Expand Down Expand Up @@ -439,7 +439,7 @@
"Cannot read property 'baz' no defined"
],
"error.grouping_key": [
"ae0232fed4cb40e7ebc62a585a421d60"
"89f9636ef3381842"
],
"error.grouping_name": [
"Cannot read property 'baz' no defined"
Expand Down Expand Up @@ -655,7 +655,7 @@
"logs"
],
"error.grouping_key": [
"dc8dd667f7036ec5f0bae87bf2188243"
"256d70df2f0019ed"
],
"error.grouping_name": [
"no user found"
Expand Down Expand Up @@ -880,7 +880,7 @@
"DbError"
],
"error.grouping_key": [
"c3868d6704b923014eaffea034e70a3d"
"60b29d2f9dafe754"
],
"error.id": [
"cdefab0123456780"
Expand Down Expand Up @@ -1096,7 +1096,7 @@
"logs"
],
"error.grouping_key": [
"d6b3f958dfea98dc9ed2b57d5f0c48bb"
"5be7ecce1b964f32"
],
"error.grouping_name": [
"Cannot read property 'baz' of undefined"
Expand Down
2 changes: 1 addition & 1 deletion systemtest/approvals/TestIntake/ErrorsTxID.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"ConnectionError"
],
"error.grouping_key": [
"9a4054e958afe722b5877e8fac578ff3"
"676837116a6f59d2"
],
"error.grouping_name": [
"Request method 'POST' not supported"
Expand Down
2 changes: 1 addition & 1 deletion systemtest/approvals/TestIntake/Events.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"ConnectionError"
],
"error.grouping_key": [
"9a4054e958afe722b5877e8fac578ff3"
"676837116a6f59d2"
],
"error.grouping_name": [
"Request method 'POST' not supported"
Expand Down
6 changes: 3 additions & 3 deletions systemtest/approvals/TestIntake/MinimalEvents.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"logs"
],
"error.grouping_key": [
"0b9cba09845a097a271c6beb4c6207f3"
"e7427150b064c482"
],
"error.grouping_name": [
"error log message"
Expand Down Expand Up @@ -90,7 +90,7 @@
"error exception message"
],
"error.grouping_key": [
"3a1fb5609458fbb132b44d8fc7cde104"
"5914882bfc6424ff"
],
"error.grouping_name": [
"error exception message"
Expand Down Expand Up @@ -152,7 +152,7 @@
"error exception type"
],
"error.grouping_key": [
"fa405fa2bd848dab17207e7b544d9ad4"
"0726afd6fffc5433"
],
"error.id": [
"abcdef0123456791"
Expand Down
2 changes: 1 addition & 1 deletion systemtest/approvals/TestOTLPGRPCTraces.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"*errors.errorString"
],
"error.grouping_key": [
"14f4d08792a45fce53a46c93851e36e1"
"7f440eedb20ba958"
],
"error.grouping_name": [
"kablamo"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"Error"
],
"error.grouping_key": [
"89e23da755c2dd759d2d529e37c92b8f"
"9b83ced5381eaafe"
],
"error.grouping_name": [
"Uncaught Error: log timeout test error"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"Error"
],
"error.grouping_key": [
"89e23da755c2dd759d2d529e37c92b8f"
"9b83ced5381eaafe"
],
"error.grouping_name": [
"Uncaught Error: log timeout test error"
Expand Down

0 comments on commit a5447ff

Please sign in to comment.