Repository navigation
Traceid cross page pagination - #395
Merged
Merged
Conversation
thorrester
marked this pull request as ready for review
April 29, 2026 11:53
Dependency Review✅ No vulnerabilities or license issues found.Scanned Manifest Files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Short Summary
Adds deep-link trace navigation from evaluation records and workflows to the Observability dashboard, including a new Rust endpoint (
GET /scouter/trace/{id}/spans) that fetches a trace without time bounds so the UI can center its time window on the trace automatically. Alongside this, fixes a silent data loss bug where workflow trace links disappeared after paginating records, extracts a sharedDashboardTimeBarcomponent, and wires global refresh state coordination across evaluation dashboards.Context
Trace deep-link navigation — Previously, clicking a record or workflow in the evaluation dashboard had no way to jump to the associated trace in Observability. The blocker was that trace lookups require a time range, but the dashboard didn't know what range contained that specific trace. This PR adds
GET /opsml/api/scouter/trace/{id}/spansto the Rust server — no time bounds, just fetch by ID — then the+page.tsload function uses the root span's timestamp to derive a centered time window and pre-selects the trace to open the sidebar immediately on navigation. The trace link appears inEvalRecordContent,AgentEvalWorkflowContent, andTaskDetailView, all building the observability path by stripping/evaluationfrom the current URL._traceIdcross-page pagination fix —workflowPagewas a$derivedblock that rebuiltrecordTraceMapfrom the current record page only. Since records and workflows paginate independently, after the user paged records forward, any workflow referencing a record on the previous page silently lost its trace link. Fix: liftedrecordTraceMapto module-level$state, appended to it on eachhandleRecordPageChange, and reset it on full time-range refresh. Svelte 5 proxies Map mutations so the$derivedrecomputes correctly.DashboardTimeBarextraction — The refresh button + time range selector combo was duplicated inTraceDashboard.svelte. Extracted intoDashboardTimeBar.sveltewithselectedRange,refreshing,onRangeChange, andonRefreshprops.TraceDashboardnow uses it directly.Global refresh state — Added
isRefreshing,beginRefresh(), andendRefresh()totimeRangeState. Evaluation dashboards (AgentEvalDashboard,PromptEvalDashboard) now call these around every fetch so the global time bar can show a loading state without each dashboard managing it independently. Also preventstimeRangeState.refresh()from double-firing if already in progress.PromptEvalDashboardrange-change detection — The previous detection comparedmonitoringData.selectedTimeRangeto the new range, but that field gets mutated by the same effect, creating an unreliable comparison. Replaced with a stablelastSeenRangesnapshot (same fix applied toAgentEvalDashboardin an earlier commit). Also removed the floating "Syncing..." overlay — the global refresh state handles this now.ComparisonView.sveltestring rendering — Plain string expected/actual values were being routed through a JSONCodeBlock, which escaped and syntax-highlighted them as JSON. Strings now render as<span class="font-mono whitespace-pre-wrap">and only objects go throughCodeBlock.isPromptCardcomparison fix — The type guard was using===againstRegistryType.Prompt(a lowercase string enum), butcard.registry_typecoming from the API could have different casing depending on serialization. Changed toString(card.registry_type).toLowerCase() === RegistryType.Prompt.Mock mode for task loading —
AgentEvalWorkflowContentwas gating mock task data withimport { dev } from '$app/environment', which means it only worked in dev builds, not when the mock toggle was on in production-like environments. Changed todevMockStore.enabled.src/core/scouter/trace/route.rsGET /scouter/trace/{id}/spansendpoint, registered in routersrc/lib/components/utils/DashboardTimeBar.sveltesrc/lib/components/utils/timeState.svelte.tsisRefreshing,beginRefresh(),endRefresh()src/lib/components/card/agent/evaluation/AgentEvalDashboard.svelterecordTraceMap,beginRefresh/endRefreshwiring, style fixessrc/lib/components/card/prompt/PromptEvalDashboard.sveltelastSeenRange, removed floating overlay, refresh wiringsrc/lib/components/trace/TraceDashboard.svelteDashboardTimeBar, passesinitialTrace/initialTraceSpans, stripstrace_idparam on refreshsrc/lib/components/trace/utils.tsgetServerTraceSpansById,traceListItemFromSpanshelpersroutes/api/scouter/observability/trace/[id]/spans/+server.tsroutes/.../observability/+page.ts?trace_id=param, derives centered time windowsrc/lib/components/scouter/agent/record/EvalRecordContent.sveltesrc/lib/components/scouter/agent/workflow/AgentEvalWorkflowContent.sveltetraceId+ observability path through toTaskDetailView, switches todevMockStoresrc/lib/components/scouter/agent/task/TaskDetailView.sveltesrc/lib/components/scouter/agent/task/ComparisonView.sveltesrc/lib/components/card/card_interfaces/promptcard.tsisPromptCardregistry type comparisonsrc/lib/components/scouter/dashboard/utils.test.tsrefreshAgentMonitoringDatamock and time-range behaviorsrc/lib/components/utils/DashboardTimeBar.test.tssrc/lib/components/utils/timeState.test.tsIs this a Breaking Change?
No. The new Rust endpoint is additive. All existing TypeScript types are extended with optional fields (
_traceId?: string,trace_id?: string,initialTrace?,initialTraceSpans?) and no existing prop signatures changed. TheDashboardTimeBarextraction doesn't affect any other callers sinceTimeRangeFilteris still exported. TheisPromptCardfix changes behavior only for cards where the API returns non-lowercaseregistry_type, which was already broken.