But is really important to show on a real example how to instrument an application sending the tracing to an APM backend. In this case, I will use the Instana APM tool to receive the tracing.
Instana is a great APM tool with all important capabilities to provide end-to-end Observability and AIOps to the companies, Instana can instrument the applications automatically using the one agent concept, where, with a single agent, can instrument all kinds of applications.
So, why do I need to instrument an application using Otel? We can have some good reasons for that, and this example is just because the application is hosted on IBM Cloud Foundry where we cannot install any agent. In this kind of situation, we have two options to instrument the application.
The first one is to use Instana manual instrumentation and the second one is to use Otel Instrumentation and send the tracing to the Instana backend. And, in this example, we will use Otel for that.
Now we can instrument the application using the Otel instructions located on the Otel documentation for Python: Python OpenTelemetry Instrumentation
Let me show in more detail how the application was instrumented:
Otel Packages to be installed:
OpenTelemetry exporters to be configured:
OpenTelemetry Instrumentation variables:
Initializing trace provider:
Creating span for tracing:
Adding custom attributes to span:
Instana backend to receive the tracing data:
Now, with those configurations, the Instana backend will start to receive the tracing data.
Let me share some Instana screenshots to demonstrate how to get the data.
Span generated by Otel:
Error call details collected by Otel:
Custom dashboards created using Otel data: