appsignal
N+1 Detection in AppSignal's OpenTelemetry Trace Timeline

N+1 query problems are one of the most common, and quietly damaging, performance issues in production applications. One extra query per record feels harmless in development. At scale, it becomes the reason your response times degrade and your database buckles under load.
Today, AppSignal adds N+1 detection to its OpenTelemetry support. When we identify the pattern in a trace, we collapse the repetitive spans directly in the timeline, making the problem immediately visible in the trace itself.
Find What OpenTelemetry Misses in N+1 Traces
OpenTelemetry is a powerful, vendor-neutral instrumentation standard. It gives applications a consistent way to produce and export observability data, including traces, spans, metrics, and logs. That breadth is its strength.
But OpenTelemetry is an instrumentation layer, not an analysis layer. It faithfully records every span, every database query, every external HTTP call, and every unit of work your application performs, and ships that data to a backend. What it doesn't do is look across those spans for patterns. It has no opinion on whether a set of spans looks suspicious.
N+1 detection requires exactly that kind of analysis. You need to inspect spans within a trace, spot repeated queries with structurally similar shapes, and recognize that as a known anti-pattern rather than expected behavior. Instrumentation packages aren't designed to do that.
That's where AppSignal steps in. We take your OpenTelemetry span data and run our own analysis on top of it. We look for spans and entire span trees that repeat with the same structure, and flag them as N+1. Rather than leaving you with a timeline full of near-identical repeated spans, we collapse them. The noise disappears; the problem stays visible.
Spot N+1 Patterns Faster With Span Collapsing
When AppSignal detects an N+1 pattern, it identifies what's repeating. A single query firing once per record. A chain of operations triggered once per item in a loop. These repetitions are the signature of N+1.
A span tree is a parent span and its children, for example, a call to fetch a related record that itself triggers further queries. When that whole tree repeats, it's collapsed as a unit, not just the leaf spans. Real-world N+1 problems often involve more than one query per iteration, which is why collapsing at the tree level matters.
AppSignal collapses the repeated spans into a single grouped entry by default, instead of displaying them individually. The collapsed group shows the count, the cumulative cost, and enough context to identify what's repeating, without flooding your view with dozens of near-identical rows.

The result is a timeline you can actually read. The N+1 pattern shows up as a structural anomaly, not buried in repetition.
No separate issue page. No context switch. The signal is where you already are, looking at the trace.
Reduce Debugging Time Before N+1 Issues Reach Production
An N+1 problem is easy to miss during development. Your dataset is small, the extra queries are fast, and nothing obviously breaks. It's only when real data and real traffic hit that the cost becomes visible, and by then, debugging means correlating slow traces, counting repeated spans, and working backward to the code.
Catching it before that point is significantly cheaper. You write the fix once, before customers are affected.
But detection is only half of it. A trace with 80 near-identical spans is hard to read even when you know something is wrong; the problem is visible in aggregate, but not in context. Collapsing the repetition makes the N+1 pattern a first-class feature of the trace view, not a needle in a haystack.
By sitting between your OpenTelemetry instrumentation and you, AppSignal can make sense of raw span data in ways that instrumentation itself cannot. N+1 spans are recorded faithfully, and without analysis, that faithfulness becomes noise. Detection and collapsing together turn that noise into a clear, actionable signal. This is one example of that. It won't be the last.
See What's Coming Next in Trace-Level Analysis
We're continuing to invest in span-level analysis that surfaces meaningful issues from your OpenTelemetry data, not just raw observability, but actionable insight. Expect more detection types, smarter grouping, and tighter integration with the rest of the AppSignal workflow.
Start Detecting N+1 Issues in Minutes
Not on AppSignal yet? Start a free trial. No credit card required. Or if you'd rather talk it through first, reach out to our team of experts, and we'll help you get set up.
Got feedback? We're always listening! Share your thoughts in our community Discord or email us at support@appsignal.com.
Released March 11, 2026 · Available on all plans
Wondering what you can do next?
Finished this article? Here are a few more things you can do:
- Try out AppSignal with a 30-day free trial.
- Reach out to our support team with any feedback or questions.
- Share this article on social media
Most popular AppSignal articles

Easily Monitor Multiple Heroku Apps with AppSignal
You can now monitor multiple Heroku apps from a single AppSignal instance.
See more
Fine-Tune Your Charts with Minutely Metrics in AppSignal
Discover how minutely metrics in AppSignal deliver precise performance monitoring. Check out detailed performance data, spot anomalies quickly, troubleshoot issues more efficiently, and optimize your application's performance.
See more
Secure Your Sign-Ins with AppSignal's Single Sign-On
Secure team sign-ins and enhance access management with AppSignal's Single Sign-On Business Add-On. Integrate AppSignal with your identity provider for seamless, secure access management.
See more

Karen Patteri de Souza

Serena Chou
Obsessed with building intuitive customer-first products, communities and climbing rocks. Always excited to hear from developers on what they need to innovate, come chat any time.
All articles by Serena ChouBecome our next author!
AppSignal monitors your apps
AppSignal provides insights for Ruby, Rails, Elixir, Phoenix, Node.js, Express and many other frameworks and libraries. We are located in beautiful Amsterdam. We love stroopwafels. If you do too, let us know. We might send you some!

