Skip to content

feat(api): Report field sizes of the conversation feed response - #3814

Merged
BYK merged 6 commits into
mainfrom
feat/conversation-feed-field-size-telemetry
Nov 19, 2026
Merged

BYK merged 6 commits into
mainfrom
feat/conversation-feed-field-size-telemetry

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

GET /api/conversations responses can reach millions of chars, and no telemetry shows which row fields fill them.

serializeConversationFeed (api/conversations/feed-response.ts) replaces the plain JSON.stringify for the feed. It serializes activityPreview, annotations, participants and threads on their own and splices them into each row, so the response is still serialized only once.

Key order: values do not change, but those four keys now come last in each top-level row object. JSON clients that read by key are not affected.

jsonResponse takes an optional serializer that returns the body and extra span attributes. The default is unchanged.

New attributes on the serialize span of the feed response:

  • app.api.response.field_chars.{activity_preview,annotations,participants,threads}: total chars of each field across the page's top-level rows. threads includes the nested Threads with all their fields.
  • app.conversation_feed.rows: top-level rows.
  • app.conversation_feed.threads: nested Threads, counted recursively.
  • app.conversation_feed.waiting_rows: waiting rows added from outside the page. The feed does not mark them, so readConversationFeed reports the count to the route through onWaitingRows.

TELEMETRY.md gets a Domains row for these attributes.

Conflict risk: #3808 also edits readConversationFeed in list.ts, in lines next to these. Whichever PR merges second needs main merged in.

via @BYK.

--

View Session [Sentry]

sentry-junior Bot and others added 2 commits November 19, 2026 17:55
The feed serializer writes activityPreview, annotations, participants,
and threads on their own and splices them into each row, so the
response is still serialized once and the serialize span gets the
chars of each field, the row count, and the nested Thread count. The
count of waiting rows from outside the page goes on the request span.

Co-Authored-By: BYK <[email protected]>
The read reports the count to the route, which passes it to the feed
serializer, so every feed size attribute is on one span.

Co-Authored-By: BYK <[email protected]>
@sentry-junior
sentry-junior Bot requested a review from BYK November 19, 2026 18:06
@vercel

vercel Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 19, 2026 6:49pm UTC

Request Review

@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 19, 2026

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like these should be metrics rather than span attributes? Or maybe both?

@BYK
BYK enabled auto-merge (squash) November 19, 2026 18:11
Spans are sampled, so the field sizes also go to distribution metrics.
Every feed response then counts in the aggregate. The span attributes
stay for per-trace diagnosis.
…d-field-size-telemetry

# Conflicts:
#	packages/junior/src/api/conversations/routes.ts
@BYK
BYK merged commit 85073e5 into main Nov 19, 2026
52 checks passed
@BYK
BYK deleted the feat/conversation-feed-field-size-telemetry branch November 19, 2026 19:02

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 2cf2ead0 Deployed Nov 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant