Skip to content

Improve observability stream previews#1525

Merged
sorenbs merged 3 commits into
mainfrom
codex/evlog-preview-summary
Jun 12, 2026
Merged

Improve observability stream previews#1525
sorenbs merged 3 commits into
mainfrom
codex/evlog-preview-summary

Conversation

@sorenbs

@sorenbs sorenbs commented Jun 12, 2026

Copy link
Copy Markdown
Member

Summary

  • Render concise request-line previews for evlog streams instead of raw JSON in the Preview column.
  • Render concise OTEL trace previews from span semantic attributes, including request/span name, service, duration, and error status when available.
  • Keep generic JSON previews for streams without an observability profile-specific formatter.
  • Document the preview rules in FEATURES and stream-event architecture docs.
  • Add a patch changeset.

Verification

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

Summary by CodeRabbit

Release Notes

  • New Features

    • Event previews in stream browsing now display readable summaries (e.g., "GET /product/acme-mug" for requests) instead of raw JSON
    • Optimized preview formats for different stream types, including service/duration/error status for traces
    • Full JSON details remain available in expanded rows
  • Documentation

    • Updated stream event browsing documentation with new preview format guidance

Walkthrough

This PR adds profile-aware preview formatting for stream events. It introduces EVLOG and OTEL profile-aware preview builders (compact HTTP-style request summaries for evlog, concise span summaries for otel-traces) and integrates them into normalizeStreamEvents, normalizeStandaloneRoutingKeyEvents, and normalizeStreamSearchHits by passing stream.profile into createPreview. The stream input type now includes profile. Unit tests and documentation/changeset updates accompany the implementation.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: improving how stream previews are displayed in observability streams (evlog and OTEL traces) with concise summaries instead of raw JSON.
Description check ✅ Passed The description is directly related to the changeset, detailing the implementation of concise previews for evlog and OTEL trace streams, documentation updates, and verification steps.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/evlog-preview-summary
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch codex/evlog-preview-summary

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Compute preview deployed.

Branch: codex/evlog-preview-summary
Service: codex-evlog-preview-summary
Preview: https://cmqb75sak0d4y01dskg9oskxc.cdg.prisma.build
Version: https://cv-421be0452ef0.cdg.prisma.build

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ui/hooks/use-stream-events.ts`:
- Around line 260-264: The parsePreviewStatus wrapper is redundant; remove the
parsePreviewStatus function and update its call sites to use parsePreviewString
directly (e.g., replace parsePreviewStatus(...) with parsePreviewString(...));
ensure types remain string | null and behavior unchanged since
parsePreviewString already returns null for empty/compacted strings.
- Line 16: Duplicate constant STREAM_PROFILE_EVLOG is defined in
use-stream-events.ts; remove that local definition and import
STREAM_PROFILE_EVLOG from the module that already exports it
(use-stream-observe-request.ts). Update the top of use-stream-events.ts to
import { STREAM_PROFILE_EVLOG } and delete the const STREAM_PROFILE_EVLOG =
"evlog" declaration so the file uses the shared exported symbol.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 390c7635-b122-4d86-b167-44b077c39e82

📥 Commits

Reviewing files that changed from the base of the PR and between 63fa63b and a01e108.

📒 Files selected for processing (5)
  • .changeset/quiet-evlog-preview.md
  • Architecture/stream-event-view.md
  • FEATURES.md
  • ui/hooks/use-stream-events.test.tsx
  • ui/hooks/use-stream-events.ts

Comment thread ui/hooks/use-stream-events.ts Outdated
Comment thread ui/hooks/use-stream-events.ts Outdated
@sorenbs sorenbs changed the title Improve evlog stream previews Improve observability stream previews Jun 12, 2026
@sorenbs sorenbs enabled auto-merge (squash) June 12, 2026 17:48

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ui/hooks/use-stream-events.ts (1)

1077-1131: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Include stream.profile in event-query identity to avoid stale preview formats.

preview now depends on stream.profile (Line 1077, Line 1104, Line 1130), but the collection/query identity still excludes profile. If profile changes without a name/epoch change, getOrCreateRowsCollection(...) can reuse rows normalized under the old profile, so previews remain stale until a hard invalidation.

♻️ Suggested fix
 export function getStreamEventsQueryScopeKey(
   streamsUrl: string | undefined,
   stream: StudioStream | null | undefined,
   routingKey: string,
   pageSize: number,
   pageCount: number,
   visibleEventCount: bigint,
 ): string {
@@
   return [
     streamsUrl?.trim() ?? "",
     stream.name,
     String(stream.epoch),
+    String(stream.profile ?? ""),
     visibleEventCount.toString(),
     routingKey,
     String(pageSize),
     String(pageCount),
   ].join("::");
 }

 function getStreamSearchEventsQueryScopeKey(args: {
@@
   return [
     streamsUrl?.trim() ?? "",
     stream.name,
     String(stream.epoch),
+    String(stream.profile ?? ""),
     "search",
     searchQuery,
     searchSort.join(","),
     resolvedVisibleSearchResultCount.toString(),
     String(pageSize),
   ].join("::");
 }
     if (isSearchActive) {
       return [
         "streams",
         streamsUrl,
         "stream",
         stream.name,
         "epoch",
         stream.epoch,
+        "profile",
+        stream.profile ?? "",
         "search",
         normalizedSearchQuery,
@@
     if (isStandaloneRoutingKeyReadActive) {
       return [
         "streams",
         streamsUrl,
         "stream",
         stream.name,
         "epoch",
         stream.epoch,
+        "profile",
+        stream.profile ?? "",
         "routingKeyRead",
         normalizedRoutingKey,
@@
     return [
       "streams",
       streamsUrl,
       "stream",
       stream.name,
       "epoch",
       stream.epoch,
+      "profile",
+      stream.profile ?? "",
       "visibleEventCount",
       resolvedVisibleEventCount.toString(),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ui/hooks/use-stream-events.ts` around lines 1077 - 1131, The preview
generation in normalizeStreamEvents, normalizeStandaloneRoutingKeyEvents, and
normalizeStreamSearchHits uses stream.profile but the collection/query identity
used by getOrCreateRowsCollection(...) (and any cache/key used for storing
normalized rows) does not include profile, causing stale previews when profile
changes; fix by including stream.profile as part of the identity/key passed to
getOrCreateRowsCollection (and any related cache keys) so collections are
namespaced per profile, and update any where collection names or cache key
builders are created to incorporate the stream.profile value so normalized rows
and previews are regenerated when profile changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@ui/hooks/use-stream-events.ts`:
- Around line 1077-1131: The preview generation in normalizeStreamEvents,
normalizeStandaloneRoutingKeyEvents, and normalizeStreamSearchHits uses
stream.profile but the collection/query identity used by
getOrCreateRowsCollection(...) (and any cache/key used for storing normalized
rows) does not include profile, causing stale previews when profile changes; fix
by including stream.profile as part of the identity/key passed to
getOrCreateRowsCollection (and any related cache keys) so collections are
namespaced per profile, and update any where collection names or cache key
builders are created to incorporate the stream.profile value so normalized rows
and previews are regenerated when profile changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 212d206e-a245-494b-bcbd-9dbe1fc9cb8e

📥 Commits

Reviewing files that changed from the base of the PR and between a01e108 and 2241c8b.

📒 Files selected for processing (5)
  • .changeset/quiet-evlog-preview.md
  • Architecture/stream-event-view.md
  • FEATURES.md
  • ui/hooks/use-stream-events.test.tsx
  • ui/hooks/use-stream-events.ts

@sorenbs sorenbs merged commit e1583e5 into main Jun 12, 2026
3 checks passed
@sorenbs sorenbs deleted the codex/evlog-preview-summary branch June 12, 2026 17:55
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