Want to use OpenTelemetry instead? Read these docs to get started!
If your app is written in Python, you can get started quickly with Lightstep. Download the Auto-Installer, then configure it to communicate with your Lightstep Microsatellites. When you deploy your app, all supported frameworks, data stores, and libraries will begin sending trace data to Lightstep.
To ensure you can access all Lightstep functionality, including infrastructure metrics reporting, update your tracer to the latest release. To update, simply follow the instructions for installing the tracer. No code changes are needed.
These Auto-Installers are forked from Datadog’s contribution of their tracers to the OpenTelemetry project. You can find the original Datadog docs here.
For Python Django applications, note that tracing is disabled when your application is launched in DEBUG mode.
Supported Python Versions
Python versions 2.7 and 3.4 and up are supported.
Install the Auto-Installer
Install the Python Auto-Installer, using pip.
1 pip install ls-trace
Import Tracer and Set B3 Headers for Trace Propagation
Lightstep recommends using B3 headers for trace propagation as the default, especially on hybrid deployments, as it is the most widely supported header at this time.
1 2 3 from ddtrace import tracer from ddtrace.propagation.b3 import B3HTTPPropagator tracer.configure(http_propagator=B3HTTPPropagator)
Configure the Auto-Installer to Send Data to Lightstep
To send data from your system to Lightstep, you need to configure the Auto-Installer to:
- Point to your Microsatellites
- Send global tags required by Lightstep to ingest and display the data to you.
To configure the Auto-Installer:
Configure the Auto-Installer to point to the Lightstep Microsatellites by setting these environment variables. Use the right values, depending on if you are using on-premise, Lightstep public, or Developer Mode Satellites.
1 2 export DD_TRACE_AGENT_URL=https://<Satellite host>:<Satellite port> export DD_TRACE_GLOBAL_TAGS=lightstep.service_name:<service_name>,lightstep.access_token:<access_token>
1 2 export DD_TRACE_AGENT_URL=https://ingest.lightstep.com:443 export DD_TRACE_GLOBAL_TAGS=lightstep.service_name:<service_name>,lightstep.access_token:<access_token>
1 2 export DD_TRACE_AGENT_URL=http://localhost:8360 export DD_TRACE_GLOBAL_TAGS=lightstep.service_name:<service_name>,lightstep.access_token:developer
End code tabs
The host and port values for on-premise Microsatellites is your pool address, found in your configuration file.
When setting the environment variable
DD_TRACE_GLOBAL_TAGS, the following variables must be included:
The name of the service from which spans originate. This tag allows Lightstep to accurately report on your services, with features such as the Service diagram and the Service Directory
The access token for the project the tracers report to. Lightstep Microsatellites need this token to accept and store span data from the tracer. Reports from clients with invalid or deactivated access tokens will be rejected on ingress.
Run Your App
To include the Auto-Installer’s auto-instrumentation, prefix your Python entry-point command with
For example, if your application is started with
python app.py then:
$ ls-trace-run python app.py
Following are issues you may have after instrumentation, and how to resolve them.
Operation Names Aren’t Human Readable
Operation names in Lightstep Observability are not clear or are very long and unhelpful.
This feature requires a Satellite upgrade to the June 2020 release.
This can happen because the auto-installer is getting the name from a parameter in Datadog that might not be appropriate for your language. You can set that parameter to different values to see if that results in better operation names.
You can use either the
resource or the
name parameter, or both.
Which to use (or if using the both, the order to use) depends on the language of the installer. Refer to the Datadog docs for more info.
To configure how the operation name is set, add the following parameter to your Microsatellite configuration:
1 2 3 4 5 receivers: datadog: operation_name_extractors: - resource - name
If you set both, the order of the values matters. Lightstep Observability tries to extract a name from the first variable value. If one isn’t found, it looks for the second value and uses that.
Following are the supported frameworks, data stores, and libraries that are auto-instrumented when you run your app.
|Flask Cache||>= 0.12|
|Memcached pylibmc||>= 1.4|
|Memcached pymemcache||>= 1.3|
|MongoDB Mongoengine||>= 0.11|
|MongoDB Pymongo||>= 3.0|
|MySQL MySQL-python||>= 1.2.3|
|MySQL mysqlclient||>= 1.3|
|MySQL mysql-connector||>= 2.1|
|Postgres aiopg||>= 0.12.0|
|Postgres psycopg||>= 2.4|
|Redis redis-py-cluster||>= 1.3.5|
Use Datadog Tracers with Lightstep Tracers
If you’re using a mix of Datadog and Lightstep you must use B3 header propagation.