Skip to content

Commit

Permalink
Update apm-data and apm-aggregation
Browse files Browse the repository at this point in the history
  • Loading branch information
axw committed Aug 14, 2023
1 parent ff5e239 commit c8ba172
Show file tree
Hide file tree
Showing 18 changed files with 63 additions and 77 deletions.
20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require (
github.com/cespare/xxhash/v2 v2.2.0
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-20230807142825-c82b2b7e590c
github.com/elastic/apm-data v0.1.1-0.20230803060036-9180b59d7888
github.com/elastic/apm-aggregation v0.0.0-20230814031111-fa6b81b35e94
github.com/elastic/apm-data v0.1.1-0.20230814023104-48e4b20579f6
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20230811045459-4506e55d50f9
github.com/elastic/elastic-agent-client/v7 v7.2.0
github.com/elastic/elastic-agent-libs v0.3.11
Expand Down Expand Up @@ -47,10 +47,10 @@ require (
go.opentelemetry.io/otel v1.16.0
go.opentelemetry.io/otel/sdk/metric v0.39.0
go.uber.org/automaxprocs v1.5.2
go.uber.org/zap v1.24.0
golang.org/x/net v0.12.0
go.uber.org/zap v1.25.0
golang.org/x/net v0.14.0
golang.org/x/sync v0.3.0
golang.org/x/term v0.10.0
golang.org/x/term v0.11.0
golang.org/x/time v0.3.0
google.golang.org/grpc v1.56.1
google.golang.org/protobuf v1.31.0
Expand Down Expand Up @@ -155,12 +155,12 @@ require (
go.opentelemetry.io/otel/trace v1.16.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1 // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/tools v0.9.3 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/tools v0.12.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
gopkg.in/jcmturner/aescts.v1 v1.0.1 // indirect
gopkg.in/jcmturner/dnsutils.v1 v1.0.1 // indirect
Expand Down
42 changes: 21 additions & 21 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6/go.mod h1
github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM=
github.com/elastic/apm-aggregation v0.0.0-20230807142825-c82b2b7e590c h1:VKmJ07OWzS+mKx1ahY3XNUz/0iaixjQZGds64qrlUGY=
github.com/elastic/apm-aggregation v0.0.0-20230807142825-c82b2b7e590c/go.mod h1:TwDJCDT04Ni8WrSrD4oEBATnDa18dteY//jhL4kqGio=
github.com/elastic/apm-data v0.1.1-0.20230803060036-9180b59d7888 h1:R2HpM1KxROvzvMHq/3XmuT/Y6oTcTteUFMJtQCP04GM=
github.com/elastic/apm-data v0.1.1-0.20230803060036-9180b59d7888/go.mod h1:lMTMoCWNadiDJih/tLechuMTtumEeedtKJlBOYAv030=
github.com/elastic/apm-aggregation v0.0.0-20230814031111-fa6b81b35e94 h1:UGK3WBPEFepBn5CRJVf5HZsN+OkUchuWaA8cNtl7u5Q=
github.com/elastic/apm-aggregation v0.0.0-20230814031111-fa6b81b35e94/go.mod h1:ba3gaJCuhxXN/O5AuiI56xxd6DukQdVOK0NfpzBntNo=
github.com/elastic/apm-data v0.1.1-0.20230814023104-48e4b20579f6 h1:ixw/vSYEKysrW8xl8gcKEo443dySneWvKjtzsOq893s=
github.com/elastic/apm-data v0.1.1-0.20230814023104-48e4b20579f6/go.mod h1:lMTMoCWNadiDJih/tLechuMTtumEeedtKJlBOYAv030=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20230811045459-4506e55d50f9 h1:B8KxebUXsS4t1cqBdgx3H3LDKQA+YCflxc8o0EVayBc=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20230811045459-4506e55d50f9/go.mod h1:CV/gSnBLMU4ie75Qq8C2JmOPdlvGyqQHg8GgrFxhqYM=
github.com/elastic/elastic-agent-autodiscover v0.6.2 h1:7P3cbMBWXjbzA80rxitQjc+PiWyZ4I4F4LqrCYgYlNc=
Expand Down Expand Up @@ -647,13 +647,13 @@ go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0
go.uber.org/automaxprocs v1.5.2 h1:2LxUOGiR3O6tw8ui5sZa2LAaHnsviZdVOUZw4fvbnME=
go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0=
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c=
go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand All @@ -665,8 +665,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -702,8 +702,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
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.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.11.0 h1:bUO06HqtnRcc/7l71XBe4WcqTZ+3AH1J59zWDDwLKgU=
golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -744,8 +744,8 @@ golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220725212005-46097bf591d3/go.mod h1:AaygXjzTFtRAg2ttMY5RMuhpJ3cNnI0XpyFJD1iQRSM=
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -821,21 +821,21 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c=
golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o=
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -893,8 +893,8 @@ golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM=
golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
golang.org/x/tools v0.12.0 h1:YW6HUoUmYBpwSgyaGaZq1fHjrBjX1rlpZ54T6mu2kss=
golang.org/x/tools v0.12.0/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
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
4 changes: 1 addition & 3 deletions internal/agentcfg/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
"sync"
"time"

"google.golang.org/protobuf/types/known/timestamppb"

"github.com/elastic/apm-data/model/modelpb"
"github.com/elastic/elastic-agent-libs/logp"
)
Expand Down Expand Up @@ -87,7 +85,7 @@ func (r Reporter) Run(ctx context.Context) error {
batch := make(modelpb.Batch, 0, len(applied))
for etag := range applied {
batch = append(batch, &modelpb.APMEvent{
Timestamp: timestamppb.Now(),
Timestamp: modelpb.FromTime(time.Now()),
Labels: modelpb.Labels{"etag": {Value: etag}},
Metricset: &modelpb.Metricset{
Name: "agent_config",
Expand Down
2 changes: 1 addition & 1 deletion internal/agentcfg/reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func TestReportFetch(t *testing.T) {
// Assert the timestamp is not empty and set the timestamp to an empty
// value so we can assert equality in the list contents.
assert.NotZero(t, received.Timestamp, "empty timestamp")
bp.received[i].Timestamp = nil
bp.received[i].Timestamp = 0
}

// We use assert.ElementsMatch because the etags may not be
Expand Down
7 changes: 3 additions & 4 deletions internal/beater/api/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/gorilla/mux"
"github.com/pkg/errors"
"go.uber.org/zap"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/elastic/elastic-agent-libs/logp"
"github.com/elastic/elastic-agent-libs/monitoring"
Expand Down Expand Up @@ -297,7 +296,7 @@ func rootMiddleware(cfg *config.Config, authenticator *auth.Authenticator) []mid

func baseRequestMetadata(c *request.Context) *modelpb.APMEvent {
return &modelpb.APMEvent{
Timestamp: timestamppb.New(c.Timestamp),
Timestamp: modelpb.FromTime(c.Timestamp),
}
}

Expand All @@ -307,7 +306,7 @@ func backendRequestMetadataFunc(cfg *config.Config) func(c *request.Context) *mo
}
return func(c *request.Context) *modelpb.APMEvent {
e := modelpb.APMEvent{
Timestamp: timestamppb.New(c.Timestamp),
Timestamp: modelpb.FromTime(c.Timestamp),
}

if c.ClientIP.IsValid() {
Expand All @@ -325,7 +324,7 @@ func rumRequestMetadataFunc(cfg *config.Config) func(c *request.Context) *modelp
}
return func(c *request.Context) *modelpb.APMEvent {
e := modelpb.APMEvent{
Timestamp: timestamppb.New(c.Timestamp),
Timestamp: modelpb.FromTime(c.Timestamp),
}
if c.UserAgent != "" {
e.UserAgent = &modelpb.UserAgent{Original: c.UserAgent}
Expand Down
8 changes: 4 additions & 4 deletions internal/beater/api/mux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ func TestBackendRequestMetadata(t *testing.T) {
c := &request.Context{Timestamp: tNow}
cfg := &config.Config{AugmentEnabled: true}
event := backendRequestMetadataFunc(cfg)(c)
assert.Equal(t, tNow, event.Timestamp.AsTime())
assert.Equal(t, tNow, modelpb.ToTime(event.Timestamp))
assert.Nil(t, nil, event.Host)

c.ClientIP = netip.MustParseAddr("127.0.0.1")
event = backendRequestMetadataFunc(cfg)(c)
assert.Equal(t, tNow, event.Timestamp.AsTime())
assert.Equal(t, tNow, modelpb.ToTime(event.Timestamp))
assert.Equal(t, &modelpb.Host{Ip: []*modelpb.IP{modelpb.Addr2IP(c.ClientIP)}}, event.Host)
}

Expand All @@ -61,15 +61,15 @@ func TestRUMRequestMetadata(t *testing.T) {
c := &request.Context{Timestamp: tNow}
cfg := &config.Config{AugmentEnabled: true}
event := rumRequestMetadataFunc(cfg)(c)
assert.Equal(t, tNow, event.Timestamp.AsTime())
assert.Equal(t, tNow, modelpb.ToTime(event.Timestamp))
assert.Nil(t, event.Client)
assert.Nil(t, event.Source)
assert.Nil(t, event.UserAgent)

ip := netip.MustParseAddr("127.0.0.1")
c = &request.Context{Timestamp: tNow, ClientIP: ip, SourceIP: ip, UserAgent: "firefox"}
event = rumRequestMetadataFunc(cfg)(c)
assert.Equal(t, tNow, event.Timestamp.AsTime())
assert.Equal(t, tNow, modelpb.ToTime(event.Timestamp))
assert.Equal(t, &modelpb.Client{Ip: modelpb.Addr2IP(c.ClientIP)}, event.Client)
assert.Equal(t, &modelpb.Source{Ip: modelpb.Addr2IP(c.SourceIP)}, event.Source)
assert.Equal(t, &modelpb.UserAgent{Original: c.UserAgent}, event.UserAgent)
Expand Down
4 changes: 2 additions & 2 deletions internal/beater/processors.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ func newObserverBatchProcessor() modelpb.ProcessBatchFunc {
// data stream mappings, in 8.10.
func removeEventReceivedBatchProcessor(ctx context.Context, batch *modelpb.Batch) error {
for _, event := range *batch {
if event.Event != nil && event.Event.Received != nil {
event.Event.Received = nil
if event.Event != nil {
event.Event.Received = 0
}
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion internal/publish/pub.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (t batchTransformer) Transform(context.Context) []beat.Event {
if err := modeljson.MarshalAPMEvent(event, &w); err != nil {
continue
}
beatEvent := beat.Event{Timestamp: event.Timestamp.AsTime()}
beatEvent := beat.Event{Timestamp: modelpb.ToTime(event.Timestamp)}
if err := json.Unmarshal(w.Bytes(), &beatEvent.Fields); err != nil {
continue
}
Expand Down
3 changes: 1 addition & 2 deletions internal/publish/pub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/protobuf/types/known/timestamppb"

"go.elastic.co/apm/v2/apmtest"

Expand Down Expand Up @@ -154,7 +153,7 @@ func BenchmarkPublisher(b *testing.B) {

batch := modelpb.Batch{
&modelpb.APMEvent{
Timestamp: timestamppb.Now(),
Timestamp: modelpb.FromTime(time.Now()),
},
}
ctx := context.Background()
Expand Down
3 changes: 0 additions & 3 deletions systemtest/approvals/TestCompressedSpans.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@
"subtype": "redis",
"type": "db"
},
"timestamp": {
"us": 0
},
"trace": {
"id": "01000000000000000000000000000000"
},
Expand Down
3 changes: 0 additions & 3 deletions systemtest/approvals/TestDropUnsampled.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@
"span": {
"id": "dynamic"
},
"timestamp": {
"us": "dynamic"
},
"trace": {
"id": "dynamic"
},
Expand Down
Loading

0 comments on commit c8ba172

Please sign in to comment.