Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit afb0605

Browse files
committed
Merge branch 'main' into trangl-o11ydocs-6385-muting-rules-react
2 parents 7fbd178 + 96bd78a commit afb0605

25 files changed

+1441
-40
lines changed

_images/collector/imagetest.png

Loading

gdi/get-data-in/application/python/get-started.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Instrument Python applications for Splunk Observability Cloud
2121
Troubleshoot the Python instrumentation <troubleshooting/common-python-troubleshooting>
2222
About Splunk OTel Python <splunk-python-otel-distribution>
2323
Migrate from SignalFx Python agent <troubleshooting/migrate-signalfx-python-agent-to-otel>
24+
Migrate to Splunk Python 2.X <migration-guide>
25+
Version 1.X (deprecated) <version1x/get-started-1x>
2426

2527
The Splunk Distribution of OpenTelemetry Python provides a Python agent that automatically adds APM instrumentation to your Python application. The instrumentation captures distributed traces and metrics and sends them to Splunk Observability Cloud.
2628

gdi/get-data-in/application/python/instrumentation/instrument-python-application.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ Follow these steps to automatically instrument your application using the Python
7474

7575
.. code-block:: bash
7676
77-
splunk-py-trace-bootstrap
77+
opentelemetry-bootstrap
7878
79-
To print the instrumentation packages to the console instead of installing them, run ``splunk-py-trace-bootstrap --action=requirements``. You can then add the output to your requirements or Pipfile.
79+
To print the instrumentation packages to the console instead of installing them, run ``opentelemetry-bootstrap --action=requirements``. You can then add the output to your requirements or Pipfile.
8080

8181
#. Set the ``OTEL_SERVICE_NAME`` environment variable:
8282

@@ -122,11 +122,11 @@ Follow these steps to automatically instrument your application using the Python
122122
123123
python3 main.py --port=8000
124124
125-
prefix the command with ``splunk-py-trace``:
125+
prefix the command with ``opentelemetry-instrument``:
126126

127127
.. code-block:: bash
128128
129-
splunk-py-trace python3 main.py --port=8000
129+
opentelemetry-instrument python3 main.py --port=8000
130130
131131
.. note:: To instrument uWSGI applications, see :ref:`python-manual-instrumentation`.
132132

gdi/get-data-in/application/python/instrumentation/instrument-python-frameworks.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ For example, if your manage.py file sets the environment variable to mydjangopro
2323
.. code-tab:: bash Linux
2424

2525
export DJANGO_SETTINGS_MODULE=mydjangoproject.settings
26-
splunk-py-trace python3 ./manage.py runserver --noreload
26+
opentelemetry-instrument python3 ./manage.py runserver --noreload
2727

2828
.. code-tab:: shell Windows PowerShell
2929

3030
$env:DJANGO_SETTINGS_MODULE=mydjangoproject.settings
31-
splunk-py-trace python3 ./manage.py runserver --noreload
31+
opentelemetry-instrument python3 ./manage.py runserver --noreload
3232

3333
.. _uwsgi-instrumentation:
3434

@@ -40,11 +40,11 @@ When using uWSGI, you must configure tracing as a response to the ``post_fork``
4040
.. code-block:: python
4141
4242
import uwsgidecorators
43-
from splunk_otel.tracing import start_tracing
43+
from splunk_otel import init_splunk_otel
4444
4545
@uwsgidecorators.postfork
46-
def setup_tracing():
47-
start_tracing()
46+
def start_otel():
47+
init_splunk_otel()
4848
4949
Customize and use the following snippet to run the application:
5050

@@ -65,15 +65,15 @@ When using both uSWGI and Flask, calling ``start_tracing()`` only autoinstrument
6565
6666
# app.py
6767
import uwsgidecorators
68-
from splunk_otel.tracing import start_tracing
68+
from splunk_otel import init_splunk_otel
6969
from opentelemetry.instrumentation.flask import FlaskInstrumentor
7070
from flask import Flask
7171
7272
app = Flask(__name__)
7373
7474
@uwsgidecorators.postfork
75-
def setup_tracing():
76-
start_tracing()
75+
def setup_otel():
76+
init_splunk_otel()
7777
# Instrument the Flask app instance explicitly
7878
FlaskInstrumentor().instrument_app(app)
7979

gdi/get-data-in/application/python/instrumentation/python-manual-instrumentation.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ Instrumenting applications automatically using the agent of the Splunk Distribut
1414
Start tracing using code
1515
===============================
1616

