Starlette Performance Monitoring

Errors, logs, and traces for your Starlette applications. Scout's Python agent instruments Starlette via ASGI middleware automatically, detects N+1 queries in SQLAlchemy, and catches memory bloat. Requires Python 3.8+ on Linux or macOS.

Errors, Logs, and Traces

Errors, Logs, and Traces in One View for Starlette Apps

Scout connects Starlette endpoint exceptions to the full request trace and surrounding log lines in a single view. When a route handler raises an exception, you see the error, the trace with per-operation timing, and the log context together.

Starlette Trace Timeline
Error Monitoring

Automatic exception capture across Starlette routes, middleware, and background tasks. Errors are linked to the originating trace with request context.

Log Management

Log output is enriched with trace context. Filter logs by trace ID to see exactly what your Starlette application was doing before, during, and after an issue.

App Traces

Transaction tracing with code-level visibility into Starlette route handlers, SQLAlchemy queries, and external HTTP calls. Detailed backtraces show the exact line of code responsible for slow responses.

Query Analysis

N+1 Detection in SQLAlchemy for Starlette

Scout automatically detects N+1 query patterns in SQLAlchemy within Starlette route handlers and background tasks. The agent identifies repeated query patterns and shows the exact code location and performance impact. Supports all major databases.

Starlette N+1 Detection
Auto-Instrumentation

What Scout Instruments in Your Starlette App

Scout auto-instruments Starlette using ASGI middleware. SQLAlchemy queries, Requests and UrlLib3 HTTP client calls, ElasticSearch, PyMongo, and Redis are all captured automatically. No manual spans or decorators required. Since FastAPI is built on Starlette, Scout's Starlette instrumentation is also the basis for FastAPI monitoring.

Starlette Auto-Instrumentation
Supported Frameworks

Works with the Starlette frameworks you already use

Scout auto-instruments the frameworks and libraries in your stack. No manual configuration required.

Web Framework

  • Starlette
  • FastAPI

Databases

  • SQLAlchemy
  • PyMongo
  • Redis
  • ElasticSearch

Task Queues

  • Celery
  • Dramatiq
Memory Profiling

Memory Bloat Detection for Starlette

Starlette applications can accumulate memory when handling large request bodies or maintaining state in background tasks. Scout detects memory bloat at the transaction level, showing which endpoints are responsible for memory growth.

Starlette Memory Bloat Detection
AI Native

Query Your Starlette App Data from AI Assistants and the Terminal

Scout offers hosted and local MCP servers with 17 tools, a Go CLI available via Homebrew with TOON format for LLM output, and a public API. Query your Starlette application's errors, traces, and N+1 insights from Claude Code, Cursor, or the terminal.

AI Native Monitoring
MCP Server

Hosted or local MCP server with 17 tools covering apps, endpoints, traces, errors, insights, background jobs, and usage data. Works with Claude Code, Cursor, VS Code Copilot, and any MCP-enabled assistant.

Scout CLI

Go binary available via Homebrew. Query app metrics, endpoint performance, traces, error groups, and insights from the terminal. Outputs human-friendly tables or TOON format for LLM consumption.

Public API

Full programmatic access to your monitoring data for building custom integrations, dashboards, or automation workflows.

Get Started in Minutes

Add Scout to Your Starlette App

Get Scout running on your Starlette app in under 3 minutes.

1

Install the package:

pip install scout-apm
2

Add the Scout ASGI middleware to your Starlette app and configure your Scout key.

3

Deploy and see data in 5 minutes.

FAQ

Starlette Monitoring FAQ

What is the best monitoring tool for Starlette?

Scout Monitoring instruments Starlette via ASGI middleware automatically. Every request appears as a transaction with SQLAlchemy N+1 detection, memory bloat tracking, error capture, and log context. No changes to your route handlers required.

How do I add APM to a Starlette app?

Install scout-apm with pip, add the Scout ASGI middleware to your Starlette application, configure your Scout key, and deploy. The middleware instruments all routes, SQLAlchemy queries, and background tasks automatically.

Does Scout work with FastAPI since it is built on Starlette?

Yes. Scout has dedicated instrumentation for both Starlette and FastAPI. Since FastAPI is built on Starlette, the ASGI middleware approach works for both. FastAPI-specific features like path parameter extraction and dependency injection timing are also captured.

Does Scout detect N+1 queries in Starlette with SQLAlchemy?

Yes. Scout automatically instruments SQLAlchemy within Starlette route handlers and background tasks. N+1 patterns are identified with the code location and total performance impact. Both sync and async SQLAlchemy sessions are supported.

Does Scout support error monitoring for Starlette?

Yes. Scout captures exceptions from Starlette route handlers, middleware, and background tasks automatically. Each error is linked to the request trace and surrounding log context.

Ready to Optimize Your App?

Join engineering teams who trust Scout Monitoring for hassle-free performance monitoring. With our 3-step setup, powerful tooling, and responsive support, you can quickly identify and fix performance issues before they impact your users.

Start Monitoring for Free