func TranslateIntakeV2SpanToOTelAttributes()

in receiver/elasticapmreceiver/internal/mappers/intakeV2ToSemConv.go [70:98]


func TranslateIntakeV2SpanToOTelAttributes(event *modelpb.APMEvent, attributes pcommon.Map) {
	if event.Http != nil {

		setHttpAttributes(event, attributes)

		if event.Url != nil && event.Url.Full != "" {
			attributes.PutStr(semconv.AttributeURLFull, event.Url.Full)
		}
	}
	if event.Span.Db != nil {
		attributes.PutStr(semconv.AttributeDBSystem, event.Span.Db.Type)
		attributes.PutStr(semconv.AttributeDBNamespace, event.Span.Db.Instance)
		attributes.PutStr(semconv.AttributeDBQueryText, event.Span.Db.Statement)
	}
	if event.Span.Message != nil {
		// Elastic APM span.subtype does not 100% overlap with https://opentelemetry.io/docs/specs/semconv/attributes-registry/messaging/#messaging-system
		// E.g. azureservicebus in Elastic APM vs servicebus in SemConv
		attributes.PutStr(semconv.AttributeMessagingSystem, event.Span.Subtype)
		// No 100% overlap either
		attributes.PutStr(semconv.AttributeMessagingOperationName, event.Span.Action)

		if event.Span.Message.QueueName != "" {
			attributes.PutStr(semconv.AttributeMessagingDestinationName, event.Span.Message.QueueName)
		}
		if event.Span.Message.RoutingKey != "" {
			attributes.PutStr(semconv.AttributeMessagingRabbitmqDestinationRoutingKey, event.Span.Message.RoutingKey)
		}
	}
}