npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kidkender/archmind-runtime-correlator

v0.1.0

Published

Correlates ingested runtime spans with static execution graphs — N+1 query detection and runtime-vs-static drift.

Readme

@archmind/runtime-correlator

Connects what happened at runtime back to what the code says should happen — and finds the problems that only show up with real data.


The problem it solves

Static analysis can tell you that TaskService::getAll() is called during a GET /tasks request. It cannot tell you that this method triggers 12 separate SELECT queries instead of one. That pattern only exists at runtime, with real data.

@archmind/runtime-correlator bridges this gap. It takes a normalized TraceSession (from @archmind/runtime-ingest) and an IntermediateExecutionGraph (from @archmind/laravel-parser), maps each span to its corresponding graph node, and then runs detectors that can reason about both the code structure and the actual runtime behavior together.


What it does

Span-to-node correlation

Each application span in the trace is matched to a graph node using a cascade of strategies, from most to least precise:

| Strategy | How | When it applies | |---|---|---| | Exact symbol match | span.name === node.symbol | When OTel is instrumented with ArchMind-compatible naming | | Namespace + function | code.namespace + code.function attrs → ClassName::method | Standard PHP OTel SDK instrumentation | | Middleware name | middleware.name / laravel.middleware attribute | Laravel middleware spans | | Partial symbol | Substring matching as a last resort | Low-confidence fallback |

The result is a CorrelatedSession — every span annotated with the graph node it maps to, its matching strategy, and a confidence level.

Runtime detectors

Once spans are correlated to nodes, detectors can reason about both dimensions simultaneously.


Detectors

N+1 query detection

Finds cases where N database queries with the same table execute under a single parent span — the classic sign that a loop is running individual queries instead of a batch.

TaskService::getAll (span)
  → SELECT * FROM users WHERE id = 1   (infra span #1)
  → SELECT * FROM users WHERE id = 2   (infra span #2)
  → SELECT * FROM users WHERE id = 3   (infra span #3)
  …12 times

The finding tells you: which table, how many queries, which graph node is responsible, and a sample of the SQL statement.

Slow query detection

Finds individual database queries that exceeded a duration threshold (default: 500ms). Severity scales with duration: medium (500ms+), high (1000ms+), critical (2000ms+).

The finding tells you: the exact query, how long it took, and which graph node triggered it.


Why this matters

These two detectors catch a category of problem that is invisible to static analysis — not because the code is wrong, but because the problem only manifests with real data at scale. A single-item test case won't trigger an N+1. A fast development database won't expose a missing index. Only a real request trace under realistic conditions reveals these.

@archmind/runtime-correlator makes this class of problem discoverable through the same ArchMind pipeline as static findings — with evidence, node attribution, and actionable output.


Usage

import { correlateSession, detectNPlusOne, detectSlowQuery } from "@archmind/runtime-correlator"
import { ingestOtlpFile } from "@archmind/runtime-ingest"

const session    = ingestOtlpFile("path/to/trace.json")
const correlated = correlateSession(session, graph)

console.log(correlated.correlationRate)  // e.g. 0.87 — 87% of spans matched to nodes

const n1Findings   = detectNPlusOne(correlated)
const slowFindings = detectSlowQuery(correlated, 500)

n1Findings[0].evidence  // "12× SELECT from `users` under a single parent span"
n1Findings[0].nodeIds   // ["svc_TaskService_getAll_ctrl_TaskController_index"]
n1Findings[0].count     // 12

Quality gate

A correlationRate < 0.7 means the trace and graph are not reliably connected — detector results in this case should be treated as low-confidence. The benchmark runner surfaces this metric for every golden runtime session.


Running tests

cd packages/runtime-correlator
node --experimental-vm-modules ../../node_modules/jest/bin/jest.js