Hi !
There are two "intake protocols":
- the Elastic agents protocol, which is used by all our APM agents
- OTLP for OpenTelemetry data
Depending on which agent you are using there are different options for that:
- using the APM agent Tracing API to set the attributes, but that requires to execute it in within the database instrumentation
- using the APM agent and an ingest pipeline on the server side: Parse data using ingest pipelines | Elastic Observability [8.12] | Elastic that will require you to modify both the traces and some metrics to keep them consistent.
- 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).