Attribues of spans generated by OTel libraries and further processed later on by the OTel Collector are following a distinct naming schema. To get the best experience from APM for OTel based spans, we will use the APM feature "Span enrichment" to adjust and add span attribute names.
Prereqs:
- Have a terminal available on a system with OCI CLI configured, e.g. Cloud Shell
- Ensure the provided three JSON files from this folder are available in the terminal/shell
- Create a shell parameter APM_DOMAIN_ID containing the OCID of your APM Domain (available from APM/Administration): APM_DOMAIN_ID=ocid1.apmdomain.oc1....
First, we will use file "otel_spans.json" to create a "Span filter" with name "OpenTelemetry Spans". By default we have assumed that you used "otel-demo-app" as namespace for the demo shop. If this is not the case you have to adjust "otel_spans.json" to your needs. When done run the following OCI CLI command:
oci apm-config config create-span-filter --from-json file://otel_spans.json --apm-domain-id $APM_DOMAIN_ID
From APM Administration, select your APM Domain and switch on the left to "Span filters", you should see now the following span filter:
Click on the three dots at the right end of the line with the filter and copy its OCID to the clipboard.
Edit now JSON file "otel-span-options.json" at the top and replace the placeholder with the saved OCID:
{
"filterId": "ocid1.apmconfig.oc1........",
"disabled": false,
...
Finally, run the following command:
oci apm-config config create-options --from-json file://create-span-group.json --apm-domain-id $APM_DOMAIN_ID --options file://otel-span-options.json
In the OCI Console select now "Span enrichment" on the left, you should see the following:
We are all set :-)