Ecto Performance Monitoring

N+1 detection, query performance tracing, and slow query identification for your Ecto-backed Elixir applications. Scout's Elixir agent instruments Ecto via telemetry automatically. Supports Ecto 3.x with Phoenix, LiveView, and Oban.

Errors, Logs, and Traces

Ecto Query Performance in the Context of Every Request

Scout connects Ecto query timing to the full transaction trace for every Phoenix request, LiveView callback, and Oban job. When a query is slow or a N+1 pattern fires, you see it in context alongside the surrounding log lines. No switching between your query log and your APM.

Ecto Trace Timeline
Error Monitoring

Database errors from Ecto queries are captured and linked to the originating transaction trace. Whether a query times out, a constraint fails, or a connection drops, the error appears with the full trace context.

Log Management

Log output is enriched with trace context. Filter logs by trace ID to see the full sequence of Ecto queries made during a specific Phoenix request, LiveView interaction, or Oban job execution.

App Traces

Every Ecto query appears in the transaction trace with individual query timing, the query text, and the code location. Slow queries are surfaced so you can trace them back to the originating call site.

Query Analysis

N+1 Detection in Ecto, Without Configuration

Scout automatically detects N+1 query patterns in Ecto 3.x without configuration. The agent monitors database queries within Phoenix request handling, LiveView callbacks, and Oban background processes, identifies repeated query patterns, and shows the code location and performance impact of each N+1.

Ecto N+1 Detection
Auto-Instrumentation

Telemetry-Based Ecto Instrumentation

Scout's Elixir agent 2.0 instruments Ecto entirely via telemetry events. Repo queries, changesets, and transactions are captured automatically without wrapping your Repo module or modifying your schema definitions. All standard Ecto 3.x repos are supported.

Ecto Auto-Instrumentation
Supported Frameworks

Works with the Ecto frameworks you already use

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

Database

  • Ecto
  • PostgreSQL
  • MySQL
  • SQLite

Web Framework

  • Phoenix
  • Phoenix LiveView
  • Plug

Background Jobs

  • Oban
Memory Profiling

Memory Bloat Detection for Ecto

Ecto queries that return large result sets can contribute to memory growth in Phoenix processes and Oban workers. Scout detects memory bloat at the transaction level, showing which requests and jobs are responsible for memory increases.

Ecto Memory Bloat Detection
AI Native

Query Your Ecto App Data from AI Assistants and the Terminal

Scout offers hosted and local MCP servers with 17 tools, a Go CLI via Homebrew with TOON format, and a public API. Query your Ecto N+1 insights, slow query data, and query performance trends 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 Ecto App

Get Scout running on your Elixir and Ecto app in under 3 minutes.

1

Add to your mix.exs:

{:scout_apm, "~> 2.0"}
2

Download your customized config to config/scout_apm.exs.

3

Add instrumentation to lib/your_app_web.ex and deploy.

FAQ

Ecto Monitoring FAQ

How do I detect N+1 queries in Ecto?

Scout automatically detects N+1 query patterns in Ecto 3.x without any configuration. The agent monitors database queries within Phoenix request handling, LiveView callbacks, and Oban background processes, identifies repeated query patterns, and shows the code location and performance impact of each N+1. No Repo wrapping or manual query logging required.

How does Scout instrument Ecto?

Scout's Elixir agent 2.0 instruments Ecto entirely via telemetry. It attaches to Ecto's telemetry events at startup, capturing query timing, query text, and execution context for every database call. No changes to your Repo modules or schema definitions are required.

Does Scout show individual Ecto query timing?

Yes. Every Ecto query appears in the transaction trace with individual timing, the query text, and the code location. Slow queries are surfaced prominently so you can trace them back to the originating call site in your Phoenix controller, LiveView, or Oban job.

Does Scout detect N+1 queries in Oban jobs?

Yes. Scout monitors Ecto queries within Oban job executions the same way it monitors queries within Phoenix requests. N+1 patterns triggered inside Oban workers are identified with the job class, code location, and total performance impact.

What Ecto versions does Scout support?

Scout supports Ecto 3.x. The agent uses Ecto's telemetry integration which became stable in Ecto 3.0, so all Ecto 3.x repos are supported without additional configuration.

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