-
Notifications
You must be signed in to change notification settings - Fork 151
feat(frontend): traces ui #4038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: traces-storage
Are you sure you want to change the base?
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
More templates
@rivetkit/virtual-websocket
@rivetkit/cloudflare-workers
@rivetkit/db
@rivetkit/framework-base
@rivetkit/next-js
@rivetkit/react
rivetkit
@rivetkit/sql-loader
@rivetkit/traces
@rivetkit/workflow-engine
@rivetkit/engine-runner
@rivetkit/engine-runner-protocol
commit: |
PR Review: Traces UIThis PR adds a comprehensive tracing UI along with a queue inspector feature. Overall, the implementation is solid with good architectural decisions. Below are my findings: ✅ StrengthsArchitecture & Design
Code Quality
🔍 Issues & Recommendations1. Performance ConcernsCritical: Unbounded recursion in trace rendering (actor-traces.tsx:247-291)function renderItemsWithGaps(items: TraceItem[], depth: number, nowNs: bigint): ReactElement[]
const MAX_DEPTH = 20;
if (depth >= MAX_DEPTH) {
return [<div key="max-depth" className="text-xs text-muted-foreground ml-4">Max nesting depth reached...</div>];
}Memory: Large trace arrays kept in memory (actor-traces.tsx:113-119)const traceTree = useMemo(() => {
if (!queryResult) return [];
const spans = extractSpans(queryResult.otlp);
return buildSpanTree(spans);
}, [queryResult]);
Sorting performance (read-range.ts:129-133)records.sort((a, b) => {
if (a.absNs < b.absNs) return -1;
if (a.absNs > b.absNs) return 1;
return a.sequence - b.sequence;
});
2. Bug: Potential race condition in queue size updatesLocation: this.#actor.inspector.updateQueueSize(this.#metadata.size);
await this.#driver.kvBatchPut(this.#actor.id, [...]);
// Only update inspector after successful write
this.#actor.inspector.updateQueueSize(this.#metadata.size);3. Code Quality IssuesMissing null checks (actor-traces.tsx:463-464)const parentId = node.span.parentSpanId;
if (parentId && byId.has(parentId)) {
byId.get(parentId)?.children.push(node); // Optional chaining after has() check is redundant
}
if (parentId) {
const parent = byId.get(parentId);
if (parent) parent.children.push(node);
}Inconsistent error handling (actor-queue.tsx:32-38)if (queueStatusQuery.isError || !queueStatusQuery.data) {
return <div>Queue data is currently unavailable.</div>;
}
Magic numbers should be constants// actor-traces.tsx:102
refetchInterval: isLive ? 1000 : false,
4. Testing ConcernsNo tests for new functionality
Test cleanup improvement needed (test/mod.ts:83-85)c.onTestFinished(async () => {
await new Promise((resolve) => server.close(() => resolve(undefined)));
});
5. DocumentationMissing JSDoc comments
Changelog/migration notes needed
🔒 Security✅ Good practices observed:
|
846c70c to
7504a0b
Compare
4189086 to
389f28e
Compare
389f28e to
3c7fabc
Compare
PR Review: feat(frontend): traces uiOverviewThis PR adds a comprehensive traces UI to the frontend, replacing the events system with OpenTelemetry-based distributed tracing. The changes span across frontend components, RivetKit inspector protocol, and the traces package. Positive HighlightsArchitecture & Design
Code Quality
Issues & Concerns🔴 Critical Issues1. Missing Error Handling in CBOR Decoding (actor-inspector-context.tsx:738-750) cbor.decode(new Uint8Array(body.val.output))If the CBOR data is corrupted, this will throw and crash the message handler. Should wrap in try/catch like in read-range.ts:385-388. 2. Unbounded Memory Growth Risk (actor-traces.tsx:113-119)
3. Race Condition in Queue Size Updates (actor-inspector.ts:61-67) updateQueueSize(size: number) {
if (this.#lastQueueSize === size) return;
this.#lastQueueSize = size;
this.emitter.emit("queueUpdated");
}No synchronization mechanism. If called concurrently, could lead to inconsistent state or missed updates.
|
3c7fabc to
7dc3fdd
Compare
b18c3ae to
7e0a15d
Compare
7dc3fdd to
0232d12
Compare

No description provided.