Docs » Instrument applications for Splunk APM » Instrument a Python application

Instrument a Python application 🔗

Important

The original µAPM product, released in 2019, is now called µAPM Previous Generation (µAPM PG). Wherever you see the reference, µAPM now refers to the product released on March 31, 2020.

If you’re using µAPM Previous Generation (µAPM PG), see Overview of SignalFx Microservices APM Previous Generation (µAPM PG).

Important

The SignalFx Python Tracing Library is deprecated. Only critical security fixes and bugs will be provided.

Use the Splunk Distribution of OpenTelemetry Python, which offers the same capabilities and fully supports the OpenTelemetry standard.

Automatically instrument a Python application to capture and send traces to Splunk APM with the Splunk Distribution of OpenTelemetry Python. The Splunk Distribution of OpenTelemetry Python uses OpenTelemetry to instrument a Python application. To set up instrumentation, see the Splunk Distribution of OpenTelemetry Python on GitHub.

The Splunk Distribution of OpenTelemetry Python dynamically injects span start/finish calls into specific, commonly used Python classes. It’s a distribution of the OpenTelemetry Instrumentation for Python that provides B3 context propagation, a Zipkin exporter, and configuration options for full-fidelity traces that APM uses. The end result is similar to manually placing the same span start/finish calls directly in the code, with some slight overhead upon application startup to do the class bytecode alterations.

If you’re configuring instrumentation for the first time, use the Splunk Distribution of OpenTelemetry Python instead of the SignalFx Tracing Library for Python. If you’re currently using the SignalFx Tracing Library for Python and want to migrate to the Splunk Distribution of OpenTelemetry Python to leverage OpenTelemetry, see Migrate from the SignalFx Tracing Library for Python. However, if you’re still using Python 2.x, continue using the SignalFx Tracing Library for Python because the Splunk Distribution of OpenTelemetry Python requires Python 3.5 or later.

Configure the instrumentation to send traces to a Smart Agent. The Smart Agent forwards data to an APM ingest endpoint. Configure the Smart Agent to add tags to identify spans that belong to specific hosts or microservices. For more information about deploying a Smart Agent, see Deploy a SignalFx Smart Agent for Splunk APM.

If you want to configure instrumentation for an application and can’t deploy a Smart Agent, configure the instrumentation to send traces directly to an APM ingest endpoint, or to an OpenTelemetry Collector.

Optionally, deploy an OpenTelemetry Collector between a Smart Agent or instrumented code and an APM ingest endpoint. The OpenTelemetry Collector enables you to centrally manage configuration options, batching, retries, and authentication. For more information about deploying an OpenTelemetry Collector for APM, see Deploy an OpenTelemetry Collector for Splunk APM.

To manually instrument an application, see the OpenTelemetry Instrumentation for Python on GitHub.