17-
If you can't use the ``splunk-py-trace`` command to launch the application, you can instead import and configure ``start_tracing`` by adding the following snippet to your application code:
17+
If you can't use the ``opentelemetry-instrument`` command to launch the application, you can instead import and configure ``start_otel`` by adding the following snippet to your application code:
1818

1919
.. code:: python
2020
21-
from splunk_otel.tracing import start_tracing
21+
from splunk_otel.tracing import start_otel
2222
23-
start_tracing()
23+
start_otel()
2424
2525
# Also accepts optional settings. For example:
2626
#
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
.. _python-migration-guide:
2+
3+
*************************************************************
4+
Migrate to the Splunk Python 2.0 instrumentation
5+
*************************************************************
6+
7+
.. meta::
8+
:description: Learn how to migrate from the Splunk OpenTelemetry Python 1.X instrumentation to the Python 2.0 instrumentation.
9+
10+
OpenTelemetry Python instrumentation 2.0 contains a set of breaking changes introduced with the OpenTelemetry semantic conventions updates.
11+
12+
This migration guide assumes that you're using a 1.x version of the Splunk Distribution of OpenTelemetry Python.
13+
14+
.. _python-2.x-migration-prereqs:
15+
16+
Prerequisites
17+
====================================
18+
19+
To migrate to the Splunk Distribution of OpenTelemetry Python version 2.0, you need the following:
20+
21+
* Splunk Distribution of OpenTelemetry Collector version 0.98 or higher deployed.
22+
* Administrator permissions for Splunk Observability Cloud.
23+
* pip version 3.0 or higher.
24+
25+
.. _migrate-python-2.x-steps:
26+
27+
Migrate to Splunk OTel Python 2.0
28+
=====================================
29+
30+
Upgrading to Splunk OTel Python 2.0 requires upgrading the Splunk Distribution of OpenTelemetry Collector.
31+
32+
To upgrade to Splunk OTel Python 2.0, follow these steps:
33+
34+
#. Open a terminal.
35+
#. Enter the following command:
36+
37+
.. code-block:: bash
38+
39+
pip install --upgrade splunk-opentelemetry
40+
41+
#. Restart any running Python applications that you plan to instrument.
42+
43+
.. _python-2.x-new-instrumentation:
44+
45+
Instrumentation parameters for Python 2.0
46+
====================================================
47+
48+
Splunk OpenTelemetry Python version 2.0 changes the parameters for zero-code instrumentation.
49+
50+
See the following table for a list of changes:
51+
52+
.. list-table::
53+
:header-rows: 1
54+
55+
* - Version 1.x name
56+
- Version 2.0 name
57+
- Description
58+
* - `splunk-py-trace`, `splk-py-trace`
59+
- `opentelemetry-instrument`
60+
- Activates the Splunk OpenTelemetry Python agent and sends traces and metrics to Splunk Observability Cloud.
61+
* - `splunk-py-trace-bootstrap`, `splk-py-trace-bootstrap`
62+
- `opentelemetry-bootstrap`
63+
- Installs instrumentation libraries and dependencies for Splunk OpenTelemetry Python.
64+
65+
.. _python-2.x-new-functions:
66+
67+
Function names for Python 2.0
68+
====================================
69+
70+
Functions configure certain telemetry data settings in your Python application code.
71+
72+
See the following table for new function names in Python 2.0:
73+
74+
.. list-table::
75+
:header-rows: 1
76+
77+
* - Version 1.x name
78+
- Version 2.0 name
79+
- Description
80+
* - `start_tracing()`, `start_metrics()`
81+
- `init_splunk_otel()`
82+
- Configures tracing, metrics, and logs for Splunk OpenTelemetry Python.
83+
84+
.. _python-2.x-troubleshooting:
85+
86+
Troubleshooting
87+
====================================
88+
89+
.. include:: /_includes/troubleshooting-components.rst
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
.. _advanced-python-otel-configuration-1x:
2+
3+
********************************************************************
4+
Configure the Python agent for Splunk Observability Cloud
5+
********************************************************************
6+
7+
.. meta::
8+
:description: Configure the agent of the Splunk Distribution of OpenTelemetry Python to suit most of your instrumentation needs, like correlating traces with logs, activating exporters, and more.
9+
10+
You can configure the Python agent from the Splunk Distribution of OpenTelemetry Python to suit your instrumentation needs. In most cases, modifying the basic configuration is enough to get started.
11+
12+
The following sections describe all available settings for configuring the Python agent, including options for activating new features that are unique to the Splunk Distribution of OpenTelemetry Python.
13+
14+
.. _main-python-agent-settings-1x:
15+
16+
General settings
17+
=========================================================================
18+
19+
The following settings are specific to the Splunk Distribution of OpenTelemetry Python:
20+
21+
.. list-table::
22+
:header-rows: 1
23+
24+
* - Environment variable
25+
- Description
26+
* - ``SPLUNK_ACCESS_TOKEN``
27+
- A Splunk authentication token that lets exporters send data directly to Splunk Observability Cloud. Unset by default. Not required unless you need to send data to the Splunk Observability Cloud ingest endpoint. See :ref:`admin-tokens`.
28+
* - ``SPLUNK_TRACE_RESPONSE_HEADER_ENABLED``
29+
- Activates the addition of server trace information to HTTP response headers. For more information, see :ref:`server-trace-information-python`. The default value is ``true``.
30+
* - ``OTEL_METRICS_ENABLED``
31+
- Activates application metrics collection. The default value is ``true``. See :ref:`python-otel-metrics` for more information.
32+
33+
.. _trace-configuration-python-1x:
34+
35+
Trace configuration
36+
=======================================================
37+
38+
The following settings control tracing limits and attributes:
39+
40+
.. list-table::
41+
:header-rows: 1
42+
43+
* - Environment variable
44+
- Description
45+
* - ``OTEL_TRACE_ENABLED``
46+
- Activates tracer creation and autoinstrumentation. The default value is ``true``.
47+
* - ``OTEL_SERVICE_NAME``
48+
- Name of the service or application you're instrumenting. Takes precedence over the service name defined in the ``OTEL_RESOURCE_ATTRIBUTES`` variable.
49+
* - ``OTEL_RESOURCE_ATTRIBUTES``
50+
- Comma-separated list of resource attributes added to every reported span. For example, ``key1=val1,key2=val2``.
51+
* - ``OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT``
52+
- Maximum number of attributes per span. The default value is unlimited.
53+
* - ``OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT``
54+
- Maximum number of attributes per event. The default value is unlimited.
55+
* - ``OTEL_LINK_ATTRIBUTE_COUNT_LIMIT``
56+
- Maximum number of attributes per link. The default value is unlimited.
57+
* - ``OTEL_SPAN_EVENT_COUNT_LIMIT``
58+
- Maximum number of events per span. The default value is unlimited.
59+
* - ``OTEL_SPAN_LINK_COUNT_LIMIT``
60+
- Maximum number of links per span. The default value is ``1000``.
61+
* - ``OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT``
62+
- Maximum length of strings for attribute values. Values larger than the limit are truncated. The default value is ``1200``.
63+
64+
.. _trace-exporters-settings-python-1x:
65+
66+
Exporters configuration
67+
===============================================================
68+
69+
The following settings control trace exporters and their endpoints:
70+
71+
.. list-table::
72+
:header-rows: 1
73+
74+
* - Environment variable
75+
- Description
76+
* - ``OTEL_TRACES_EXPORTER``
77+
- Trace exporter to use. You can set multiple comma-separated values (for example, ``otlp,console``). The default value is ``otlp``.
78+
* - ``OTEL_METRICS_EXPORTER``
79+
- The metrics exporter to use. The default value is ``otlp``. Accepted values are ``otlp`` and ``none``. Setting ``none`` deactivates metric exports.
80+
* - ``OTEL_METRIC_EXPORT_INTERVAL``
81+
- Interval, in milliseconds, between the start of two export attempts. The default value is ``60000``.
82+
* - ``OTEL_METRIC_EXPORT_TIMEOUT``
83+
- Maximum allowed time to export data, in milliseconds. The default value is ``30000``.
84+
* - ``OTEL_EXPORTER_OTLP_ENDPOINT``
85+
- The OTLP endpoint. The default value is ``http://localhost:4317``.
86+
* - ``OTEL_EXPORTER_OTLP_METRICS_ENDPOINT``
87+
- The OTLP endpoint. The default value is ``http://localhost:4317``.
88+
89+
To send data directly to Splunk Observability Cloud bypassing the Collector, see :ref:`export-directly-to-olly-cloud-python`.
90+
91+
.. _trace-propagation-configuration-python-1x:
92+
93+
Propagators configuration
94+
=======================================================
95+
96+
The following settings control trace propagation:
97+
98+
.. list-table::
99+
:header-rows: 1
100+
101+
* - Environment variable
102+
- Description
103+
* - ``OTEL_PROPAGATORS``
104+
- Comma-separated list of propagators you want to use. The default value is ``tracecontext,baggage``. You can find the list of supported propagators in the OpenTelemetry documentation.
105+
106+
For backward compatibility with the SignalFx Python Tracing Library, use the b3multi trace propagator:
107+
108+
.. tabs::
109+
110+
.. code-tab:: shell Linux
111+
112+
export OTEL_PROPAGATORS=b3multi
113+
114+
.. code-tab:: shell Windows PowerShell
115+
116+
$env:OTEL_PROPAGATORS=b3multi
117+
118+
.. _profiling-configuration-python-1x:
119+
120+
Python settings for AlwaysOn Profiling
121+
====================================================
122+
123+
.. note:: Only CPU profiling is supported.
124+
125+
The following settings control the AlwaysOn Profiling feature for the Python agent:
126+
127+
.. list-table::
128+
:header-rows: 1
129+
:widths: 40, 60
130+
131+
* - Environment variable
132+
- Description
133+
* - ``SPLUNK_PROFILER_ENABLED``
134+
- Activates AlwaysOn Profiling. The default value is ``false``.
135+
* - ``SPLUNK_PROFILER_LOGS_ENDPOINT``
136+
- The collector endpoint for profiler logs. By default, it takes the value of ``http://localhost:4317``.
137+
* - ``SPLUNK_PROFILER_CALL_STACK_INTERVAL``
138+
- The frequency of call stack sampling, in milliseconds. The default value is ``1000``.
139+
* - ``SPLUNK_PROFILER_INCLUDE_INTERNAL_STACKS``
140+
- Determines whether to include stack traces from internal profiler threads. The default value is ``false``.
141+
142+
.. _server-trace-information-python-1x:
143+
144+
Server trace information
145+
==============================================
146+
147+
To connect Real User Monitoring (RUM) requests from mobile and web applications with server trace data, trace response headers are activated by default. The instrumentation adds the following response headers to HTTP responses:
148+
149+
.. code-block::
150+
151+
Access-Control-Expose-Headers: Server-Timing
152+
Server-Timing: traceparent;desc="00-<serverTraceId>-<serverSpanId>-01"
153+
154+
The ``Server-Timing`` header contains the ``traceId`` and ``spanId`` parameters in ``traceparent`` format. For more information, see the Server-Timing and traceparent documentation on the W3C website.
155+
156+
.. note:: If you need to deactivate trace response headers, set ``SPLUNK_TRACE_RESPONSE_HEADER_ENABLED`` to ``false``.
157+
158+
.. _code-configuration-python-1x:
159+
160+
Configure the Python agent in your code
161+
====================================================
162+
163+
If you can't set environment variables or can't use ``splunk-py-trace`` for setting configuration values at runtime, define the configuration settings in your code.
164+
165+
See :ref:`python-manual-instrumentation` for more information.
166+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.. _get-started-python-1x:
2+
3+
**************************************************************
4+
Instrument Python applications for Splunk Observability Cloud
5+
**************************************************************
6+
7+
8+
.. meta::
9+
:description: Instrument Python applications automatically to export spans and metrics to Splunk Observability Cloud.
10+
11+
.. toctree::
12+
:hidden:
13+
14+
Instrument your Python application <instrument-python-application-1x>
15+
Configure the Python agent <advanced-python-otel-configuration-1x>
16+
Metrics and attributes <python-otel-metrics-1x>
17+
18+
The Splunk Distribution of OpenTelemetry Python provides a Python agent that automatically adds APM instrumentation to your Python application. The instrumentation captures distributed traces and metrics and sends them to Splunk Observability Cloud.
19+
20+
To instrument your Python application, follow these steps:
21+
22+
#. Check compatibility and requirements. See :ref:`python-otel-requirements`.
23+
#. Instrument your Python application. See :ref:`instrument-python-applications-1x`.
24+
#. Configure your instrumentation. See :ref:`configure-python-instrumentation-1x`.
25+
26+
For more information, see :ref:`splunk-python-otel-dist`.
27+
28+
.. note:: The SignalFx Python Agent is deprecated and will reach End of Support on December 17th, 2022. See :ref:`migrate-signalfx-python-agent-to-otel` to migrate to the Splunk Distribution of OpenTelemetry Python.

0 commit comments

Comments
 (0)