Docs » Supported integrations in Splunk Observability Cloud » Instrument back-end applications to send spans to Splunk APM » Instrument Python applications for Splunk Observability Cloud » Configure the Python agent for Splunk Observability Cloud

Configure the Python agent for Splunk Observability Cloud πŸ”—

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.

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.

General settings πŸ”—

The following settings are specific to the Splunk Distribution of OpenTelemetry Python:

Environment variable

Description

SPLUNK_ACCESS_TOKEN

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 Create and manage authentication tokens using Splunk Observability Cloud.

SPLUNK_TRACE_RESPONSE_HEADER_ENABLED

Activates the addition of server trace information to HTTP response headers. For more information, see Server trace information. The default value is true.

OTEL_METRICS_ENABLED

Activates application metrics collection. The default value is true. See Metrics and attributes collected by the Splunk Distribution of OpenTelemetry Python for more information.

Trace configuration πŸ”—

The following settings control tracing limits and attributes:

Environment variable

Description

OTEL_TRACE_ENABLED

Activates tracer creation and autoinstrumentation. The default value is true.

OTEL_SERVICE_NAME

Name of the service or application you’re instrumenting. Takes precedence over the service name defined in the OTEL_RESOURCE_ATTRIBUTES variable.

OTEL_RESOURCE_ATTRIBUTES

Comma-separated list of resource attributes added to every reported span. For example, key1=val1,key2=val2.

OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT

Maximum number of attributes per span. The default value is unlimited.

OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT

Maximum number of attributes per event. The default value is unlimited.

OTEL_LINK_ATTRIBUTE_COUNT_LIMIT

Maximum number of attributes per link. The default value is unlimited.

OTEL_SPAN_EVENT_COUNT_LIMIT

Maximum number of events per span. The default value is unlimited.

OTEL_SPAN_LINK_COUNT_LIMIT

Maximum number of links per span. The default value is 1000.

OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT

Maximum length of strings for attribute values. Values larger than the limit are truncated. The default value is 1200.

Exporters configuration πŸ”—

The following settings control trace exporters and their endpoints:

Environment variable

Description

OTEL_TRACES_EXPORTER

Trace exporter to use. You can set multiple comma-separated values (for example, otlp,console). The default value is otlp.

OTEL_METRICS_EXPORTER

The metrics exporter to use. The default value is otlp. Accepted values are otlp and none. Setting none deactivates metric exports.

OTEL_METRIC_EXPORT_INTERVAL

Interval, in milliseconds, between the start of two export attempts. The default value is 60000.

OTEL_METRIC_EXPORT_TIMEOUT

Maximum allowed time to export data, in milliseconds. The default value is 30000.

OTEL_EXPORTER_OTLP_ENDPOINT

The OTLP endpoint. The default value is http://localhost:4317.

OTEL_EXPORTER_OTLP_METRICS_ENDPOINT

The OTLP endpoint. The default value is http://localhost:4317.

To send data directly to Splunk Observability Cloud bypassing the Collector, see Send data directly to Splunk Observability Cloud.

Propagators configuration πŸ”—

The following settings control trace propagation:

Environment variable

Description

OTEL_PROPAGATORS

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.

For backward compatibility with the SignalFx Python Tracing Library, use the b3multi trace propagator:

export OTEL_PROPAGATORS=b3multi

Python settings for AlwaysOn Profiling πŸ”—

Note

Only CPU profiling is supported.

The following settings control the AlwaysOn Profiling feature for the Python agent:

Environment variable

Description

SPLUNK_PROFILER_ENABLED

Activates AlwaysOn Profiling. The default value is false.

SPLUNK_PROFILER_LOGS_ENDPOINT

The collector endpoint for profiler logs. By default, it takes the value of http://localhost:4317.

SPLUNK_PROFILER_CALL_STACK_INTERVAL

The frequency of call stack sampling, in milliseconds. The default value is 1000.

SPLUNK_PROFILER_INCLUDE_INTERNAL_STACKS

Determines whether to include stack traces from internal profiler threads. The default value is false.

Server trace information πŸ”—

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:

Access-Control-Expose-Headers: Server-Timing
Server-Timing: traceparent;desc="00-<serverTraceId>-<serverSpanId>-01"

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.

Note

If you need to deactivate trace response headers, set SPLUNK_TRACE_RESPONSE_HEADER_ENABLED to false.

Configure the Python agent in your code πŸ”—

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.

See Manually instrument Python applications for Splunk Observability Cloud for more information.

This page was last updated on Mar 28, 2024.