Skip to content

Commit

Permalink
translate otel messaging.* to ecs (#5334)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Wilkins <axwalk@gmail.com>
(cherry picked from commit 16618f2)

# Conflicts:
#	changelogs/head.asciidoc
#	processor/otel/consumer.go
#	processor/otel/consumer_test.go
  • Loading branch information
stuartnelson3 authored and mergify-bot committed Jul 9, 2021
1 parent e369a0e commit ff493fb
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
31 changes: 31 additions & 0 deletions changelogs/head.asciidoc
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions processor/otel/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions processor/otel/consumer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}))
})
Expand All @@ -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)
Expand Down

0 comments on commit ff493fb

Please sign in to comment.