Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update apm-data: set a default span.representative_count #10792

Merged
merged 4 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,11 @@ SOFTWARE.

--------------------------------------------------------------------------------
Dependency : github.com/elastic/apm-data
Version: v0.1.1-0.20230309014206-3ad1a5caedc9
Version: v0.1.1-0.20230511095520-caaa44e1c286
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected].20230309014206-3ad1a5caedc9/LICENSE:
Contents of probable licence file $GOMODCACHE/github.com/elastic/[email protected].20230511095520-caaa44e1c286/LICENSE:

Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -5963,11 +5963,11 @@ Contents of probable licence file $GOMODCACHE/go.opentelemetry.io/[email protected]

--------------------------------------------------------------------------------
Dependency : go.opentelemetry.io/collector/pdata
Version: v0.63.1
Version: v1.0.0-rcv0011
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/go.opentelemetry.io/collector/pdata@v0.63.1/LICENSE:
Contents of probable licence file $GOMODCACHE/go.opentelemetry.io/collector/pdata@v1.0.0-rcv0011/LICENSE:


Apache License
Expand Down Expand Up @@ -6380,11 +6380,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

--------------------------------------------------------------------------------
Dependency : google.golang.org/grpc
Version: v1.53.0
Version: v1.54.0
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/google.golang.org/grpc@v1.53.0/LICENSE:
Contents of probable licence file $GOMODCACHE/google.golang.org/grpc@v1.54.0/LICENSE:


Apache License
Expand Down Expand Up @@ -14544,11 +14544,11 @@ Contents of probable licence file $GOMODCACHE/go.elastic.co/[email protected]/LICENS

--------------------------------------------------------------------------------
Dependency : go.opentelemetry.io/collector/semconv
Version: v0.63.1
Version: v0.76.1
Licence type (autodetected): Apache-2.0
--------------------------------------------------------------------------------

Contents of probable licence file $GOMODCACHE/go.opentelemetry.io/collector/semconv@v0.63.1/LICENSE:
Contents of probable licence file $GOMODCACHE/go.opentelemetry.io/collector/semconv@v0.76.1/LICENSE:


Apache License
Expand Down
3 changes: 2 additions & 1 deletion changelogs/head.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ https://github.com/elastic/apm-server/compare/8.8\...main[View commits]

[float]
==== Intake API Changes
- Span events now default to having a representative count of 1, if no `sample_rate` field is sent by the agent {pull}10792[10792]

[float]
==== Added
- Span events now carry `host` and `service.version` attributes. {pull}10697[10697]
- Span events now carry `host` and `service.version` attributes. {pull}10697[10697]
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ 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-data v0.1.1-0.20230309014206-3ad1a5caedc9
github.com/elastic/apm-data v0.1.1-0.20230511095520-caaa44e1c286
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20230512130148-b4411de255fa
github.com/elastic/elastic-agent-client/v7 v7.1.1
github.com/elastic/elastic-agent-libs v0.3.8
Expand Down Expand Up @@ -49,14 +49,14 @@ require (
go.elastic.co/apm/v2 v2.4.1
go.elastic.co/fastjson v1.1.0
go.opentelemetry.io/collector v0.63.1
go.opentelemetry.io/collector/pdata v0.63.1
go.opentelemetry.io/collector/pdata v1.0.0-rcv0011
go.uber.org/automaxprocs v1.5.1
go.uber.org/zap v1.24.0
golang.org/x/net v0.10.0
golang.org/x/sync v0.1.0
golang.org/x/term v0.8.0
golang.org/x/time v0.3.0
google.golang.org/grpc v1.53.0
google.golang.org/grpc v1.54.0
google.golang.org/protobuf v1.30.0
gopkg.in/yaml.v3 v3.0.1
)
Expand Down Expand Up @@ -135,7 +135,7 @@ require (
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.elastic.co/apm/module/apmzap/v2 v2.2.0 // indirect
go.elastic.co/ecszap v1.0.1 // indirect
go.opentelemetry.io/collector/semconv v0.63.1 // indirect
go.opentelemetry.io/collector/semconv v0.76.1 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
Expand Down
19 changes: 10 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ 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/eclipse/paho.mqtt.golang v1.3.5 h1:sWtmgNxYM9P2sP+xEItMozsR3w0cqZFlqnNN1bdl41Y=
github.com/elastic/apm-data v0.1.1-0.20230309014206-3ad1a5caedc9 h1:nj0nBnU3hI/h3s4+6CnyOTcQqwH7U6y/2i1XM44wOaU=
github.com/elastic/apm-data v0.1.1-0.20230309014206-3ad1a5caedc9/go.mod h1:8oEk/myQSw+GHqxPD3e8Oz2qPMawcOH+t9HYZ51p+rE=
github.com/elastic/apm-data v0.1.1-0.20230511095520-caaa44e1c286 h1:2SoliozFfpyREEl8D7sT5stInZBUygXn+2P1KXUYSvA=
github.com/elastic/apm-data v0.1.1-0.20230511095520-caaa44e1c286/go.mod h1:0c39ujqEzuWaGzKqgbGSutGL6ZTyj8yRc9dnkxv7Lrg=
github.com/elastic/bayeux v1.0.5 h1:UceFq01ipmT3S8DzFK+uVAkbCdiPR0Bqei8qIGmUeY0=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20230512130148-b4411de255fa h1:qLpi9ivKE5EsGbonqUm80IBvuEsWgn8k9tSjpf1xdHg=
github.com/elastic/beats/v7 v7.0.0-alpha2.0.20230512130148-b4411de255fa/go.mod h1:I9e+q0rqGsXmczIsYTVH8uMJCRYr8GcgmaE/kDocVVI=
Expand Down Expand Up @@ -612,7 +612,7 @@ github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5O
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
Expand Down Expand Up @@ -942,10 +942,11 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
go.opentelemetry.io/collector v0.63.1 h1:hXhoo0VCn2NP1uKqrY1BnZYr87AoIgW9lB5TcCJwTQg=
go.opentelemetry.io/collector v0.63.1/go.mod h1:FZC9Px2N5CRiOG1VWH4XvkDeFx+Bu5tO8+gaqDSfXAA=
go.opentelemetry.io/collector/pdata v0.63.1 h1:g+xdmIjGwZAQFq1+bFF2khcsyRmnECILI0ZjwqMQ04Q=
go.opentelemetry.io/collector/pdata v0.63.1/go.mod h1:IzvXUGQml2mrnvdb8zIlEW3qQs9oFLdD2hLwJdZ+pek=
go.opentelemetry.io/collector/semconv v0.63.1 h1:o9Zz/vwqT85XXYf9XTIXa0qkmfEY8b/JMm4lXf+dwpc=
go.opentelemetry.io/collector/semconv v0.63.1/go.mod h1:5o9yhOa+ABt7g2E5JABDxGZ1PQPbtfxrKNbYn+LOTXU=
go.opentelemetry.io/collector/consumer v0.76.1 h1:+bSz3oATwrQD3Uu8drSyGqrp3OsFo+PS2BguRgiwTuY=
go.opentelemetry.io/collector/pdata v1.0.0-rcv0011 h1:7lT0vseP89mHtUpvgmWYRvQZ0eY+SHbVsnXY20xkoMg=
go.opentelemetry.io/collector/pdata v1.0.0-rcv0011/go.mod h1:9vrXSQBeMRrdfGt9oMgYweqERJ8adaiQjN6LSbqRMMA=
go.opentelemetry.io/collector/semconv v0.76.1 h1:cY5z4uXLB15AuU7GkJFfFCTD82l83fqK7DBRqQ7sZCY=
go.opentelemetry.io/collector/semconv v0.76.1/go.mod h1:eRAIvw3omXfvZxt1GAt9o4R/NFGSruOVkZ6JiJwPo6U=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.40.0 h1:5jD3teb4Qh7mx/nfzq4jO2WFFpvXD0vYWFDrdvNWmXk=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.4 h1:aUEBEdCa6iamGzg6fuYxDA8ThxvOG240mAvWDU+XLio=
go.opentelemetry.io/contrib/propagators/b3 v1.11.1 h1:icQ6ttRV+r/2fnU46BIo/g/mPu6Rs5Ug8Rtohe3KqzI=
Expand Down Expand Up @@ -1280,8 +1281,8 @@ google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc=
google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw=
google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag=
google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g=
google.golang.org/grpc/examples v0.0.0-20201010204749-3c400e7fcc87 h1:JA56ipSuANY2Fwx4OITOAj+QXlHyCJEma6VVWTRBG+k=
google.golang.org/grpc/examples v0.0.0-20201010204749-3c400e7fcc87/go.mod h1:Lh55/1hxmVHEkOvSIQ2uj0P12QyOCUNyRwnUlSS13hw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
Expand Down
1 change: 0 additions & 1 deletion internal/beater/beater.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,6 @@ func (s *Runner) Run(ctx context.Context) error {
modelprocessor.NewDropUnsampled(false /* don't drop RUM unsampled transactions*/, func(i int64) {
transactionsDroppedCounter.Add(i)
}),
modelprocessor.DroppedSpansStatsDiscarder{},
finalBatchProcessor,
}

Expand Down
15 changes: 9 additions & 6 deletions internal/beater/otlp/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,17 @@ func RegisterGRPCServices(
})
gRPCMonitoredConsumer.set(consumer)

