The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
sorting defaults search on issues, links, ids on exceptions...
ddux4f4dc925fed5
diff --git a/backend/app/controllers/clientcontrollers/client.controller.go b/backend/app/controllers/clientcontrollers/client.controller.goindex 603a02ea..e042fe30 100644--- a/backend/app/controllers/clientcontrollers/client.controller.go+++ b/backend/app/controllers/clientcontrollers/client.controller.go@@ -12,6 +12,7 @@ import ("strings""github.com/gin-gonic/gin"+ "github.com/google/uuid")type clientController struct{}@@ -59,7 +60,8 @@ func (e clientController) Report(c *gin.Context) {}for _, cst := range cf.StackTraces {- est := cst.ToExceptionStackTrace(computeExceptionHash(cst.StackTrace), request.AppVersion, request.ServerName)+ est := cst.ToExceptionStackTrace(computeExceptionHash(cst.StackTrace, cst.IsMessage), request.AppVersion, request.ServerName)+ est.Id = uuid.New().String()est.ProjectId = projectIdexceptionStackTraceToInsert = append(exceptionStackTraceToInsert, est)}@@ -120,40 +122,43 @@ var (newlinesRe = regexp.MustCompile(`\n+`))-func computeExceptionHash(stackTrace string) string {+func computeExceptionHash(stackTrace string, isMessage bool) string {normalized := stackTrace- // Remove the error message content (keep just the error type)- normalized = errorMessageRe.ReplaceAllString(normalized, "$1")+ if !isMessage {+ // Only normalize for actual exceptions, not messages+ // Remove the error message content (keep just the error type)+ normalized = errorMessageRe.ReplaceAllString(normalized, "$1")- // Remove absolute paths, keep just filename:line- normalized = absolutePathRe.ReplaceAllString(normalized, "$1")+ // Remove absolute paths, keep just filename:line+ normalized = absolutePathRe.ReplaceAllString(normalized, "$1")- // Remove version numbers from module paths- normalized = versionRe.ReplaceAllString(normalized, "")+ // Remove version numbers from module paths+ normalized = versionRe.ReplaceAllString(normalized, "")- // Replace hex addresses/pointers- normalized = hexRe.ReplaceAllString(normalized, "<hex>")+ // Replace hex addresses/pointers+ normalized = hexRe.ReplaceAllString(normalized, "<hex>")- // Replace UUIDs- normalized = uuidRe.ReplaceAllString(normalized, "<uuid>")+ // Replace UUIDs+ normalized = uuidRe.ReplaceAllString(normalized, "<uuid>")- // Replace standalone large numbers (likely IDs, not line numbers)- // Since Go doesn't support lookbehind, we preserve the surrounding characters- normalized = largeNumberRe.ReplaceAllString(normalized, "${1}<id>${3}")+ // Replace standalone large numbers (likely IDs, not line numbers)+ // Since Go doesn't support lookbehind, we preserve the surrounding characters+ normalized = largeNumberRe.ReplaceAllString(normalized, "${1}<id>${3}")- // Replace email addresses- normalized = emailRe.ReplaceAllString(normalized, "<email>")+ // Replace email addresses+ normalized = emailRe.ReplaceAllString(normalized, "<email>")- // Replace IP addresses- normalized = ipRe.ReplaceAllString(normalized, "<ip>")+ // Replace IP addresses+ normalized = ipRe.ReplaceAllString(normalized, "<ip>")- // Normalize goroutine numbers- normalized = goroutineRe.ReplaceAllString(normalized, "goroutine <n>")+ // Normalize goroutine numbers+ normalized = goroutineRe.ReplaceAllString(normalized, "goroutine <n>")- // Normalize whitespace- normalized = spacesRe.ReplaceAllString(normalized, " ")- normalized = newlinesRe.ReplaceAllString(normalized, "\n")+ // Normalize whitespace+ normalized = spacesRe.ReplaceAllString(normalized, " ")+ normalized = newlinesRe.ReplaceAllString(normalized, "\n")+ }// Compute SHA-256 and return first 16 hex charactersnormalized = strings.TrimSpace(normalized)diff --git a/backend/app/controllers/dashboard.controller.go b/backend/app/controllers/dashboard.controller.goindex 95be0a30..1e15a58b 100644--- a/backend/app/controllers/dashboard.controller.go+++ b/backend/app/controllers/dashboard.controller.go@@ -25,7 +25,7 @@ func (d dashboardController) GetDashboardOverview(c *gin.Context) {start := now.Add(-24 * time.Hour)// Get last 10 issues in the last 24 hours- recentIssues, _, err := repositories.ExceptionStackTraceRepository.FindGrouped(c, projectId, start, now, 1, 10, "last_seen", "", false)+ recentIssues, _, err := repositories.ExceptionStackTraceRepository.FindGrouped(c, projectId, start, now, 1, 10, "last_seen", "", "", false)if err != nil {panic(err)}diff --git a/backend/app/controllers/endpoint_detail.controller.go b/backend/app/controllers/endpoint_detail.controller.goindex 541d99c4..e9ccfc2b 100644--- a/backend/app/controllers/endpoint_detail.controller.go+++ b/backend/app/controllers/endpoint_detail.controller.go@@ -20,11 +20,20 @@ type EndpointExceptionInfo struct {RecordedAt string `json:"recordedAt"`}+type EndpointMessageInfo struct {+ Id string `json:"id"`+ ExceptionHash string `json:"exceptionHash"`+ StackTrace string `json:"stackTrace"`+ RecordedAt string `json:"recordedAt"`+ Scope map[string]string `json:"scope,omitempty"`+}+type EndpointDetailResponse struct {Endpoint *models.Endpoint `json:"endpoint"`Segments []models.Segment `json:"segments"`HasSegments bool `json:"hasSegments"`Exception *EndpointExceptionInfo `json:"exception,omitempty"`+ Messages []EndpointMessageInfo `json:"messages"`}func (c endpointDetailController) GetEndpointDetail(ctx *gin.Context) {@@ -53,25 +62,45 @@ func (c endpointDetailController) GetEndpointDetail(ctx *gin.Context) {panic(err)}- // Get linked exception if any+ // Get all linked exceptions and messagesvar exceptionInfo *EndpointExceptionInfo- exception, err := repositories.ExceptionStackTraceRepository.FindByTransactionId(ctx, request.ProjectId, endpointId)+ var messages []EndpointMessageInfo++ allExceptions, err := repositories.ExceptionStackTraceRepository.FindAllByTransactionId(ctx, request.ProjectId, endpointId)if err != nil {panic(err)}- if exception != nil {- exceptionInfo = &EndpointExceptionInfo{- ExceptionHash: exception.ExceptionHash,- StackTrace: exception.StackTrace,- RecordedAt: exception.RecordedAt.Format("2006-01-02T15:04:05Z07:00"),++ for _, exc := range allExceptions {+ if exc.IsMessage {+ // Add to messages list+ messages = append(messages, EndpointMessageInfo{+ Id: exc.Id,+ ExceptionHash: exc.ExceptionHash,+ StackTrace: exc.StackTrace,+ RecordedAt: exc.RecordedAt.Format("2006-01-02T15:04:05Z07:00"),+ Scope: exc.Scope,+ })+ } else if exceptionInfo == nil {+ // Only take the first actual exception+ exceptionInfo = &EndpointExceptionInfo{+ ExceptionHash: exc.ExceptionHash,+ StackTrace: exc.StackTrace,+ RecordedAt: exc.RecordedAt.Format("2006-01-02T15:04:05Z07:00"),+ }}}+ if messages == nil {+ messages = []EndpointMessageInfo{}+ }+ctx.JSON(http.StatusOK, EndpointDetailResponse{Endpoint: endpoint,Segments: segments,HasSegments: len(segments) > 0,Exception: exceptionInfo,+ Messages: messages,})}diff --git a/backend/app/controllers/exception_stack_trace.controller.go b/backend/app/controllers/exception_stack_trace.controller.goindex 50b6bc15..7bf68208 100644--- a/backend/app/controllers/exception_stack_trace.controller.go+++ b/backend/app/controllers/exception_stack_trace.controller.go@@ -19,6 +19,7 @@ type ExceptionSearchRequest struct {OrderBy string `json:"orderBy"`Pagination PaginationParams `json:"pagination"`Search string `json:"search"`+ SearchType string `json:"searchType"`IncludeArchived bool `json:"includeArchived"`}@@ -45,7 +46,7 @@ func (e exceptionStackTraceController) FindGrouppedExceptionStackTraces(c *gin.Creturn}- exceptions, total, err := repositories.ExceptionStackTraceRepository.FindGrouped(c, request.ProjectId, request.FromDate, request.ToDate, request.Pagination.Page, request.Pagination.PageSize, request.OrderBy, request.Search, request.IncludeArchived)+ exceptions, total, err := repositories.ExceptionStackTraceRepository.FindGrouped(c, request.ProjectId, request.FromDate, request.ToDate, request.Pagination.Page, request.Pagination.PageSize, request.OrderBy, request.Search, request.SearchType, request.IncludeArchived)if err != nil {panic(err)}@@ -161,4 +162,31 @@ func (e exceptionStackTraceController) UnarchiveExceptions(c *gin.Context) {c.JSON(http.StatusOK, gin.H{"unarchived": len(request.Hashes)})}+func (e exceptionStackTraceController) FindById(c *gin.Context) {+ exceptionId := c.Param("exceptionId")+ if exceptionId == "" {+ c.JSON(http.StatusBadRequest, gin.H{"error": "exception id is required"})+ return+ }++ var request struct {+ ProjectId string `json:"projectId"`+ }+ if err := c.ShouldBindJSON(&request); err != nil {+ c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})+ return+ }++ exception, err := repositories.ExceptionStackTraceRepository.FindById(c, request.ProjectId, exceptionId)+ if err != nil {+ if errors.Is(err, repositories.ErrExceptionNotFound) {+ c.JSON(http.StatusNotFound, gin.H{"error": "Exception not found"})+ return+ }+ panic(err)+ }++ c.JSON(http.StatusOK, gin.H{"exception": exception})+}+var ExceptionStackTraceController = exceptionStackTraceController{}diff --git a/backend/app/controllers/routes.go b/backend/app/controllers/routes.goindex 0247bf66..e9651dd7 100644--- a/backend/app/controllers/routes.go+++ b/backend/app/controllers/routes.go@@ -55,6 +55,7 @@ func RegisterControllers(router *gin.RouterGroup) {router.POST("/exception-stack-traces", middleware.UseAppAuth, ExceptionStackTraceController.FindGrouppedExceptionStackTraces)router.POST("/exception-stack-traces/archive", middleware.UseAppAuth, ExceptionStackTraceController.ArchiveExceptions)router.POST("/exception-stack-traces/unarchive", middleware.UseAppAuth, ExceptionStackTraceController.UnarchiveExceptions)+ router.POST("/exception-stack-traces/by-id/:exceptionId", middleware.UseAppAuth, ExceptionStackTraceController.FindById)router.POST("/exception-stack-traces/:hash", middleware.UseAppAuth, ExceptionStackTraceController.FindByHash)// Authdiff --git a/backend/app/migrations/ch/0024_add_id_to_exception_stack_traces.up.sql b/backend/app/migrations/ch/0024_add_id_to_exception_stack_traces.up.sqlnew file mode 100644index 00000000..725e0ffe--- /dev/null+++ b/backend/app/migrations/ch/0024_add_id_to_exception_stack_traces.up.sql@@ -0,0 +1 @@+ALTER TABLE exception_stack_traces ADD COLUMN id String DEFAULT ''diff --git a/backend/app/models/exception_stack_trace.model.go b/backend/app/models/exception_stack_trace.model.goindex 103ad0c6..73a3582b 100644--- a/backend/app/models/exception_stack_trace.model.go+++ b/backend/app/models/exception_stack_trace.model.go@@ -3,6 +3,7 @@ package modelsimport "time"type ExceptionStackTrace struct {+ Id string `json:"id" ch:"id"`ProjectId string `json:"projectId" ch:"project_id"`TransactionId *string `json:"transactionId" ch:"transaction_id"`TransactionType string `json:"transactionType" ch:"transaction_type"` // "endpoint" or "task"diff --git a/backend/app/repositories/exception_stack_trace.repository.go b/backend/app/repositories/exception_stack_trace.repository.goindex c96cb782..d96b898f 100644--- a/backend/app/repositories/exception_stack_trace.repository.go+++ b/backend/app/repositories/exception_stack_trace.repository.go@@ -6,6 +6,7 @@ import ("context""encoding/json""errors"+ "strings""time""github.com/ClickHouse/clickhouse-go/v2"@@ -16,7 +17,7 @@ var ErrExceptionNotFound = errors.New("exception not found")type exceptionStackTraceRepository struct{}func (e *exceptionStackTraceRepository) InsertAsync(ctx context.Context, lines []models.ExceptionStackTrace) error {- batch, err := (*chdb.Conn).PrepareBatch(clickhouse.Context(context.Background(), clickhouse.WithAsync(false)), "INSERT INTO exception_stack_traces (project_id, transaction_id, transaction_type, exception_hash, stack_trace, recorded_at, scope, app_version, server_name, is_message)")+ batch, err := (*chdb.Conn).PrepareBatch(clickhouse.Context(context.Background(), clickhouse.WithAsync(false)), "INSERT INTO exception_stack_traces (id, project_id, transaction_id, transaction_type, exception_hash, stack_trace, recorded_at, scope, app_version, server_name, is_message)")if err != nil {return err}@@ -35,7 +36,7 @@ func (e *exceptionStackTraceRepository) InsertAsync(ctx context.Context, lines [if transactionType == "" {transactionType = "endpoint"}- if err := batch.Append(est.ProjectId, est.TransactionId, transactionType, est.ExceptionHash, est.StackTrace, est.RecordedAt, scopeJSON, est.AppVersion, est.ServerName, isMessage); err != nil {+ if err := batch.Append(est.Id, est.ProjectId, est.TransactionId, transactionType, est.ExceptionHash, est.StackTrace, est.RecordedAt, scopeJSON, est.AppVersion, est.ServerName, isMessage); err != nil {return err}}@@ -48,9 +49,16 @@ func (e *exceptionStackTraceRepository) CountBetween(ctx context.Context, projecreturn int64(count), err}-func (e *exceptionStackTraceRepository) FindGrouped(ctx context.Context, projectId string, fromDate, toDate time.Time, page, pageSize int, orderBy string, search string, includeArchived bool) ([]models.ExceptionGroup, int64, error) {+func (e *exceptionStackTraceRepository) FindGrouped(ctx context.Context, projectId string, fromDate, toDate time.Time, page, pageSize int, orderBy string, search string, searchType string, includeArchived bool) ([]models.ExceptionGroup, int64, error) {offset := (page - 1) * pageSize+ // Parse sort direction from orderBy (e.g., "last_seen_asc" -> "last_seen", "ASC")+ sortDirection := "DESC"+ if strings.HasSuffix(orderBy, "_asc") {+ orderBy = strings.TrimSuffix(orderBy, "_asc")+ sortDirection = "ASC"+ }+allowedOrderBy := map[string]bool{"last_seen": true,"first_seen": true,@@ -70,6 +78,14 @@ func (e *exceptionStackTraceRepository) FindGrouped(ctx context.Context, projectargs = append(args, search)}+ // Add searchType filter+ if searchType == "issues" {+ whereClause += " AND e.is_message = 0"+ } else if searchType == "messages" {+ whereClause += " AND e.is_message = 1"+ }+ // "all" or empty = no filter+// Build HAVING clause for archive filtering// Show exceptions if: not archived OR last occurrence is after archive timehavingClause := ""@@ -107,7 +123,7 @@ func (e *exceptionStackTraceRepository) FindGrouped(ctx context.Context, project` + archiveSubquery + `WHERE ` + whereClause + `GROUP BY e.exception_hash` + havingClause + `- ORDER BY ` + orderBy + ` DESC LIMIT ? OFFSET ?`+ ORDER BY ` + orderBy + ` ` + sortDirection + ` LIMIT ? OFFSET ?`queryArgs := append([]interface{}{projectId}, args...)queryArgs = append(queryArgs, pageSize, offset)@@ -144,7 +160,7 @@ func (e *exceptionStackTraceRepository) FindByHash(ctx context.Context, projectI// Get individual occurrences with pagination (including scope)rows, err := (*chdb.Conn).Query(ctx,- "SELECT project_id, transaction_id, transaction_type, exception_hash, stack_trace, recorded_at, scope, app_version, server_name, is_message FROM exception_stack_traces WHERE project_id = ? AND exception_hash = ? ORDER BY recorded_at DESC LIMIT ? OFFSET ?",+ "SELECT id, project_id, transaction_id, transaction_type, exception_hash, stack_trace, recorded_at, scope, app_version, server_name, is_message FROM exception_stack_traces WHERE project_id = ? AND exception_hash = ? ORDER BY recorded_at DESC LIMIT ? OFFSET ?",projectId, exceptionHash, pageSize, offset)if err != nil {return nil, nil, 0, err@@ -156,7 +172,7 @@ func (e *exceptionStackTraceRepository) FindByHash(ctx context.Context, projectIvar o models.ExceptionStackTracevar scopeJSON stringvar isMessage uint8- if err := rows.Scan(&o.ProjectId, &o.TransactionId, &o.TransactionType, &o.ExceptionHash, &o.StackTrace, &o.RecordedAt, &scopeJSON, &o.AppVersion, &o.ServerName, &isMessage); err != nil {+ if err := rows.Scan(&o.Id, &o.ProjectId, &o.TransactionId, &o.TransactionType, &o.ExceptionHash, &o.StackTrace, &o.RecordedAt, &scopeJSON, &o.AppVersion, &o.ServerName, &isMessage); err != nil {return nil, nil, 0, err}o.IsMessage = isMessage == 1@@ -312,12 +328,12 @@ func (e *exceptionStackTraceRepository) FindByTransactionId(ctx context.Context,var isMessage uint8err := (*chdb.Conn).QueryRow(ctx,- `SELECT project_id, transaction_id, transaction_type, exception_hash, stack_trace, recorded_at, scope, app_version, server_name, is_message+ `SELECT id, project_id, transaction_id, transaction_type, exception_hash, stack_trace, recorded_at, scope, app_version, server_name, is_messageFROM exception_stack_tracesWHERE project_id = ? AND transaction_id = ?LIMIT 1`,projectId, transactionId).Scan(- &est.ProjectId, &est.TransactionId, &est.TransactionType, &est.ExceptionHash, &est.StackTrace,+ &est.Id, &est.ProjectId, &est.TransactionId, &est.TransactionType, &est.ExceptionHash, &est.StackTrace,&est.RecordedAt, &scopeJSON, &est.AppVersion, &est.ServerName, &isMessage)if err != nil {@@ -336,4 +352,71 @@ func (e *exceptionStackTraceRepository) FindByTransactionId(ctx context.Context,return &est, nil}+// FindAllByTransactionId returns all exceptions and messages associated with a specific transaction+func (e *exceptionStackTraceRepository) FindAllByTransactionId(ctx context.Context, projectId string, transactionId string) ([]models.ExceptionStackTrace, error) {+ rows, err := (*chdb.Conn).Query(ctx,+ `SELECT id, project_id, transaction_id, transaction_type, exception_hash, stack_trace, recorded_at, scope, app_version, server_name, is_message+ FROM exception_stack_traces+ WHERE project_id = ? AND transaction_id = ?+ ORDER BY recorded_at ASC`,+ projectId, transactionId)++ if err != nil {+ return nil, err+ }+ defer rows.Close()++ var results []models.ExceptionStackTrace+ for rows.Next() {+ var est models.ExceptionStackTrace+ var scopeJSON string+ var isMessage uint8++ if err := rows.Scan(&est.Id, &est.ProjectId, &est.TransactionId, &est.TransactionType, &est.ExceptionHash, &est.StackTrace,+ &est.RecordedAt, &scopeJSON, &est.AppVersion, &est.ServerName, &isMessage); err != nil {+ return nil, err+ }++ est.IsMessage = isMessage == 1+ if scopeJSON != "" && scopeJSON != "{}" {+ if err := json.Unmarshal([]byte(scopeJSON), &est.Scope); err != nil {+ est.Scope = nil+ }+ }+ results = append(results, est)+ }++ return results, nil+}++// FindById returns a single exception by its ID+func (e *exceptionStackTraceRepository) FindById(ctx context.Context, projectId string, id string) (*models.ExceptionStackTrace, error) {+ var est models.ExceptionStackTrace+ var scopeJSON string+ var isMessage uint8++ err := (*chdb.Conn).QueryRow(ctx,+ `SELECT id, project_id, transaction_id, transaction_type, exception_hash, stack_trace, recorded_at, scope, app_version, server_name, is_message+ FROM exception_stack_traces+ WHERE project_id = ? AND id = ?+ LIMIT 1`,+ projectId, id).Scan(+ &est.Id, &est.ProjectId, &est.TransactionId, &est.TransactionType, &est.ExceptionHash, &est.StackTrace,+ &est.RecordedAt, &scopeJSON, &est.AppVersion, &est.ServerName, &isMessage)++ if err != nil {+ return nil, ErrExceptionNotFound+ }++ est.IsMessage = isMessage == 1+ // Parse scope JSON+ if scopeJSON != "" && scopeJSON != "{}" {+ if err := json.Unmarshal([]byte(scopeJSON), &est.Scope); err != nil {+ est.Scope = nil+ }+ }++ return &est, nil+}+var ExceptionStackTraceRepository = exceptionStackTraceRepository{}diff --git a/frontend/src/lib/components/app-sidebar.svelte b/frontend/src/lib/components/app-sidebar.svelteindex 5f1c9350..8e094cb9 100644--- a/frontend/src/lib/components/app-sidebar.svelte+++ b/frontend/src/lib/components/app-sidebar.svelte@@ -1,19 +1,18 @@<script lang="ts">import * as Sidebar from "$lib/components/ui/sidebar";import { useSidebar } from '$lib/components/ui/sidebar';- import { Bug, Link2, ChartLine } from "@lucide/svelte";+ import { Bug, Link2, ChartNoAxesCombined, ChartNoAxesGantt, Gauge, ListEnd } from "@lucide/svelte";import { themeState } from '$lib/state/theme.svelte';import { LayoutDashboard } from "@lucide/svelte";import { page } from '$app/state';import { createRowClickHandler } from "$lib/utils/navigation";- import { Gauge, ListTodo } from "lucide-svelte";const sidebarItems = [{Icon: LayoutDashboard, href: "/", title: "Dashboard", stickyParams: [] as string[]},{Icon: Bug, href: "/issues", title: "Issues", stickyParams: [] as string[]},{Icon: Gauge, href: "/endpoints", title: "Endpoints", stickyParams: ['presets', 'from', 'to']},- {Icon: ListTodo, href: "/tasks", title: "Tasks", stickyParams: ['presets', 'from', 'to']},- {Icon: ChartLine, href: "/metrics", title: "Metrics", stickyParams: ['presets', 'from', 'to']},+ {Icon: ListEnd, href: "/tasks", title: "Tasks", stickyParams: ['presets', 'from', 'to']}, // ChartNoAxesGantt+ {Icon: ChartNoAxesCombined, href: "/metrics", title: "Metrics", stickyParams: ['presets', 'from', 'to']},{Icon: Link2, href: "/connection", title: "Connection", stickyParams: [] as string[]},]diff --git a/frontend/src/lib/components/issues/events-table.svelte b/frontend/src/lib/components/issues/events-table.svelteindex e151b1a2..8e2c7fef 100644--- a/frontend/src/lib/components/issues/events-table.svelte+++ b/frontend/src/lib/components/issues/events-table.svelte@@ -15,7 +15,7 @@total: number;hasMore?: boolean;showViewAll?: boolean;- currentRecordedAt?: string;+ currentExceptionId?: string;timezone?: string;}@@ -25,18 +25,18 @@total,hasMore = false,showViewAll = true,- currentRecordedAt,+ currentExceptionId,timezone}: Props = $props();const tz = $derived(timezone ?? getTimezone());function getRowUrl(occurrence: ExceptionOccurrence): string {- return `/issues/${exceptionHash}/${encodeURIComponent(occurrence.recordedAt)}`;+ return `/issues/${exceptionHash}/${occurrence.id}`;}function isCurrentEvent(occurrence: ExceptionOccurrence): boolean {- return currentRecordedAt !== undefined && occurrence.recordedAt === currentRecordedAt;+ return currentExceptionId !== undefined && occurrence.id === currentExceptionId;}</script>diff --git a/frontend/src/lib/components/ui/time-range-picker/time-range-picker.svelte b/frontend/src/lib/components/ui/time-range-picker/time-range-picker.svelteindex 18801427..1fc9db62 100644--- a/frontend/src/lib/components/ui/time-range-picker/time-range-picker.svelte+++ b/frontend/src/lib/components/ui/time-range-picker/time-range-picker.svelte@@ -32,7 +32,7 @@toDate = $bindable(today(getLocalTimeZone())),fromTime = $bindable('00:00'),toTime = $bindable('23:59'),- preset = $bindable<string | null>('6h'),+ preset = $bindable<string | null>('24h'),timezone,onApply}: Props = $props();diff --git a/frontend/src/lib/types/exceptions.ts b/frontend/src/lib/types/exceptions.tsindex f651dc53..129e0e58 100644--- a/frontend/src/lib/types/exceptions.ts+++ b/frontend/src/lib/types/exceptions.ts@@ -7,6 +7,7 @@ export type ExceptionGroup = {};export type ExceptionOccurrence = {+ id: string;transactionId: string | null;transactionType: 'endpoint' | 'task';exceptionHash: string;diff --git a/frontend/src/lib/types/segments.ts b/frontend/src/lib/types/segments.tsindex 9e92b5a1..60e7ea55 100644--- a/frontend/src/lib/types/segments.ts+++ b/frontend/src/lib/types/segments.ts@@ -28,9 +28,18 @@ export type ExceptionInfo = {recordedAt: string;};+export type MessageInfo = {+ id: string;+ exceptionHash: string;+ stackTrace: string;+ recordedAt: string;+ scope?: Record<string, string>;+};+export type TransactionDetailResponse = {- transaction: TransactionDetail;+ endpoint: TransactionDetail;segments: Segment[];hasSegments: boolean;exception?: ExceptionInfo;+ messages: MessageInfo[];};diff --git a/frontend/src/lib/utils/sort-storage.ts b/frontend/src/lib/utils/sort-storage.tsnew file mode 100644index 00000000..0b96a1b2--- /dev/null+++ b/frontend/src/lib/utils/sort-storage.ts@@ -0,0 +1,54 @@+import { browser } from '$app/environment';++export type SortDirection = 'asc' | 'desc';++export type SortState = {+ field: string;+ direction: SortDirection;+};++const STORAGE_PREFIX = 'traceway_sort_';++export function getSortState(pageKey: string, defaultState: SortState): SortState {+ if (!browser) return defaultState;++ try {+ const stored = localStorage.getItem(`${STORAGE_PREFIX}${pageKey}`);+ if (stored) {+ const parsed = JSON.parse(stored);+ if (parsed.field && (parsed.direction === 'asc' || parsed.direction === 'desc')) {+ return parsed;+ }+ }+ } catch {+ // Ignore parse errors, return default+ }++ return defaultState;+}++export function setSortState(pageKey: string, state: SortState): void {+ if (!browser) return;++ try {+ localStorage.setItem(`${STORAGE_PREFIX}${pageKey}`, JSON.stringify(state));+ } catch {+ // Ignore storage errors+ }+}++export function toggleSortDirection(current: SortDirection): SortDirection {+ return current === 'asc' ? 'desc' : 'asc';+}++export function handleSortClick(+ field: string,+ currentField: string,+ currentDirection: SortDirection,+ defaultDirection: SortDirection = 'desc'+): SortState {+ if (field === currentField) {+ return { field, direction: toggleSortDirection(currentDirection) };+ }+ return { field, direction: defaultDirection };+}diff --git a/frontend/src/lib/utils/url-params.ts b/frontend/src/lib/utils/url-params.tsindex a26b0d3d..3a9dcdab 100644--- a/frontend/src/lib/utils/url-params.ts+++ b/frontend/src/lib/utils/url-params.ts@@ -37,7 +37,7 @@ export type TimeRangeParams = {to: Date | null;};-export function parseTimeRangeFromUrl(timezone: string, defaultPreset = '6h'): TimeRangeParams {+export function parseTimeRangeFromUrl(timezone: string, defaultPreset = '24h'): TimeRangeParams {if (!browser) return { preset: defaultPreset, from: null, to: null };const params = new URLSearchParams(window.location.search);@@ -94,6 +94,7 @@ export function updateUrl(const newUrl = `${window.location.pathname}?${urlParams.toString()}`;+ // eslint-disable-next-line svelte/no-navigation-without-resolvegoto(newUrl, {replaceState: !pushToHistory,noScroll: true,diff --git a/frontend/src/routes/endpoints/+page.svelte b/frontend/src/routes/endpoints/+page.svelteindex 7cd1cea3..a4e309c4 100644--- a/frontend/src/routes/endpoints/+page.svelte+++ b/frontend/src/routes/endpoints/+page.svelte@@ -26,6 +26,12 @@getResolvedTimeRange,updateUrl} from '$lib/utils/url-params';+ import {+ getSortState,+ setSortState,+ handleSortClick,+ type SortDirection+ } from '$lib/utils/sort-storage';const timezone = $derived(getTimezone());@@ -39,7 +45,6 @@};type SortField = 'count' | 'p50_duration' | 'p95_duration' | 'last_seen' | 'impact';- type SortDirection = 'asc' | 'desc';let endpoints = $state<EndpointStats[]>([]);let loading = $state(true);@@ -87,9 +92,11 @@loadData(false);}- // Sorting - default to impact descending- let orderBy = $state<SortField>('impact');- let sortDirection = $state<SortDirection>('desc');+ // Sorting - persisted to localStorage+ const SORT_STORAGE_KEY = 'endpoints';+ const initialSort = getSortState(SORT_STORAGE_KEY, { field: 'impact', direction: 'desc' });+ let orderBy = $state<SortField>(initialSort.field as SortField);+ let sortDirection = $state<SortDirection>(initialSort.direction);// Page size optionsconst pageSizeOptions = [@@ -191,16 +198,12 @@}function handleSort(field: SortField) {- if (orderBy === field) {- // Toggle direction if clicking the same field- sortDirection = sortDirection === 'desc' ? 'asc' : 'desc';- } else {- // New field, default to descending- orderBy = field;- sortDirection = 'desc';- }+ const newSort = handleSortClick(field, orderBy, sortDirection);+ orderBy = newSort.field as SortField;+ sortDirection = newSort.direction;+ setSortState(SORT_STORAGE_KEY, newSort);page = 1;- loadData(false); // Don't push to history for sorting+ loadData(false);}onMount(() => {@@ -267,6 +270,7 @@<TracewayTableHeaderlabel="Endpoint"tooltip="The API route or page being accessed"+ class="max-w-[50%]"/><TracewayTableHeaderlabel="Calls"@@ -314,7 +318,7 @@class="cursor-pointer hover:bg-muted/50"onclick={createRowClickHandler(resolve(`/endpoints/${encodeURIComponent(endpoint.endpoint)}`), 'preset', 'from', 'to')}>- <Table.Cell class="font-mono text-sm">+ <Table.Cell class="font-mono text-sm max-w-[50%] break-all whitespace-normal">{endpoint.endpoint}</Table.Cell><Table.Cell class="tabular-nums">diff --git a/frontend/src/routes/endpoints/[endpoint]/+page.svelte b/frontend/src/routes/endpoints/[endpoint]/+page.svelteindex e3995b4f..6635b08a 100644--- a/frontend/src/routes/endpoints/[endpoint]/+page.svelte+++ b/frontend/src/routes/endpoints/[endpoint]/+page.svelte@@ -25,6 +25,12 @@dateToTimeString,updateUrl} from '$lib/utils/url-params';+ import {+ getSortState,+ setSortState,+ handleSortClick,+ type SortDirection+ } from '$lib/utils/sort-storage';const timezone = $derived(getTimezone());@@ -53,7 +59,6 @@};type SortField = 'recorded_at' | 'duration' | 'status_code' | 'body_size';- type SortDirection = 'asc' | 'desc';let { data } = $props();@@ -87,9 +92,9 @@}}- // Default to 6h preset- const range = getTimeRangeFromPreset('6h', timezone);- return { preset: '6h', from: range.from, to: range.to };+ // Default to 24h preset+ const range = getTimeRangeFromPreset('24h', timezone);+ return { preset: '24h', from: range.from, to: range.to };}const initialRange = getInitialRange();@@ -110,9 +115,11 @@);}- // Sorting State- let orderBy = $state<SortField>('recorded_at');- let sortDirection = $state<SortDirection>('desc');+ // Sorting State - persisted to localStorage+ const SORT_STORAGE_KEY = 'endpoint_detail';+ const initialSort = getSortState(SORT_STORAGE_KEY, { field: 'recorded_at', direction: 'desc' });+ let orderBy = $state<SortField>(initialSort.field as SortField);+ let sortDirection = $state<SortDirection>(initialSort.direction);// Combine date and time into UTC ISO datetime stringfunction getFromDateTimeUTC(): string {@@ -200,14 +207,10 @@}function handleSort(field: SortField) {- if (orderBy === field) {- // Toggle direction if clicking the same field- sortDirection = sortDirection === 'desc' ? 'asc' : 'desc';- } else {- // New field, default to descending- orderBy = field;- sortDirection = 'desc';- }+ const newSort = handleSortClick(field, orderBy, sortDirection);+ orderBy = newSort.field as SortField;+ sortDirection = newSort.direction;+ setSortState(SORT_STORAGE_KEY, newSort);page = 1;loadData(false);}@@ -358,10 +361,7 @@<Table.Rowclass="cursor-pointer hover:bg-muted/50"onclick={createRowClickHandler(- resolve("/endpoints/[endpoint]/[endpointId]", {- endpoint: data.endpoint,- endpointId: transaction.id,- }))}+ `/endpoints/${encodeURIComponent(decodeURIComponent(data.endpoint))}/${transaction.id}`)}><Table.Cell class="text-muted-foreground">{formatDateTime(transaction.recordedAt, { timezone })}diff --git a/frontend/src/routes/endpoints/[endpoint]/[endpointId]/+page.svelte b/frontend/src/routes/endpoints/[endpoint]/[endpointId]/+page.svelteindex 92570234..83f41ca7 100644--- a/frontend/src/routes/endpoints/[endpoint]/[endpointId]/+page.svelte+++ b/frontend/src/routes/endpoints/[endpoint]/[endpointId]/+page.svelte@@ -6,10 +6,11 @@import { getTimezone } from '$lib/state/timezone.svelte';import { Button } from '$lib/components/ui/button';import * as Card from '$lib/components/ui/card';+ import * as Table from '$lib/components/ui/table';import { LoadingCircle } from '$lib/components/ui/loading-circle';import { ErrorDisplay } from '$lib/components/ui/error-display';import { projectsState } from '$lib/state/projects.svelte';- import { ArrowLeft, ArrowRight, TriangleAlert } from 'lucide-svelte';+ import { ArrowLeft, ArrowRight, TriangleAlert, MessageSquare } from 'lucide-svelte';import { LabelValue } from '$lib/components/ui/label-value';import { ContextGrid } from '$lib/components/ui/context-grid';import SegmentWaterfall from '$lib/components/segments/segment-waterfall.svelte';@@ -113,49 +114,49 @@/><LabelValuelabel="Status"- value={response.transaction.statusCode}+ value={response.endpoint.statusCode}monolarge- valueClass={getStatusColor(response.transaction.statusCode)}+ valueClass={getStatusColor(response.endpoint.statusCode)}/><LabelValuelabel="Duration"- value={formatDuration(response.transaction.duration)}+ value={formatDuration(response.endpoint.duration)}monolarge/><LabelValuelabel="Recorded At"- value={formatDateTime(response.transaction.recordedAt, { timezone })}+ value={formatDateTime(response.endpoint.recordedAt, { timezone })}mono/><LabelValuelabel="Server"- value={response.transaction.serverName}+ value={response.endpoint.serverName}mono/><LabelValuelabel="Version"- value={response.transaction.appVersion}+ value={response.endpoint.appVersion}mono/><LabelValuelabel="Client IP"- value={response.transaction.clientIP}+ value={response.endpoint.clientIP}mono/><LabelValuelabel="Body Size"- value={formatBytes(response.transaction.bodySize)}+ value={formatBytes(response.endpoint.bodySize)}mono/></div>- {#if response.transaction.scope && Object.keys(response.transaction.scope).length > 0}+ {#if response.endpoint.scope && Object.keys(response.endpoint.scope).length > 0}<hr class="border-border" /><div><p class="mb-3 text-sm font-medium">Context (Scope)</p>- <ContextGrid scope={response.transaction.scope} />+ <ContextGrid scope={response.endpoint.scope} /></div>{/if}</Card.Content>@@ -192,6 +193,58 @@</Card.Root>{/if}+ <!-- Messages Section (if messages exist) -->+ {#if response.messages.length > 0}+ <Card.Root class="border-blue-500/30 bg-blue-500/5">+ <Card.Header>+ <div class="flex items-center gap-2">+ <MessageSquare class="h-5 w-5 text-blue-500" />+ <Card.Title class="text-blue-600 dark:text-blue-400">Messages</Card.Title>+ </div>+ <Card.Description>+ {response.messages.length} message{response.messages.length === 1 ? '' : 's'} logged during this request+ </Card.Description>+ </Card.Header>+ <Card.Content>+ <Table.Root>+ <Table.Header>+ <Table.Row>+ <Table.Head>Message</Table.Head>+ <Table.Head class="w-[180px]">Recorded At</Table.Head>+ <Table.Head class="w-[100px]">Scope</Table.Head>+ </Table.Row>+ </Table.Header>+ <Table.Body>+ {#each response.messages as message}+ <Table.Row+ class="cursor-pointer hover:bg-muted/50"+ onclick={() => goto(`/issues/${message.exceptionHash}/${message.id}`)}+ >+ <Table.Cell>+ <div class="max-w-md truncate font-mono text-sm">+ {message.stackTrace.split('\n')[0]}+ </div>+ </Table.Cell>+ <Table.Cell class="font-mono text-sm text-muted-foreground">+ {formatDateTime(message.recordedAt, { timezone })}+ </Table.Cell>+ <Table.Cell>+ {#if message.scope && Object.keys(message.scope).length > 0}+ <span class="text-xs text-muted-foreground">+ {Object.keys(message.scope).length} key{Object.keys(message.scope).length === 1 ? '' : 's'}+ </span>+ {:else}+ <span class="text-xs text-muted-foreground">-</span>+ {/if}+ </Table.Cell>+ </Table.Row>+ {/each}+ </Table.Body>+ </Table.Root>+ </Card.Content>+ </Card.Root>+ {/if}+<!-- Segments Section --><Card.Root><Card.Header>@@ -208,8 +261,8 @@{#if response.hasSegments}<SegmentWaterfallsegments={response.segments}- transactionDuration={response.transaction.duration}- transactionStartTime={response.transaction.recordedAt}+ transactionDuration={response.endpoint.duration}+ transactionStartTime={response.endpoint.recordedAt}/>{:else}<SegmentEmptyState framework={projectsState.currentProject?.framework ?? 'gin'} />diff --git a/frontend/src/routes/issues/+page.svelte b/frontend/src/routes/issues/+page.svelteindex d219ed1e..cce2dd31 100644--- a/frontend/src/routes/issues/+page.svelte+++ b/frontend/src/routes/issues/+page.svelte@@ -1,5 +1,6 @@<script lang="ts">- import { onMount } from 'svelte';+ import { onMount, onDestroy } from 'svelte';+ import { browser } from '$app/environment';import { createRowClickHandler } from '$lib/utils/navigation';import { api } from '$lib/api';import * as Table from '$lib/components/ui/table';@@ -17,10 +18,31 @@import { TracewayTableHeader } from '$lib/components/ui/traceway-table-header';import { TableEmptyState } from '$lib/components/ui/table-empty-state';import { PaginationFooter } from '$lib/components/ui/pagination-footer';- import { formatDateTime, getNow, toUTCISO } from '$lib/utils/formatters';+ import { TimeRangePicker } from '$lib/components/ui/time-range-picker';+ import { CalendarDate } from '@internationalized/date';+ import {+ parseTimeRangeFromUrl,+ getResolvedTimeRange,+ dateToCalendarDate,+ dateToTimeString,+ updateUrl+ } from '$lib/utils/url-params';+ import { calendarDateTimeToLuxon, toUTCISO, formatDateTime } from '$lib/utils/formatters';+ import {+ getSortState,+ setSortState,+ handleSortClick,+ type SortDirection+ } from '$lib/utils/sort-storage';const timezone = $derived(getTimezone());+ // Sort state (persisted to localStorage)+ const SORT_STORAGE_KEY = 'issues';+ const initialSort = getSortState(SORT_STORAGE_KEY, { field: 'last_seen', direction: 'desc' });+ let sortField = $state(initialSort.field);+ let sortDirection = $state<SortDirection>(initialSort.direction);+type ExceptionTrendPoint = {timestamp: string;count: number;@@ -55,16 +77,43 @@const allSelected = $derived(exceptions.length > 0 && selectedHashes.size === exceptions.length);const someSelected = $derived(selectedHashes.size > 0 && selectedHashes.size < exceptions.length);- // Filters- let searchQuery = $state('');- let daysBack = $state('7');+ // Parse URL params on init+ function parseIssuesUrlParams() {+ if (!browser) return { preset: '24h', from: null, to: null, search: '', searchType: 'all' };+ const params = new URLSearchParams(window.location.search);+ const timeParams = parseTimeRangeFromUrl(timezone, '24h');+ return {+ ...timeParams,+ search: params.get('search') || '',+ searchType: params.get('searchType') || 'all'+ };+ }- // Select options for days back- const daysOptions = [- { value: '1', label: '24 Hours' },- { value: '7', label: '7 Days' }+ const initialUrlParams = parseIssuesUrlParams();+ const initialRange = getResolvedTimeRange(initialUrlParams, timezone);++ // Time range state+ let selectedPreset = $state<string | null>(initialUrlParams.preset);+ let fromDate = $state<CalendarDate>(dateToCalendarDate(initialRange.from));+ let toDate = $state<CalendarDate>(dateToCalendarDate(initialRange.to));+ let fromTime = $state(dateToTimeString(initialRange.from));+ let toTime = $state(dateToTimeString(initialRange.to));++ // Search state (manual trigger only)+ let searchQuery = $state(initialUrlParams.search);+ let searchType = $state(initialUrlParams.searchType);++ // Search type options+ const searchTypeOptions = [+ { value: 'all', label: 'All' },+ { value: 'issues', label: 'Issues' },+ { value: 'messages', label: 'Messages' }];+ const searchTypeLabel = $derived(+ searchTypeOptions.find((o) => o.value === searchType)?.label ?? 'All'+ );+// Page size optionsconst pageSizeOptions = [{ value: '10', label: '10' },@@ -73,31 +122,58 @@{ value: '100', label: '100' }];- // Derived labels for select displays- const daysBackLabel = $derived(- daysOptions.find((o) => o.value === daysBack)?.label ?? 'Select period'- );- const pageSizeLabel = $derived(- pageSizeOptions.find((o) => o.value === pageSize.toString())?.label ?? pageSize.toString()- );+ // Helper functions for date/time conversion+ function getFromDateTimeUTC(): string {+ const [hour, minute] = fromTime.split(':').map(Number);+ const luxonDt = calendarDateTimeToLuxon(+ { year: fromDate.year, month: fromDate.month, day: fromDate.day, hour, minute },+ timezone+ );+ return toUTCISO(luxonDt);+ }- async function loadData() {+ function getToDateTimeUTC(): string {+ const [hour, minute] = toTime.split(':').map(Number);+ const luxonDt = calendarDateTimeToLuxon(+ { year: toDate.year, month: toDate.month, day: toDate.day, hour, minute },+ timezone+ );+ return toUTCISO(luxonDt);+ }++ function updateIssuesUrl(pushToHistory = true) {+ const params: Record<string, string | null | undefined> = {};+ if (selectedPreset) {+ params.preset = selectedPreset;+ } else {+ params.from = getFromDateTimeUTC();+ params.to = getToDateTimeUTC();+ }+ if (searchQuery.trim()) params.search = searchQuery.trim();+ if (searchType !== 'all') params.searchType = searchType;+ updateUrl(params, { pushToHistory });+ }++ async function loadData(pushToHistory = true) {loading = true;error = '';+ updateIssuesUrl(pushToHistory);+try {- const now = getNow(timezone);- const fromDate = now.minus({ days: parseInt(daysBack) });+ // Build orderBy with direction suffix for backend+ const orderBy = sortDirection === 'asc' ? `${sortField}_asc` : sortField;const requestBody = {- fromDate: toUTCISO(fromDate),- toDate: toUTCISO(now),- orderBy: 'last_seen',+ fromDate: getFromDateTimeUTC(),+ toDate: getToDateTimeUTC(),+ orderBy,pagination: {page: page,pageSize: pageSize},search: searchQuery.trim(),+ searchType: searchType,includeArchived: false};@@ -122,25 +198,56 @@function handlePageChange(newPage: number) {if (newPage >= 1 && newPage <= totalPages) {page = newPage;- loadData();+ loadData(true);}}function handlePageSizeChange(newPageSize: number) {pageSize = newPageSize;page = 1;- loadData();+ loadData(true);+ }++ function handleTimeRangeChange(+ from: { date: CalendarDate; time: string },+ to: { date: CalendarDate; time: string },+ preset: string | null+ ) {+ fromDate = from.date;+ toDate = to.date;+ fromTime = from.time;+ toTime = to.time;+ selectedPreset = preset;+ page = 1;+ loadData(true);+ }++ function handleSearch() {+ page = 1;+ loadData(true);}- // Debounce search input- let searchTimeout: ReturnType<typeof setTimeout> | null = null;+ function handleSort(field: string) {+ const newSort = handleSortClick(field, sortField, sortDirection);+ sortField = newSort.field;+ sortDirection = newSort.direction;+ setSortState(SORT_STORAGE_KEY, newSort);+ page = 1;+ loadData(true);+ }- function handleSearchInput() {- if (searchTimeout) clearTimeout(searchTimeout);- searchTimeout = setTimeout(() => {- page = 1;- loadData();- }, 300);+ function handlePopState() {+ const urlParams = parseIssuesUrlParams();+ const range = getResolvedTimeRange(urlParams, timezone);+ selectedPreset = urlParams.preset;+ fromDate = dateToCalendarDate(range.from);+ toDate = dateToCalendarDate(range.to);+ fromTime = dateToTimeString(range.from);+ toTime = dateToTimeString(range.to);+ searchQuery = urlParams.search;+ searchType = urlParams.searchType;+ page = 1;+ loadData(false);}// Selection handlers@@ -193,43 +300,63 @@}onMount(() => {- loadData();+ window.addEventListener('popstate', handlePopState);+ loadData(false);+ });++ onDestroy(() => {+ if (typeof window !== 'undefined') {+ window.removeEventListener('popstate', handlePopState);+ }});</script><div class="space-y-4">- <!-- Header with Title and Search + Period Filter -->+ <!-- Row 1: Title + TimeRangePicker --><div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between"><h2 class="text-2xl font-bold tracking-tight">Issues</h2>- <div class="flex">- <Input- placeholder="Search exceptions..."- class="h-9 w-[250px] rounded-r-none border-r-0 focus:relative focus:z-10 lg:w-[320px]"- bind:value={searchQuery}- oninput={handleSearchInput}+ <div class="w-full sm:w-auto">+ <TimeRangePicker+ bind:fromDate+ bind:toDate+ bind:fromTime+ bind:toTime+ bind:preset={selectedPreset}+ onApply={handleTimeRangeChange}/>- <Select.Root- type="single"- bind:value={daysBack}- onValueChange={(v) => {- if (v) {- page = 1;- loadData();- }- }}- >- <Select.Trigger class="-ml-px h-9 w-[110px] rounded-l-none focus:relative focus:z-10">- {daysBackLabel}- </Select.Trigger>- <Select.Content>- {#each daysOptions as option}- <Select.Item value={option.value} label={option.label}>{option.label}</Select.Item>- {/each}- </Select.Content>- </Select.Root></div></div>+ <!-- Row 2: Search Type Dropdown + Search Input + Go Button -->+ <div class="flex">++ <Input+ placeholder="Search exceptions..."+ class="h-9 w-[250px] rounded-r-none border-r-0 lg:w-[320px]"+ bind:value={searchQuery}+ onkeydown={(e) => {+ if (e.key === 'Enter') handleSearch();+ }}+ />++ <Select.Root type="single" bind:value={searchType}>+ <Select.Trigger class="h-9 w-[110px] rounded-none border-r-0">+ {searchTypeLabel}+ </Select.Trigger>+ <Select.Content>+ {#each searchTypeOptions as option}+ <Select.Item value={option.value} label={option.label}>+ {option.label}+ </Select.Item>+ {/each}+ </Select.Content>+ </Select.Root>++ <Button variant="outline" class="h-9 rounded-l-none" onclick={handleSearch} disabled={loading}>+ Go+ </Button>+ </div>+<!-- Archive Toolbar - shown when items selected -->{#if selectedCount > 0}<div@@ -302,11 +429,19 @@tooltip="Total number of times this issue occurred in the selected range"align="right"class="w-[80px]"+ sortField="count"+ currentSortField={sortField}+ {sortDirection}+ onSort={handleSort}/><TracewayTableHeaderlabel="Last Seen"tooltip="When this issue last occurred"class="w-[180px]"+ sortField="last_seen"+ currentSortField={sortField}+ {sortDirection}+ onSort={handleSort}/></Table.Row></Table.Header>diff --git a/frontend/src/routes/issues/[exceptionHash]/[recordedAt]/+page.svelte b/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.sveltesimilarity index 92%rename from frontend/src/routes/issues/[exceptionHash]/[recordedAt]/+page.svelterename to frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.svelteindex 5d6f9618..f9265f67 100644--- a/frontend/src/routes/issues/[exceptionHash]/[recordedAt]/+page.svelte+++ b/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.svelte@@ -33,6 +33,7 @@const isMessage = $derived(occurrence?.isMessage ?? false);const firstLineOfStackTrace = $derived(group?.stackTrace.split('\n')[0] || 'Exception');const hasMoreOccurrences = $derived(total > 10);+ const subtitleText = $derived(occurrence ? `Event from ${formatDateTime(occurrence.recordedAt, { timezone })}` : 'Loading...');async function loadData() {loading = true;@@ -41,7 +42,16 @@linkedTransaction = null;try {- // Load all occurrences for this hash+ // Load the specific exception by ID+ const exceptionResponse = await api.post(`/exception-stack-traces/by-id/${data.exceptionId}`, {}, { projectId: projectsState.currentProjectId ?? undefined });+ occurrence = exceptionResponse.exception;++ if (!occurrence) {+ notFound = true;+ return;+ }++ // Load all occurrences for this hash (for the events table)const response = await api.post(`/exception-stack-traces/${data.exceptionHash}`, {pagination: {page: 1,@@ -53,14 +63,6 @@allOccurrences = response.occurrences || [];total = response.pagination.total;- // Find the specific occurrence by recordedAt- occurrence = allOccurrences.find(o => o.recordedAt === data.recordedAt) || null;-- if (!occurrence) {- notFound = true;- return;- }-// Load linked transaction if this occurrence has a transactionIdif (occurrence.transactionId) {try {@@ -124,7 +126,7 @@<div class="space-y-6"><PageHeadertitle={firstLineOfStackTrace}- subtitle="Event from {formatDateTime(data.recordedAt, { timezone })}"+ subtitle={subtitleText}onBack={createRowClickHandler(resolve("/issues/[exceptionHash]", {exceptionHash: data.exceptionHash}))}/>@@ -171,7 +173,7 @@{total}hasMore={hasMoreOccurrences}showViewAll={true}- currentRecordedAt={data.recordedAt}+ currentExceptionId={data.exceptionId}/>{/if}</div>diff --git a/frontend/src/routes/issues/[exceptionHash]/[recordedAt]/+page.ts b/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.tssimilarity index 69%rename from frontend/src/routes/issues/[exceptionHash]/[recordedAt]/+page.tsrename to frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.tsindex 441906a1..63838e46 100644--- a/frontend/src/routes/issues/[exceptionHash]/[recordedAt]/+page.ts+++ b/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.ts@@ -3,6 +3,6 @@ export const prerender = false;export function load({ params }) {return {exceptionHash: params.exceptionHash,- recordedAt: decodeURIComponent(params.recordedAt)+ exceptionId: params.exceptionId};}diff --git a/frontend/src/routes/issues/[exceptionHash]/events/+page.svelte b/frontend/src/routes/issues/[exceptionHash]/events/+page.svelteindex f02e7e3a..99093cf3 100644--- a/frontend/src/routes/issues/[exceptionHash]/events/+page.svelte+++ b/frontend/src/routes/issues/[exceptionHash]/events/+page.svelte@@ -32,6 +32,7 @@};type ExceptionOccurrence = {+ id: string;transactionId: string | null;exceptionHash: string;stackTrace: string;@@ -224,7 +225,7 @@{#each occurrences as occurrence}<Table.Rowclass="cursor-pointer hover:bg-muted/50"- onclick={createRowClickHandler(`/issues/${page.params.exceptionHash}/${encodeURIComponent(occurrence.recordedAt)}`)}+ onclick={createRowClickHandler(`/issues/${page.params.exceptionHash}/${occurrence.id}`)}><Table.Cell>{formatDateTime(occurrence.recordedAt, { timezone })}</Table.Cell><Table.Cell class="font-mono text-sm text-muted-foreground">diff --git a/frontend/src/routes/metrics/+page.svelte b/frontend/src/routes/metrics/+page.svelteindex 6f1a7b1c..d37e4bc4 100644--- a/frontend/src/routes/metrics/+page.svelte+++ b/frontend/src/routes/metrics/+page.svelte@@ -74,7 +74,7 @@servers: string[];tab: MetricsTab;} {- if (!browser) return { preset: '6h', from: null, to: null, servers: [], tab: 'application' };+ if (!browser) return { preset: '24h', from: null, to: null, servers: [], tab: 'application' };const params = new URLSearchParams(window.location.search);const serversParam = params.get('servers');@@ -382,9 +382,6 @@bind:preset={selectedPreset}onApply={handleTimeRangeChange}/>- <Button variant="outline" size="sm" onclick={() => reloadActiveTab()} disabled={isCurrentTabLoading()}>- <RefreshCw class="h-4 w-4 {isCurrentTabLoading() ? 'animate-spin' : ''}" />- </Button></div></div>@@ -410,9 +407,15 @@</div>{#if lastUpdated()}- <span class="text-sm text-muted-foreground whitespace-nowrap">- Updated: {lastUpdatedFormatted}- </span>+ <div class="flex items-center gap-1">+ <span class="text-sm text-muted-foreground whitespace-nowrap">+ Updated: {lastUpdatedFormatted}+ </span>++ <Button variant="ghost" size="sm" onclick={() => reloadActiveTab()} disabled={isCurrentTabLoading()}>+ <RefreshCw class="h-4 w-4 {isCurrentTabLoading() ? 'animate-spin' : ''}" />+ </Button>+ </div>{/if}</div>diff --git a/frontend/src/routes/tasks/+page.svelte b/frontend/src/routes/tasks/+page.svelteindex 072fc9af..08d79d41 100644--- a/frontend/src/routes/tasks/+page.svelte+++ b/frontend/src/routes/tasks/+page.svelte@@ -23,6 +23,12 @@getResolvedTimeRange,updateUrl} from '$lib/utils/url-params';+ import {+ getSortState,+ setSortState,+ handleSortClick,+ type SortDirection+ } from '$lib/utils/sort-storage';const timezone = $derived(getTimezone());@@ -36,7 +42,6 @@};type SortField = 'count' | 'p50_duration' | 'p95_duration' | 'last_seen';- type SortDirection = 'asc' | 'desc';let tasks = $state<TaskStats[]>([]);let loading = $state(true);@@ -84,9 +89,11 @@loadData(false);}- // Sorting - default to count descending- let orderBy = $state<SortField>('count');- let sortDirection = $state<SortDirection>('desc');+ // Sorting - persisted to localStorage+ const SORT_STORAGE_KEY = 'tasks';+ const initialSort = getSortState(SORT_STORAGE_KEY, { field: 'count', direction: 'desc' });+ let orderBy = $state<SortField>(initialSort.field as SortField);+ let sortDirection = $state<SortDirection>(initialSort.direction);// Combine date and time into UTC ISO datetime stringfunction getFromDateTimeUTC(): string {@@ -167,16 +174,12 @@}function handleSort(field: SortField) {- if (orderBy === field) {- // Toggle direction if clicking the same field- sortDirection = sortDirection === 'desc' ? 'asc' : 'desc';- } else {- // New field, default to descending- orderBy = field;- sortDirection = 'desc';- }+ const newSort = handleSortClick(field, orderBy, sortDirection);+ orderBy = newSort.field as SortField;+ sortDirection = newSort.direction;+ setSortState(SORT_STORAGE_KEY, newSort);page = 1;- loadData(false); // Don't push to history for sorting+ loadData(false);}onMount(() => {diff --git a/frontend/src/routes/tasks/[task]/+page.svelte b/frontend/src/routes/tasks/[task]/+page.svelteindex 17175882..ada4acd5 100644--- a/frontend/src/routes/tasks/[task]/+page.svelte+++ b/frontend/src/routes/tasks/[task]/+page.svelte@@ -23,6 +23,12 @@dateToTimeString,updateUrl} from '$lib/utils/url-params';+ import {+ getSortState,+ setSortState,+ handleSortClick,+ type SortDirection+ } from '$lib/utils/sort-storage';const timezone = $derived(getTimezone());@@ -47,7 +53,6 @@};type SortField = 'recorded_at' | 'duration';- type SortDirection = 'asc' | 'desc';let { data } = $props();@@ -81,9 +86,9 @@}}- // Default to 6h preset- const range = getTimeRangeFromPreset('6h', timezone);- return { preset: '6h', from: range.from, to: range.to };+ // Default to 24h preset+ const range = getTimeRangeFromPreset('24h', timezone);+ return { preset: '24h', from: range.from, to: range.to };}const initialRange = getInitialRange();@@ -104,9 +109,11 @@);}- // Sorting State- let orderBy = $state<SortField>('recorded_at');- let sortDirection = $state<SortDirection>('desc');+ // Sorting State - persisted to localStorage+ const SORT_STORAGE_KEY = 'task_detail';+ const initialSort = getSortState(SORT_STORAGE_KEY, { field: 'recorded_at', direction: 'desc' });+ let orderBy = $state<SortField>(initialSort.field as SortField);+ let sortDirection = $state<SortDirection>(initialSort.direction);// Combine date and time into UTC ISO datetime stringfunction getFromDateTimeUTC(): string {@@ -184,14 +191,10 @@}function handleSort(field: SortField) {- if (orderBy === field) {- // Toggle direction if clicking the same field- sortDirection = sortDirection === 'desc' ? 'asc' : 'desc';- } else {- // New field, default to descending- orderBy = field;- sortDirection = 'desc';- }+ const newSort = handleSortClick(field, orderBy, sortDirection);+ orderBy = newSort.field as SortField;+ sortDirection = newSort.direction;+ setSortState(SORT_STORAGE_KEY, newSort);page = 1;loadData(false);}@@ -318,10 +321,7 @@<Table.Rowclass="cursor-pointer hover:bg-muted/50"onclick={createRowClickHandler(- resolve("/tasks/[task]/[taskId]", {- task: data.task,- taskId: task.id,- }))}+ `/tasks/${encodeURIComponent(decodeURIComponent(data.task))}/${task.id}`)}><Table.Cell class="text-muted-foreground">{formatDateTime(task.recordedAt, { timezone })}