frontend/src/container/OnboardingContainer/Modules/APM/Python/md-docs/falcon.md
Based on your application environment, you can choose the setup below to send traces to SigNoz Cloud.
From VMs, there are two ways to send data to SigNoz Cloud.
Step 1. Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate
Step 2. Install the OpenTelemetry dependencies
pip install opentelemetry-distro==0.38b0
pip install opentelemetry-exporter-otlp==1.17.0
Step 3. Add automatic instrumentation
opentelemetry-bootstrap --action=install
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
Step 4. Run your application
OTEL_RESOURCE_ATTRIBUTES=service.name={{MYAPP}} \
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{{REGION}}.signoz.cloud:443" \
OTEL_EXPORTER_OTLP_HEADERS="signoz-ingestion-key={{SIGNOZ_INGESTION_KEY}}" \
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
opentelemetry-instrument <your_run_command>
python3 app.py or gunicorn src.app -b 0.0.0.0:8001Note:
Don’t run app in reloader/hot-reload mode as it breaks instrumentation. For example, you can disable the auto reload with --noreload.
OTel Collector binary helps to collect logs, hostmetrics, resource and infra attributes. It is recommended to install Otel Collector binary to collect and send traces to SigNoz cloud. You can correlate signals and have rich contextual data through this way.
You can find instructions to install OTel Collector binary here in your VM. Once you are done setting up your OTel Collector binary, you can follow the below steps for instrumenting your Python application.
Step 1. Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate
Step 2. Install the OpenTelemetry dependencies
pip install opentelemetry-distro==0.38b0
pip install opentelemetry-exporter-otlp==1.17.0
Step 3. Add automatic instrumentation
opentelemetry-bootstrap --action=install
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
Step 4. To run your application and send data to collector in same VM
OTEL_RESOURCE_ATTRIBUTES=service.name={{MYAPP}} \
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317" \
OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your_run_command>
Note: Don’t run app in reloader/hot-reload mode as it breaks instrumentation.
<your_run_command> can be python3 app.py or flask run
http://localhost:4317 for gRPC exporter and http://localhost:4318 for HTTP exporter.
Note: The port numbers are 4317 and 4318 for the gRPC and HTTP exporters respectively.
In case you have OtelCollector Agent in different VM, replace localhost:4317 with <IP Address of the VM>:4317.
For Python application deployed on Kubernetes, you need to install OTel Collector agent in your k8s infra to collect and send traces to SigNoz Cloud. You can find the instructions to install OTel Collector agent here.
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Python instrumentation by following the below steps:
Step 1. Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate
Step 2. Install the OpenTelemetry dependencies
pip install opentelemetry-distro==0.38b0
pip install opentelemetry-exporter-otlp==1.17.0
Step 3. Add automatic instrumentation
opentelemetry-bootstrap --action=install
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
Step 4. Run your application
OTEL_RESOURCE_ATTRIBUTES=service.name={{MYAPP}} \
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317" \
OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your_run_command>
Note: Don’t run app in reloader/hot-reload mode as it breaks instrumentation.
<your_run_command> can be python3 app.py or flask run
http://localhost:4317 for gRPC exporter and http://localhost:4318 for HTTP exporter.
Note: The port numbers are 4317 and 4318 for the gRPC and HTTP exporters respectively.
In case you have OtelCollector Agent in different VM, replace localhost:4317 with <IP Address of the VM>:4317.
Step 5. Make sure to dockerise your application along with OpenTelemetry instrumentation.