The important difference here is the exitSpan: true option when creating the span. The APM agent only normally includes so-called "exit" spans -- spans that represent a call to an external service -- for Service Maps and Dependencies.
When a span is marked as an exit span, then it will set a reasonable value for service target fields used for the Service Map node. By default it uses the span.subtype -- in this case "mariadb".
If you want to further customize that, for example, to distinguish mutliple MariaDB endpoints or databases, then you could use:
dbSpan.setServiceTarget('mariadb', 'mydb')
which should result in a "mariadb/mydb" node in the ServiceMap.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.