My goal is to have consistent data across multiple services. This would also help in having more helpful service map that would show what service is using what database instance.
Some of our services use APM Agent which is creating mysql spans with resource defined like so:
Using OpenTelemetry, it is possible to do so with messaging services by sending messaging.destination, I was hoping it would be also possible for databases.
I can provide what is going to our exporter if that would help.
I would also like to apologize since I accidentally deleted the thread for a few seconds. I missclicked the delete button while trying to find an edit button to fix the typo in the title.
using an opentelemetry collector (or an extension of the Otel agent) that retransforms the OTLP data using the database semantic conventions.
The third option is probably the simplest in your case, as the final mapping that happens in apm-server to transform the OTLP data in Elasticsearch documents would be applied consistently (so the metrics derived from traces are consistent without much effort).
According to this doc it looks like I am not able to add anything else concerning database span.
The span.destination.service.resource is still "mysql" even though I would expect it to be "mysql/some-instance-name".
We have a service that uses APM Elastic Agent in which the span resource is set to "mysql/production" and type is still "mysql". This is the state I would like to achieve with Open Telemetry integration. Is it even possible to edit span.destination.service.resource?
As you are using an OTel agent the OTLP protocol is used and there is some translation happening in the apm-server side, so maybe there is something wrong there. I'll try to reproduce it on my side and keep you posted on this.
Which version of the stack (ES, apm-server, Kibana, ...) are you using here ?
Hi @Sylvain_Juge , any updates on this issue?
We are trying to switch from apm agent to otel agent, and this is blocking us. All the services are pointing to the same oracle dependency.
I have try to update the span.destination.service.resource to oracle/{{{db.instance.id}}}, this only works when seeing in the span details, but nothing new when showing in overall dependecies and service map.
Another thing is the external http span name, why only named GET or POST
The problem here is that the dependencies view is built on metrics that are derived from the tracing data before it gets written, so an ingest pipeline on the tracing data will not cover it.
You can identify such metric documents by querying data_stream.dataset:"apm.service_destination.1m", and unfortunately the original span attributes like db.instance are not preserved for those documents, so you can't create an ingest pipeline to cover those.
I think that we might get a work-around to this limitation by using a custom processor (at agent or at collector level) and two ingest pipelines:
with a custom processor (before the APM server), add a custom attribute to the DB spans that is outside of the database semantic conventions and copy the value currently set to db.name attribute, for example to custom_db_instance, this will get copied to a label accessible in the labels.custom_db_instance field in the trace documents and also replicated to the derived metrics documents.
create an traces-apm@custom ingest pipeline where you can just discard this extra redundant custom_db_instance attribute and set the expected value for span.destination.service.resource for the relevant database spans.
create an metrics-apm.service_destination.<metricset.interval>@custom for each relevant interval (by default it's 1m and 10m) that will modify the service destination metrics by reading the value from custom_db_instance label, which can then be discarded.
That's a bit sketchy but I think that it should work. This relies on the fact that the attributes that are part of the semantic conventions like db.* are mapped to ECS fields and are not kept to avoid redundancy, but the custom attributes that are not mapped are just copied as-is to the span/metrics labels, which allows us to use those for "transport" here.
Hi @Sylvain_Juge thanks for your help, I can finally customize the oracle dependency name. In my case, it is easier than you think, I update the field span.destination.service.resource to {{{service.target.type}}}/{{{service.target.name}}.
And create 4 custom ingest pipelines:
traces-apm@custom
metrics-apm.service_destination.1m@custom
metrics-apm.service_destination.10m@custom
metrics-apm.service_destination.60m@custom
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.