From ff493fbe85b42679023ef898519db21c8466f56d Mon Sep 17 00:00:00 2001 From: stuart nelson Date: Mon, 31 May 2021 14:14:23 +0200 Subject: [PATCH] translate otel messaging.* to ecs (#5334) Co-authored-by: Andrew Wilkins (cherry picked from commit 16618f2a00400dcde109c00037be79e24f3938c5) # Conflicts: # changelogs/head.asciidoc # processor/otel/consumer.go # processor/otel/consumer_test.go --- changelogs/head.asciidoc | 31 +++++++++++++++++++++++++++++++ processor/otel/consumer.go | 8 ++++++++ processor/otel/consumer_test.go | 10 ++++++++++ 3 files changed, 49 insertions(+) create mode 100644 changelogs/head.asciidoc diff --git a/changelogs/head.asciidoc b/changelogs/head.asciidoc new file mode 100644 index 00000000000..1f5f22a72ce --- /dev/null +++ b/changelogs/head.asciidoc @@ -0,0 +1,31 @@ +[[release-notes-head]] +== APM Server version HEAD + +https://github.com/elastic/apm-server/compare/7.13\...master[View commits] + +[float] +==== Breaking Changes + +[float] +==== Bug fixes +* Don't auto-disable ILM due to a failure to communicate with Elasticsearch {pull}5264[5264] +* Fix panic due to misaligned 64-bit access on 32-bit architectures {pull}5277[5277] +* Fixed tail-based sampling pubsub to use _seq_no correctly {pull}5126[5126] +* Fix document grouping of translated OpenTelemetry Java metrics {pull}5309[5309] +* OpenTelemetry: record array attributes as labels {pull}5286[5286] +* model/modeldecoder: fix 32-bit timestamp decoding {pull}5308[5308] + +[float] +==== Intake API Changes + +[float] +==== Added +* Support setting agent configuration from apm-server.yml {pull}5177[5177] +* Add metric_type and unit to field metadata of system metrics {pull}5230[5230] +* Upgrade Go to 1.15.12 {pull}[] +* Translate otel messaging.* semantic conventions to ECS {pull}5334[5334] +* Add support for dynamic histogram metrics {pull}5239[5239] +* Tail-sampling processor now resumes subscription from previous position after restart {pull}5350[5350] + +[float] +==== Deprecated diff --git a/processor/otel/consumer.go b/processor/otel/consumer.go index 2232d29aa6d..76912e1512e 100644 --- a/processor/otel/consumer.go +++ b/processor/otel/consumer.go @@ -190,7 +190,11 @@ func (c *Consumer) convertSpan( // currently do not have the metadata to make this distinction. For // now, we assume that the majority of consumption is passive, and // therefore start a transaction whenever span kind == consumer. +<<<<<<< HEAD if root || otelSpan.Kind() == pdata.SpanKindServer || otelSpan.Kind() == pdata.SpanKindConsumer { +======= + if root || otelSpan.Kind() == pdata.SpanKindSERVER || otelSpan.Kind() == pdata.SpanKindCONSUMER { +>>>>>>> 16618f2a (translate otel messaging.* to ecs (#5334)) transaction = &model.Transaction{ Metadata: metadata, ID: spanID, @@ -700,7 +704,11 @@ func translateSpan(span pdata.Span, metadata model.Metadata, event *model.Span) case isMessagingSpan: event.Type = "messaging" event.Subtype = messageSystem +<<<<<<< HEAD if messageOperation == "" && span.Kind() == pdata.SpanKindProducer { +======= + if messageOperation == "" && span.Kind() == pdata.SpanKindPRODUCER { +>>>>>>> 16618f2a (translate otel messaging.* to ecs (#5334)) messageOperation = "send" } event.Action = messageOperation diff --git a/processor/otel/consumer_test.go b/processor/otel/consumer_test.go index ff7b8dd3025..1a4cc43b3e6 100644 --- a/processor/otel/consumer_test.go +++ b/processor/otel/consumer_test.go @@ -523,9 +523,15 @@ func TestMessagingTransaction(t *testing.T) { tx := transformTransactionWithAttributes(t, map[string]pdata.AttributeValue{ "messaging.destination": pdata.NewAttributeValueString("myQueue"), }, func(s pdata.Span) { +<<<<<<< HEAD s.SetKind(pdata.SpanKindConsumer) // Set parentID to imply this isn't the root, but // kind==Consumer should still force the span to be translated +======= + s.SetKind(pdata.SpanKindCONSUMER) + // Set parentID to imply this isn't the root, but + // kind==CONSUMER should still force the span to be translated +>>>>>>> 16618f2a (translate otel messaging.* to ecs (#5334)) // as a transaction. s.SetParentSpanID(pdata.NewSpanID([8]byte{3})) }) @@ -543,7 +549,11 @@ func TestMessagingSpan(t *testing.T) { "net.peer.ip": pdata.NewAttributeValueString("10.20.30.40"), "net.peer.port": pdata.NewAttributeValueInt(123), }, func(s pdata.Span) { +<<<<<<< HEAD s.SetKind(pdata.SpanKindProducer) +======= + s.SetKind(pdata.SpanKindPRODUCER) +>>>>>>> 16618f2a (translate otel messaging.* to ecs (#5334)) }) assert.Equal(t, "messaging", span.Type) assert.Equal(t, "kafka", span.Subtype)