Skip to content

feat(outgoing): surface N+1 outgoing HTTP calls - #18

Merged
sylvesterdamgaard merged 1 commit into
mainfrom
feat/http-client-n-plus-one
Oct 13, 2026
Merged

sylvesterdamgaard merged 1 commit into
mainfrom
feat/http-client-n-plus-one

Conversation

@sylvesterdamgaard

Copy link
Copy Markdown
Contributor

Surfaces the HTTP-client N+1 detection from cboxdk/laravel-telemetry#84 (core 3.6).

What's new

  • Outgoing page: new N+1 outgoing calls card (OutgoingNPlusOne). It reads http.client.n_plus_one_detected records and groups them by laravel_http_client_shape. Each row shows the call (GET api.example.com/users/{id}), an example url.full, the origin, the traces affected and the worst repeat. Rows link to the host page.
  • Outgoing requests: new N+1 detected tile (http_client_requests_n_plus_one_total), linking to requests with http.client.n_plus_one.count>0.
  • Waterfall: client spans group by laravel.http.client.shape and are labelled with url.template. laravel.http.client.repeat = "n_plus_one" gives the N+1 badge and a note on the span.
  • Trace story: the Outgoing section shows the marked shapes (report.outgoingRepeats), and the http.client.n_plus_one.count total is labelled.
  • TraceDiagnosis: new HTTP shape pass, which feeds:
    • flags in the http section, with the origin and detail
    • an http_n_plus_one_shapes total from the root tally, plus http_call_shapes
    • a flag when the root counts N+1 shapes but no span read here carries the marker
    • in MCP: http_shapes in verbose trace_summary, an http_n_plus_one hint in list_traces; compare_traces diffs the new flags and totals with no extra code
    • an Outgoing call groups section in the Markdown snapshot
  • Refactor: ReadsQueryRepeats now sits on a generic ReadsRepeatRecords trait that takes the label names. The DB cards' output is unchanged, and their existing tests pass as before.
  • Fixtures: the demo/screenshot logs backend now has http.client.n_plus_one_detected records.

Older core (^3.5 constraint kept): none of the attributes exist there. The card shows its empty state, the tile reads 0 and the HTTP pass adds nothing: no flags and no http_* totals. Waterfall grouping falls back to method + host as before.

Gate: composer check green (847 passed, 2 skipped). npm test green (136). npm run build was rebuilt and committed; only the main chunk changed.

https://claude.ai/code/session_01LtsaMBeethcCYvKx8PTBYL

laravel-telemetry 3.6 flags one endpoint called over and over with a
different id, one call after another, in one trace. Surface it:

- OutgoingNPlusOne card on the Outgoing page, grouping
  http.client.n_plus_one_detected records by call shape, with origin.
  ReadsQueryRepeats now builds on a generic ReadsRepeatRecords trait
  that takes the record family's label names; query cards unchanged.
- "N+1 detected" tile on Outgoing requests
  (http_client_requests_n_plus_one_total).
- Waterfall groups client spans by laravel.http.client.shape, labels
  them with url.template, badges laravel.http.client.repeat and notes
  it on the span.
- TraceDiagnosis HTTP shape pass: http flags, http_n_plus_one_shapes /
  http_call_shapes totals, outgoingRepeats in the trace story, verbose
  http_shapes in trace_summary, an http_n_plus_one hint in list_traces
  and an "Outgoing call groups" Markdown snapshot section.

Older emitters carry none of these attributes: the card is empty, the
tile reads zero and no HTTP flag or total is added.

Claude-Session: https://claude.ai/code/session_01LtsaMBeethcCYvKx8PTBYL
@sylvesterdamgaard
sylvesterdamgaard merged commit f96af37 into main Oct 13, 2026
8 checks passed
@sylvesterdamgaard
sylvesterdamgaard deleted the feat/http-client-n-plus-one branch October 13, 2026 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant