Get up and running with OpenTelemetry in just a few quick steps!
The setup process consists of two phases:
- Getting OpenTelemetry installed and configured
- Validating that configuration to ensure that data is being sent as expected.
This guide explains how to download, install, and run OpenTelemetry in Python.
- Python 3.4 or newer
- An app to add OpenTelemetry to
We follow OpenTelemetry python instrumentation library. We shall be exporting data in Jaeger Thrift protocol.
If it hangs while installing
grpcio during pip3 install opentelemetry-exporter-otlp then follow below steps as suggested in this stackoverflow link
- pip3 install --upgrade pip
- python3 -m pip install --upgrade setuptools
- pip3 install --no-cache-dir --force-reinstall -Iv grpcio
opentelemetry-exporter-otlp by doing
- pip3 install opentelemetry-exporter-otlp
The above command inspects the active Python site-packages and figures out which instrumentation packages the user might want to install and installs them for you.
If it says cannot find command
opentelemetry-bootstrap then you need to specify the path of the file. In ubuntu, it is at
/home/ubuntu/.local/bin/opentelemetry-bootstrap. So your command becomes,
<service_name> is the name of service you want
<your_run_command> can be
python3 app.py or
- If opentelemetry-instrument command is not found then use full path of executable. In ubuntu it is at /home/ubuntu/.local/bin/opentelemetry-instrument
- Remember to allow incoming requests to port 4317 of machine where SigNoz backend is hosted
We have included a sample flask application with
README.md at https://github.com/SigNoz/sample-flask-app.
Feel free to use this repo to test out OpenTelemetry instrumentation and how to send telemetry data to SigNoz.
For instrumenting Django applications, the instructions are same as for a Flask app as mentioned above.
Though for Django, you must define
DJANGO_SETTINGS_MODULE correctly. If your project is called
mysite, somwthing like following should work
Please refer the official Django docs for more details
For application servers which are based on pre fork model like Gunicorn, uWSGI you have to add a
post_fork hook or a
postfork decorator in your configuration.
Check this documentation from OpenTelemetry om how to set it up.
Here's a working example where we have configured a gunicorn server with
If spans are not being reported to SigNoz, try running in debug mode by setting
The debug log level will print out the configuration information. It will also emit every span to the console, which should look something like: