OpenTelemetry instrumentation for Frappe/ERPNext that sends traces, metrics, and logs to ClickStack/HyperDX.
- Traces: HTTP requests, database queries, Redis operations
- Metrics: Request counts, latencies, error rates
- Logs: Python logging integrated with trace context
# On your Frappe bench
cd /home/frappe/frappe-bench
# Get the app
bench get-app https://github.com/Simbotix/simbotix_otel.git
# Install on a site
bench --site your-site.com install-app simbotix_otel
# Install OpenTelemetry dependencies
./env/bin/pip install opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp \
opentelemetry-instrumentation opentelemetry-instrumentation-wsgi \
opentelemetry-instrumentation-requests opentelemetry-instrumentation-redis \
opentelemetry-instrumentation-pymysql opentelemetry-instrumentation-loggingAdd to your supervisor config or systemd service:
environment=OTEL_EXPORTER_OTLP_ENDPOINT="https://otel.appz.studio",OTEL_EXPORTER_OTLP_HEADERS="authorization=YOUR_API_KEY",OTEL_SERVICE_NAME="frappe-yoursite",OTEL_DEPLOYMENT_ENVIRONMENT="production"Change the gunicorn command in supervisor to use the wrapped application:
command=/home/frappe/frappe-bench/env/bin/gunicorn -b 127.0.0.1:8000 -w 17 simbotix_otel.app:application --preloadcommand=/home/frappe/frappe-bench/env/bin/opentelemetry-instrument /home/frappe/frappe-bench/env/bin/gunicorn -b 127.0.0.1:8000 -w 17 frappe.app:application --preload| Variable | Description | Default |
|---|---|---|
OTEL_EXPORTER_OTLP_ENDPOINT |
OTLP endpoint URL | https://otel.appz.studio |
OTEL_EXPORTER_OTLP_HEADERS |
Headers (comma-separated key=value) | - |
OTEL_SERVICE_NAME |
Service name for traces | frappe |
OTEL_SERVICE_VERSION |
Service version | 1.0.0 |
OTEL_DEPLOYMENT_ENVIRONMENT |
Environment (production/staging) | production |
- Open ClickStack/HyperDX at https://clickstack.appz.studio
- Navigate to Traces to see request traces
- Navigate to Logs to see application logs
- Create dashboards for metrics visualization
MIT