Skip to content

Commit

Permalink
remove local FromVTPool()
Browse files Browse the repository at this point in the history
  • Loading branch information
marclop authored and endorama committed Aug 12, 2024
1 parent bad340e commit 660ad5a
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 21 deletions.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ require (
github.com/elastic/go-structform v0.0.10 // indirect
github.com/elastic/go-windows v1.0.1 // indirect
github.com/elastic/gosigar v0.14.3 // indirect
github.com/elastic/opentelemetry-lib v0.7.3 // indirect
github.com/elastic/opentelemetry-lib v0.8.0 // indirect
github.com/elastic/pkcs8 v1.0.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/frankban/quicktest v1.14.0 // indirect
Expand Down Expand Up @@ -151,10 +151,10 @@ require (
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/mod v0.20.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/tools v0.23.0 // indirect
golang.org/x/tools v0.24.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240708141625-4ad9e859172b // indirect
gopkg.in/jcmturner/aescts.v1 v1.0.1 // indirect
gopkg.in/jcmturner/dnsutils.v1 v1.0.1 // indirect
Expand Down
14 changes: 6 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/elastic/apm-aggregation v1.0.2 h1:nvplp5pUGHAvRf8M6G4+UAxx55i+TpEpIda02JE/DEU=
github.com/elastic/apm-aggregation v1.0.2/go.mod h1:cprQyd9TAvUTmyqY/J1ZX4cwU88vbVP9uhNKdEC/dsg=
github.com/elastic/apm-data v1.9.1 h1:X6LD3qgURX+78DMeUG2LazzuORWvzGwQWg9+/JUJHCg=
github.com/elastic/apm-data v1.9.1/go.mod h1:zAJqL7eC+Qut/fvs5y0D1NvHBPJUP+LJKfqlL2/3/2Y=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20240724214231-5541971cc328 h1:XuHyP3vYOJMdufcGiT9JoxplaTT2UfBAjC87i1MCdPM=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20240724214231-5541971cc328/go.mod h1:2OL37mOxzKg5u2ddXjH5HY1MuCQ4kYMc8ks/b0F8kzM=
github.com/elastic/elastic-agent-autodiscover v0.7.0 h1:FCrHXh5AZGrPlpAx8kBu/s/guw9d/EXt+GKlFCnrgsc=
Expand Down Expand Up @@ -159,8 +157,8 @@ github.com/elastic/go-windows v1.0.1 h1:AlYZOldA+UJ0/2nBuqWdo90GFCgG9xuyw9SYzGUt
github.com/elastic/go-windows v1.0.1/go.mod h1:FoVvqWSun28vaDQPbj2Elfc0JahhPB7WQEGa3c814Ss=
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/opentelemetry-lib v0.7.3 h1:jBTFl+sQK2KnnMGMhc3QEeTI7w1eJxIkUUFikK2no0A=
github.com/elastic/opentelemetry-lib v0.7.3/go.mod h1:/kKvHbJLVo/NcKMPHI8/RZKL64fushmnRUzn+arQpjg=
github.com/elastic/opentelemetry-lib v0.8.0 h1:D+S49dIspwjA5z051CEKUUNwFTPZZJeLJ7lGyZZTw74=
github.com/elastic/opentelemetry-lib v0.8.0/go.mod h1:aCZdym3mU3rW87cZmbTaKbAEe5Bb9vjtlqta3FegBAU=
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/sarama v1.19.1-0.20210823122811-11c3ef800752 h1:5/RUNg7rkIvayjPhAIoI3v8p45NfWcfWs5DZSElycis=
Expand Down Expand Up @@ -492,8 +490,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8=
golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
Expand Down Expand Up @@ -574,8 +572,8 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg=
golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI=
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
6 changes: 3 additions & 3 deletions internal/beater/otlp/clientmetadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func SetClientMetadata(ctx context.Context, batch *modelpb.Batch) error {
if event.GetSource().GetIp() == nil {
if tcpAddr, ok := clientMetadata.SourceAddr.(*net.TCPAddr); ok {
if event.Source == nil {
event.Source = modelpb.SourceFromVTPool()
event.Source = &modelpb.Source{}
}
sourceAddrPort := tcpAddr.AddrPort()
event.Source.Ip = modelpb.Addr2IP(sourceAddrPort.Addr().Unmap())
Expand All @@ -54,12 +54,12 @@ func SetClientMetadata(ctx context.Context, batch *modelpb.Batch) error {
}
if event.GetClient().GetIp() == nil && clientMetadata.ClientIP.IsValid() {
if event.Client == nil {
event.Client = modelpb.ClientFromVTPool()
event.Client = &modelpb.Client{}
}
event.Client.Ip = modelpb.Addr2IP(clientMetadata.ClientIP)
}
if clientMetadata.SourceNATIP.IsValid() {
event.Source.Nat = modelpb.NATFromVTPool()
event.Source.Nat = &modelpb.NAT{}
event.Source.Nat.Ip = modelpb.Addr2IP(clientMetadata.SourceNATIP)
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/beater/processors.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func newObserverBatchProcessor() modelpb.ProcessBatchFunc {
return func(ctx context.Context, b *modelpb.Batch) error {
for i := range *b {
if (*b)[i].Observer == nil {
(*b)[i].Observer = modelpb.ObserverFromVTPool()
(*b)[i].Observer = &modelpb.Observer{}
}
observer := (*b)[i].Observer
observer.Hostname = hostname
Expand Down
2 changes: 1 addition & 1 deletion internal/model/modelprocessor/libraryframe.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (s SetLibraryFrame) processException(ctx context.Context, exception *modelp
func (s SetLibraryFrame) processStacktraceFrames(ctx context.Context, frames ...*modelpb.StacktraceFrame) {
for _, frame := range frames {
if frame.Original == nil {
frame.Original = modelpb.OriginalFromVTPool()
frame.Original = &modelpb.Original{}
}
frame.Original.LibraryFrame = frame.LibraryFrame
frame.LibraryFrame = frame.Filename != "" && s.Pattern.MatchString(frame.Filename) ||
Expand Down
2 changes: 1 addition & 1 deletion internal/r8/deobfuscator.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func resolveMappings(types map[string]StacktraceType, mapReader io.Reader) error
for _, frames := range stacktraceType.methods {
for _, frame := range frames {
if frame.Original == nil {
frame.Original = modelpb.OriginalFromVTPool()
frame.Original = &modelpb.Original{}
}
// Multiple frames might point to the same class, so we need to deobfuscate the class name for them all.
frame.Original.Classname = obfuscatedName
Expand Down
2 changes: 1 addition & 1 deletion internal/sourcemap/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (p BatchProcessor) processStacktraceFrame(
}

if frame.Original == nil {
frame.Original = modelpb.OriginalFromVTPool()
frame.Original = &modelpb.Original{}
}

// Store original source information.
Expand Down
6 changes: 3 additions & 3 deletions x-pack/apm-server/sampling/eventstorage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,16 @@ func (rw *ReadWriter) ReadTraceEvents(traceID string, out *modelpb.Batch) error
}
switch item.UserMeta() {
case entryMetaTraceEvent:
event := modelpb.APMEventFromVTPool()
event := modelpb.APMEvent{}
if err := item.Value(func(data []byte) error {
if err := rw.s.codec.DecodeEvent(data, event); err != nil {
if err := rw.s.codec.DecodeEvent(data, &event); err != nil {
return fmt.Errorf("codec failed to decode event: %w", err)
}
return nil
}); err != nil {
return err
}
*out = append(*out, event)
*out = append(*out, &event)
default:
// Unknown entry meta: ignore.
continue
Expand Down

0 comments on commit 660ad5a

Please sign in to comment.