Blog — MLOps / Observability

FastAPI application performance
monitoring with SigNoz.

A quick guide to getting FastAPI instrumentation up and running with SigNoz — an open-source alternative to Datadog or New Relic — fast.

Dwayo Team Nov 27, 2023

Is there an open-source alternative to Datadog or New Relic?

Yes. SigNoz is an open-source alternative that covers application performance monitoring, logs, metrics, exceptions, alerts, and dashboards, with a query builder.

SigNoz stands as an open-source alternative to Datadog or New Relic. It serves as a comprehensive solution for all your observability requirements, encompassing Application Performance Monitoring (APM), logs, metrics, exceptions, alerts, and dashboards, all enhanced by a robust query builder.

Here is a quick guide to get up and running with FastAPI instrumentation with SigNoz really fast.

How do you run SigNoz with Docker Compose?

Clone the SigNoz repository and start its ClickHouse-based Docker Compose file from the deploy directory with docker compose up -d.

I prefer using docker compose.

git clone -b main https://github.com/SigNoz/signoz.git && cd signoz/deploy/
docker compose -f docker/clickhouse-setup/docker-compose.yaml up -d
Testing the installation

Open http://localhost:3301. If all went well, you should see a webpage asking you to create an account (yeah, that is correct).

How do you instrument a FastAPI app with SigNoz?

Run SigNoz's sample FastAPI app, which has basic instrumentation, in Docker on the same network as your SigNoz install so its telemetry reaches SigNoz.

Here is a sample FastAPI app with basic instrumentation. We'll use the same for this example.

git clone https://github.com/SigNoz/sample-fastAPI-app.git
cd sample-fastAPI-app
docker build -t sample-fastapi-app .
docker run -d --name fastapi-container \
--net clickhouse-setup_default  \
--link clickhouse-setup_otel-collector_1 \
-e OTEL_METRICS_EXPORTER='none' \
-e OTEL_RESOURCE_ATTRIBUTES='service.name=fastapiApp' \
-e OTEL_EXPORTER_OTLP_ENDPOINT='http://clickhouse-setup_otel-collector_1:4317' \
-e OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
-p 5002:5002 sample-fastapi-app

How do you generate test traffic with Locust?

Install Locust and run it headless against the app, for example with 10 users and a spawn rate of 1, to generate traffic you can then see in SigNoz.

pip install locust
locust -f locust.py --headless --users 10 --spawn-rate 1 -H http://localhost:5002

Done! Open-source application performance monitoring tools should offer cost efficiency, customization, and transparency. They provide community support, vendor independence, and continuous improvement through collaborative innovation. SigNoz is already very popular with the open-source community — worth watching as it continues to shape the APM landscape.

Dashboards and alerts tell you something broke — they don't tell your team what to do about it at 2am. If this FastAPI service is sitting in front of an AI feature, pair this monitoring setup with our production AI incident-response runbook so the traces SigNoz surfaces map to an actual response plan.

Where this fits.

Instrumentation and observability like this are part of the groundwork in our MLOps work — the same discipline that keeps production AI systems debuggable once they're live. Use our Production AI Incident Runbook to prepare for AI system failures before they happen, not just detect them.

Get started

Tell us what
you're trying to build.

Book a 30-minute call — we'll help you think through observability and reliability for your production systems.