ptraceotlp.RegisterGRPCServer(grpcServer, tracesService{consumer})
pmetricotlp.RegisterGRPCServer(grpcServer, metricsService{consumer})
plogotlp.RegisterGRPCServer(grpcServer, logsService{consumer})
ptraceotlp.RegisterGRPCServer(grpcServer, &tracesService{consumer: consumer})
pmetricotlp.RegisterGRPCServer(grpcServer, &metricsService{consumer: consumer})
plogotlp.RegisterGRPCServer(grpcServer, &logsService{consumer: consumer})
}

type tracesService struct {
ptraceotlp.UnimplementedGRPCServer
consumer *otlp.Consumer
}

func (s tracesService) Export(ctx context.Context, req ptraceotlp.ExportRequest) (ptraceotlp.ExportResponse, error) {
func (s *tracesService) Export(ctx context.Context, req ptraceotlp.ExportRequest) (ptraceotlp.ExportResponse, error) {
td := req.Traces()
if td.SpanCount() == 0 {
return ptraceotlp.NewExportResponse(), nil
Expand All @@ -96,10 +97,11 @@ func (s tracesService) Export(ctx context.Context, req ptraceotlp.ExportRequest)
}

type metricsService struct {
pmetricotlp.UnimplementedGRPCServer
consumer *otlp.Consumer
}

func (s metricsService) Export(ctx context.Context, req pmetricotlp.ExportRequest) (pmetricotlp.ExportResponse, error) {
func (s *metricsService) Export(ctx context.Context, req pmetricotlp.ExportRequest) (pmetricotlp.ExportResponse, error) {
md := req.Metrics()
if md.DataPointCount() == 0 {
return pmetricotlp.NewExportResponse(), nil
Expand All @@ -109,10 +111,11 @@ func (s metricsService) Export(ctx context.Context, req pmetricotlp.ExportReques
}

type logsService struct {
plogotlp.UnimplementedGRPCServer
consumer *otlp.Consumer
}

func (s logsService) Export(ctx context.Context, req plogotlp.ExportRequest) (plogotlp.ExportResponse, error) {
func (s *logsService) Export(ctx context.Context, req plogotlp.ExportRequest) (plogotlp.ExportResponse, error) {
ld := req.Logs()
if ld.LogRecordCount() == 0 {
return plogotlp.NewExportResponse(), nil
Expand Down
2 changes: 2 additions & 0 deletions systemtest/approvals/TestCompressedSpans.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
},
"id": "0000000000000002",
"name": "Calls to redis",
"representative_count": 1,
"subtype": "redis",
"type": "db"
},
Expand Down Expand Up @@ -139,6 +140,7 @@
},
"id": "0000000000000034",
"name": "_bulk",
"representative_count": 1,
"subtype": "elasticsearch",
"type": "db"
},
Expand Down
1 change: 1 addition & 0 deletions systemtest/approvals/TestIntake/Events.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@
},
"id": "1234567890aaaade",
"name": "GET users-authenticated",
"representative_count": 1,
"stacktrace": [
{
"exclude_from_grouping": false,
Expand Down
2 changes: 2 additions & 0 deletions systemtest/approvals/TestIntake/MinimalEvents.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
},
"id": "0123456a89012345",
"name": "GET /api/types",
"representative_count": 1,
"type": "request"
},
"timestamp": {
Expand Down Expand Up @@ -259,6 +260,7 @@
},
"id": "0123456a89012345",
"name": "GET /api/types",
"representative_count": 1,
"type": "request"
},
"timestamp": {
Expand Down
10 changes: 10 additions & 0 deletions systemtest/approvals/TestIntake/Spans.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
},
"id": "1234567890aaaade",
"name": "SELECT FROM product_types",
"representative_count": 1,
"stacktrace": [
{
"classname": "Core.js",
Expand Down Expand Up @@ -253,6 +254,7 @@
},
"id": "abcde56a89012345",
"name": "get /api/types",
"representative_count": 1,
"subtype": "http",
"sync": false,
"type": "request"
Expand Down Expand Up @@ -344,6 +346,7 @@
},
"id": "0123456a89012345",
"name": "GET /api/types",
"representative_count": 1,
"subtype": "http",
"type": "request"
},
Expand Down Expand Up @@ -432,6 +435,7 @@
},
"id": "1234abcdef567895",
"name": "GET /api/types",
"representative_count": 1,
"type": "request"
},
"timestamp": {
Expand Down Expand Up @@ -528,6 +532,7 @@
},
"id": "abcdef01234567",
"name": "SELECT FROM p_details",
"representative_count": 1,
"subtype": "postgresql",
"type": "db"
},
Expand Down Expand Up @@ -655,6 +660,7 @@
},
"id": "fdc4567890aaaade",
"name": "SELECT FROM product_types",
"representative_count": 1,
"stacktrace": [
{
"classname": "Core.js",
Expand Down Expand Up @@ -807,6 +813,7 @@
"routing_key": "user-created-span"
},
"name": "Rabbitmq receive",
"representative_count": 1,
"subtype": "JMS",
"type": "messaging"
},
Expand Down Expand Up @@ -902,6 +909,7 @@
},
"id": "abcdef01234567",
"name": "GET /api/types",
"representative_count": 1,
"subtype": "postgresql",
"type": "db"
},
Expand Down Expand Up @@ -1008,6 +1016,7 @@
},
"id": "ljf4567890aaaade",
"name": "Request",
"representative_count": 1,
"subtype": "http",
"type": "external"
},
Expand Down Expand Up @@ -1135,6 +1144,7 @@
},
"id": "ute4567890aaaade",
"name": "SELECT FROM product_types",
"representative_count": 1,
"stacktrace": [
{
"classname": "Core.js",
Expand Down
17 changes: 12 additions & 5 deletions systemtest/approvals/TestIntake/Transactions.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,8 @@
"http": {
"request": {
"method": "POST"
}
},
"response": {}
},
"kubernetes": {
"namespace": "namespace1",
Expand Down Expand Up @@ -718,10 +719,14 @@
"type": "machine_type"
},
"origin": {
"account.id": "abc123",
"account": {
"id": "abc123"
},
"provider": "aws",
"region": "us-east-1",
"service.name": "serviceName"
"service": {
"name": "serviceName"
}
},
"project": {
"id": "project_id",
Expand All @@ -748,8 +753,10 @@
"coldstart": false,
"execution": "2e13b309-23e1-417f-8bf7-074fc96bc683",
"name": "faasName",
"trigger.request_id": "FuH2Cir_vHcEMUA=",
"trigger.type": "http",
"trigger": {
"request_id": "FuH2Cir_vHcEMUA=",
"type": "http"
},
"version": "1.0.0"
},
"host": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
},
"id": "0aaaaaaaaaaaaaaa",
"name": "SELECT FROM product_types",
"representative_count": 1,
"stacktrace": [
{
"abs_path": "net.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
},
"id": "aaaaaaaaaaaaaaaa",
"name": "transaction",
"representative_count": 1,
"stacktrace": [
{
"abs_path": "http://subdomain1.localhost:8000/test/e2e/general-usecase/bundle.js.map",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
},
"id": "aaaaaaaaaaaaaaaa",
"name": "transaction",
"representative_count": 1,
"stacktrace": [
{
"abs_path": "http://subdomain1.localhost:8000/test/e2e/general-usecase/bundle.js.map",
Expand Down