Skip to content

The only tool you need to know what is happening and how to fix it.

consistency

ddux25f6d96b4471
diff --git a/frontend/src/lib/components/issues/events-table.svelte b/frontend/src/lib/components/issues/events-table.svelte
index 956966c7..4a5bd1e2 100644
--- a/frontend/src/lib/components/issues/events-table.svelte
+++ b/frontend/src/lib/components/issues/events-table.svelte
@@ -3,7 +3,7 @@
import * as Card from "$lib/components/ui/card";
import * as Table from "$lib/components/ui/table";
import * as Tooltip from "$lib/components/ui/tooltip";
- import { ArrowRight, CircleHelp } from "lucide-svelte";
+ import { ArrowRight, CircleQuestionMark } from "lucide-svelte";
import type { ExceptionOccurrence } from '$lib/types/exceptions';
interface Props {
@@ -49,7 +49,7 @@
Recorded At
<Tooltip.Root>
<Tooltip.Trigger>
- <CircleHelp class="h-3.5 w-3.5 text-muted-foreground/60" />
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
</Tooltip.Trigger>
<Tooltip.Content>
<p class="text-xs">When this occurrence was recorded</p>
@@ -62,7 +62,7 @@
Server
<Tooltip.Root>
<Tooltip.Trigger>
- <CircleHelp class="h-3.5 w-3.5 text-muted-foreground/60" />
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
</Tooltip.Trigger>
<Tooltip.Content>
<p class="text-xs">Server instance where error occurred</p>
@@ -75,7 +75,7 @@
Transaction
<Tooltip.Root>
<Tooltip.Trigger>
- <CircleHelp class="h-3.5 w-3.5 text-muted-foreground/60" />
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
</Tooltip.Trigger>
<Tooltip.Content>
<p class="text-xs">Transaction ID if this occurred during a request</p>
diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte
index 6c00e172..6d1d6cc3 100644
--- a/frontend/src/routes/+page.svelte
+++ b/frontend/src/routes/+page.svelte
@@ -86,7 +86,10 @@
// Calculate impact level based on call volume and response time variance
// Returns: 'critical' | 'high' | 'medium' | null (null = not significant)
- function getImpactLevel(count: number, p50: number, p95: number): 'critical' | 'high' | 'medium' | null {
+ function getImpactLevel(
+ p50: number,
+ p95: number
+ ): 'critical' | 'high' | 'medium' | null {
const varianceMs = (p95 - p50) / 1_000_000;
const score = count * varianceMs;
if (score > 100) return 'critical';
@@ -104,10 +107,16 @@
}
</script>
-<div class="space-y-6">
+<div class="space-y-4">
{#if error && !loading}
<ErrorDisplay
- status={errorStatus === 404 ? 404 : errorStatus === 400 ? 400 : errorStatus === 422 ? 422 : 400}
+ status={errorStatus === 404
+ ? 404
+ : errorStatus === 400
+ ? 400
+ : errorStatus === 422
+ ? 422
+ : 400}
title="Failed to Load Dashboard"
description={error}
onRetry={() => loadDashboard()}
@@ -115,259 +124,276 @@
{/if}
{#if loading}
- <div class="flex justify-center items-center py-20">
+ <div class="flex items-center justify-center py-20">
<LoadingCircle size="xlg" />
</div>
{:else if !error}
- <div class="space-y-8">
- <!-- Endpoints -->
- <div>
- <div class="flex items-bottom gap-1 mb-4">
- <div class="flex h-8 w-8 items-center justify-center rounded-md bg-chart-1/10 mr-2">
- <Gauge class="h-5 w-5 text-chart-1" />
+ <div class="space-y-6">
+ <!-- Endpoints -->
+ <div>
+ <div class="items-bottom mb-4 flex gap-1">
+ <div class="mr-2 flex h-8 w-8 items-center justify-center rounded-md bg-chart-1/10">
+ <Gauge class="h-5 w-5 text-chart-1" />
+ </div>
+ <h2 class="text-2xl font-bold tracking-tight">Endpoints</h2>
+ <Tooltip.Root>
+ <Tooltip.Trigger class="pt-1">
+ <CircleQuestionMark class="h-4 w-4 text-muted-foreground/60" />
+ </Tooltip.Trigger>
+ <Tooltip.Content>
+ <p>
+ Most impactful endpoints to optimize based on traffic and response time variance
+ </p>
+ </Tooltip.Content>
+ </Tooltip.Root>
</div>
- <h2 class="text-2xl font-bold tracking-tight">Endpoints</h2>
- <Tooltip.Root>
- <Tooltip.Trigger class="pt-1">
- <CircleQuestionMark class="h-4 w-4 text-muted-foreground/60" />
- </Tooltip.Trigger>
- <Tooltip.Content>
- <p>Most impactful endpoints to optimize based on traffic and response time variance</p>
- </Tooltip.Content>
- </Tooltip.Root>
- </div>
- <div class="rounded-md border overflow-hidden">
- <Table.Root>
- {#if data?.worstEndpoints && data.worstEndpoints.length > 0}
- <Table.Header>
- <Table.Row class="hover:bg-transparent">
- <Table.Head class="h-10 text-sm">
- <span class="flex items-center gap-1.5">
- Endpoint
- <Tooltip.Root>
- <Tooltip.Trigger>
- <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
- </Tooltip.Trigger>
- <Tooltip.Content>
- <p class="text-xs">The API route or page being accessed</p>
- </Tooltip.Content>
- </Tooltip.Root>
- </span>
- </Table.Head>
- <Table.Head class="h-10 w-[70px] text-right text-sm">
- <span class="flex items-center justify-end gap-1.5">
- Calls
- <Tooltip.Root>
- <Tooltip.Trigger>
- <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
- </Tooltip.Trigger>
- <Tooltip.Content>
- <p class="text-xs">Total number of requests</p>
- </Tooltip.Content>
- </Tooltip.Root>
- </span>
- </Table.Head>
- <Table.Head class="h-10 w-[80px] text-right text-sm">
- <span class="flex items-center justify-end gap-1.5">
- Typical
- <Tooltip.Root>
- <Tooltip.Trigger>
- <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
- </Tooltip.Trigger>
- <Tooltip.Content>
- <p class="text-xs">Median response time (P50)</p>
- </Tooltip.Content>
- </Tooltip.Root>
- </span>
- </Table.Head>
- <Table.Head class="h-10 w-[70px] text-right text-sm">
- <span class="flex items-center justify-end gap-1.5">
- Slow
- <Tooltip.Root>
- <Tooltip.Trigger>
- <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
- </Tooltip.Trigger>
- <Tooltip.Content>
- <p class="text-xs">95th percentile - slowest 5%</p>
- </Tooltip.Content>
- </Tooltip.Root>
- </span>
- </Table.Head>
- <Table.Head class="h-10 w-[80px] text-right text-sm">
- <span class="flex items-center justify-end gap-1.5">
- Impact
- <Tooltip.Root>
- <Tooltip.Trigger>
- <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
- </Tooltip.Trigger>
- <Tooltip.Content>
- <p class="text-xs">Priority based on traffic × variance</p>
- </Tooltip.Content>
- </Tooltip.Root>
- </span>
- </Table.Head>
- </Table.Row>
- </Table.Header>
- <Table.Body>
- {#each data.worstEndpoints as endpoint}
- {@const impactLevel = getImpactLevel(endpoint.count, endpoint.p50Duration, endpoint.p95Duration)}
- <Table.Row
- class="cursor-pointer hover:bg-muted/50"
- onclick={createRowClickHandler(`/transactions/${encodeURIComponent(endpoint.endpoint)}?preset=24h`)}
- >
- <Table.Cell class="py-3 font-mono text-sm truncate max-w-[300px]" title={endpoint.endpoint}>
- {endpoint.endpoint}
- </Table.Cell>
- <Table.Cell class="py-3 text-right tabular-nums">
- {endpoint.count.toLocaleString()}
- </Table.Cell>
- <Table.Cell class="py-3 text-right font-mono text-sm tabular-nums">
- {formatDuration(endpoint.p50Duration)}
- </Table.Cell>
- <Table.Cell class="py-3 text-right font-mono text-sm tabular-nums">
- {formatDuration(endpoint.p95Duration)}
- </Table.Cell>
- <Table.Cell class="py-3 text-right">
- {#if impactLevel === 'critical'}
- <span class="inline-flex items-center gap-1 rounded-full bg-red-500/15 px-2 py-0.5 text-xs font-medium text-red-600 dark:text-red-400">
- <TriangleAlert class="h-3 w-3" />
- Critical
+ <div class="overflow-hidden rounded-md border">
+ <Table.Root>
+ {#if data?.worstEndpoints && data.worstEndpoints.length > 0}
+ <Table.Header>
+ <Table.Row class="hover:bg-transparent">
+ <Table.Head class="h-10 text-sm">
+ <span class="flex items-center gap-1.5">
+ Endpoint
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
+ </Tooltip.Trigger>
+ <Tooltip.Content>
+ <p class="text-xs">The API route or page being accessed</p>
+ </Tooltip.Content>
+ </Tooltip.Root>
+ </span>
+ </Table.Head>
+ <Table.Head class="h-10 w-[70px] text-right text-sm">
+ <span class="flex items-center justify-end gap-1.5">
+ Calls
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
+ </Tooltip.Trigger>
+ <Tooltip.Content>
+ <p class="text-xs">Total number of requests</p>
+ </Tooltip.Content>
+ </Tooltip.Root>
+ </span>
+ </Table.Head>
+ <Table.Head class="h-10 w-[80px] text-right text-sm">
+ <span class="flex items-center justify-end gap-1.5">
+ Typical
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
+ </Tooltip.Trigger>
+ <Tooltip.Content>
+ <p class="text-xs">Median response time (P50)</p>
+ </Tooltip.Content>
+ </Tooltip.Root>
</span>
- {:else if impactLevel === 'high'}
- <span class="inline-flex items-center gap-1 rounded-full bg-orange-500/15 px-2 py-0.5 text-xs font-medium text-orange-600 dark:text-orange-400">
- <TriangleAlert class="h-3 w-3" />
- High
+ </Table.Head>
+ <Table.Head class="h-10 w-[70px] text-right text-sm">
+ <span class="flex items-center justify-end gap-1.5">
+ Slow
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
+ </Tooltip.Trigger>
+ <Tooltip.Content>
+ <p class="text-xs">95th percentile - slowest 5%</p>
+ </Tooltip.Content>
+ </Tooltip.Root>
</span>
- {:else if impactLevel === 'medium'}
- <span class="inline-flex items-center gap-1 rounded-full bg-yellow-500/15 px-2 py-0.5 text-xs font-medium text-yellow-600 dark:text-yellow-500">
- Medium
+ </Table.Head>
+ <Table.Head class="h-10 w-[80px] text-right text-sm">
+ <span class="flex items-center justify-end gap-1.5">
+ Impact
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
+ </Tooltip.Trigger>
+ <Tooltip.Content>
+ <p class="text-xs">Priority based on traffic × variance</p>
+ </Tooltip.Content>
+ </Tooltip.Root>
</span>
- {/if}
- </Table.Cell>
- </Table.Row>
- {/each}
- <Table.Row
- class="cursor-pointer bg-muted/50 hover:bg-muted"
- onclick={createRowClickHandler('/transactions')}
- >
- <Table.Cell colspan={5} class="py-2 text-center text-sm text-muted-foreground">
- View all transactions <ArrowRight class="inline h-3.5 w-3.5" />
- </Table.Cell>
- </Table.Row>
- </Table.Body>
- {:else}
- <Table.Body>
- <Table.Row>
- <Table.Cell colspan={5} class="h-24 text-center text-muted-foreground">
- No transaction data received yet
- </Table.Cell>
- </Table.Row>
- </Table.Body>
- {/if}
- </Table.Root>
+ </Table.Head>
+ </Table.Row>
+ </Table.Header>
+ <Table.Body>
+ {#each data.worstEndpoints as endpoint}
+ {@const impactLevel = getImpactLevel(
+ endpoint.count,
+ endpoint.p50Duration,
+ endpoint.p95Duration
+ )}
+ <Table.Row
+ class="cursor-pointer hover:bg-muted/50"
+ onclick={createRowClickHandler(
+ `/transactions/${encodeURIComponent(endpoint.endpoint)}?preset=24h`
+ )}
+ >
+ <Table.Cell
+ class="max-w-[300px] truncate py-3 font-mono text-sm"
+ title={endpoint.endpoint}
+ >
+ {endpoint.endpoint}
+ </Table.Cell>
+ <Table.Cell class="py-3 text-right tabular-nums">
+ {endpoint.count.toLocaleString()}
+ </Table.Cell>
+ <Table.Cell class="py-3 text-right font-mono text-sm tabular-nums">
+ {formatDuration(endpoint.p50Duration)}
+ </Table.Cell>
+ <Table.Cell class="py-3 text-right font-mono text-sm tabular-nums">
+ {formatDuration(endpoint.p95Duration)}
+ </Table.Cell>
+ <Table.Cell class="py-3 text-right">
+ {#if impactLevel === 'critical'}
+ <span
+ class="inline-flex items-center gap-1 rounded-full bg-red-500/15 px-2 py-0.5 text-xs font-medium text-red-600 dark:text-red-400"
+ >
+ <TriangleAlert class="h-3 w-3" />
+ Critical
+ </span>
+ {:else if impactLevel === 'high'}
+ <span
+ class="inline-flex items-center gap-1 rounded-full bg-orange-500/15 px-2 py-0.5 text-xs font-medium text-orange-600 dark:text-orange-400"
+ >
+ <TriangleAlert class="h-3 w-3" />
+ High
+ </span>
+ {:else if impactLevel === 'medium'}
+ <span
+ class="inline-flex items-center gap-1 rounded-full bg-yellow-500/15 px-2 py-0.5 text-xs font-medium text-yellow-600 dark:text-yellow-500"
+ >
+ Medium
+ </span>
+ {/if}
+ </Table.Cell>
+ </Table.Row>
+ {/each}
+ <Table.Row
+ class="cursor-pointer bg-muted/50 hover:bg-muted"
+ onclick={createRowClickHandler('/transactions')}
+ >
+ <Table.Cell colspan={5} class="py-2 text-center text-sm text-muted-foreground">
+ View all transactions <ArrowRight class="inline h-3.5 w-3.5" />
+ </Table.Cell>
+ </Table.Row>
+ </Table.Body>
+ {:else}
+ <Table.Body>
+ <Table.Row>
+ <Table.Cell colspan={5} class="h-24 text-center text-muted-foreground">
+ No transaction data received yet
+ </Table.Cell>
+ </Table.Row>
+ </Table.Body>
+ {/if}
+ </Table.Root>
+ </div>
</div>
- </div>
- <!-- Issues Section -->
- <div>
- <div class="flex items-center gap-1 mb-4">
- <div class="flex h-8 w-8 items-center justify-center rounded-md bg-destructive/10 mr-2">
- <Bug class="h-5 w-5 text-destructive" />
+ <!-- Issues Section -->
+ <div>
+ <div class="mb-4 flex items-center gap-1">
+ <div class="mr-2 flex h-8 w-8 items-center justify-center rounded-md bg-destructive/10">
+ <Bug class="h-5 w-5 text-destructive" />
+ </div>
+ <h2 class="text-2xl font-bold tracking-tight">Issues</h2>
+ <Tooltip.Root>
+ <Tooltip.Trigger class="pt-1">
+ <CircleQuestionMark class="h-4 w-4 text-muted-foreground/60" />
+ </Tooltip.Trigger>
+ <Tooltip.Content>
+ <p>Latest exceptions and errors to address from the last 24 hours</p>
+ </Tooltip.Content>
+ </Tooltip.Root>
+ </div>
+ <div class="overflow-hidden rounded-md border">
+ <Table.Root>
+ {#if data?.recentIssues && data.recentIssues.length > 0}
+ <Table.Header>
+ <Table.Row class="hover:bg-transparent">
+ <Table.Head class="h-10 text-sm">
+ <span class="flex items-center gap-1.5">
+ Issue
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
+ </Tooltip.Trigger>
+ <Tooltip.Content>
+ <p class="text-xs">The error message or exception that occurred</p>
+ </Tooltip.Content>
+ </Tooltip.Root>
+ </span>
+ </Table.Head>
+ <Table.Head class="h-10 w-[70px] text-right text-sm">
+ <span class="flex items-center justify-end gap-1.5">
+ Count
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
+ </Tooltip.Trigger>
+ <Tooltip.Content>
+ <p class="text-xs">Number of times this issue occurred</p>
+ </Tooltip.Content>
+ </Tooltip.Root>
+ </span>
+ </Table.Head>
+ <Table.Head class="h-10 w-[70px] text-right text-sm">
+ <span class="flex items-center justify-end gap-1.5">
+ When
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
+ </Tooltip.Trigger>
+ <Tooltip.Content>
+ <p class="text-xs">When this issue last occurred</p>
+ </Tooltip.Content>
+ </Tooltip.Root>
+ </span>
+ </Table.Head>
+ </Table.Row>
+ </Table.Header>
+ <Table.Body>
+ {#each data.recentIssues as issue}
+ <Table.Row
+ class="cursor-pointer hover:bg-muted/50"
+ onclick={createRowClickHandler(`/issues/${issue.exceptionHash}`)}
+ >
+ <Table.Cell class="py-3 font-mono text-sm" title={issue.stackTrace}>
+ {truncateStackTrace(issue.stackTrace)}
+ </Table.Cell>
+ <Table.Cell class="py-3 text-right font-medium tabular-nums">
+ {issue.count}
+ </Table.Cell>
+ <Table.Cell class="py-3 text-right text-sm text-muted-foreground tabular-nums">
+ {formatRelativeTime(issue.lastSeen)}
+ </Table.Cell>
+ </Table.Row>
+ {/each}
+ <Table.Row
+ class="cursor-pointer bg-muted/50 hover:bg-muted"
+ onclick={createRowClickHandler('/issues')}
+ >
+ <Table.Cell colspan={3} class="py-2 text-center text-sm text-muted-foreground">
+ View all issues <ArrowRight class="inline h-3.5 w-3.5" />
+ </Table.Cell>
+ </Table.Row>
+ </Table.Body>
+ {:else}
+ <Table.Body>
+ <Table.Row>
+ <Table.Cell colspan={3} class="h-24 text-center text-muted-foreground">
+ No issues in the last 24 hours
+ </Table.Cell>
+ </Table.Row>
+ </Table.Body>
+ {/if}
+ </Table.Root>
</div>
- <h2 class="text-2xl font-bold tracking-tight">Issues</h2>
- <Tooltip.Root>
- <Tooltip.Trigger class="pt-1">
- <CircleQuestionMark class="h-4 w-4 text-muted-foreground/60" />
- </Tooltip.Trigger>
- <Tooltip.Content>
- <p>Latest exceptions and errors to address from the last 24 hours</p>
- </Tooltip.Content>
- </Tooltip.Root>
- </div>
- <div class="rounded-md border overflow-hidden">
- <Table.Root>
- {#if data?.recentIssues && data.recentIssues.length > 0}
- <Table.Header>
- <Table.Row class="hover:bg-transparent">
- <Table.Head class="h-10 text-sm">
- <span class="flex items-center gap-1.5">
- Issue
- <Tooltip.Root>
- <Tooltip.Trigger>
- <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
- </Tooltip.Trigger>
- <Tooltip.Content>
- <p class="text-xs">The error message or exception that occurred</p>
- </Tooltip.Content>
- </Tooltip.Root>
- </span>
- </Table.Head>
- <Table.Head class="h-10 w-[70px] text-right text-sm">
- <span class="flex items-center justify-end gap-1.5">
- Count
- <Tooltip.Root>
- <Tooltip.Trigger>
- <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
- </Tooltip.Trigger>
- <Tooltip.Content>
- <p class="text-xs">Number of times this issue occurred</p>
- </Tooltip.Content>
- </Tooltip.Root>
- </span>
- </Table.Head>
- <Table.Head class="h-10 w-[70px] text-right text-sm">
- <span class="flex items-center justify-end gap-1.5">
- When
- <Tooltip.Root>
- <Tooltip.Trigger>
- <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
- </Tooltip.Trigger>
- <Tooltip.Content>
- <p class="text-xs">When this issue last occurred</p>
- </Tooltip.Content>
- </Tooltip.Root>
- </span>
- </Table.Head>
- </Table.Row>
- </Table.Header>
- <Table.Body>
- {#each data.recentIssues as issue}
- <Table.Row
- class="cursor-pointer hover:bg-muted/50"
- onclick={createRowClickHandler(`/issues/${issue.exceptionHash}`)}
- >
- <Table.Cell class="py-3 font-mono text-sm" title={issue.stackTrace}>
- {truncateStackTrace(issue.stackTrace)}
- </Table.Cell>
- <Table.Cell class="py-3 text-right font-medium tabular-nums">
- {issue.count}
- </Table.Cell>
- <Table.Cell class="py-3 text-right text-muted-foreground text-sm tabular-nums">
- {formatRelativeTime(issue.lastSeen)}
- </Table.Cell>
- </Table.Row>
- {/each}
- <Table.Row
- class="cursor-pointer bg-muted/50 hover:bg-muted"
- onclick={createRowClickHandler('/issues')}
- >
- <Table.Cell colspan={3} class="py-2 text-center text-sm text-muted-foreground">
- View all issues <ArrowRight class="inline h-3.5 w-3.5" />
- </Table.Cell>
- </Table.Row>
- </Table.Body>
- {:else}
- <Table.Body>
- <Table.Row>
- <Table.Cell colspan={3} class="h-24 text-center text-muted-foreground">
- No issues in the last 24 hours
- </Table.Cell>
- </Table.Row>
- </Table.Body>
- {/if}
- </Table.Root>
</div>
</div>
- </div>
{/if}
</div>
diff --git a/frontend/src/routes/connection/+page.svelte b/frontend/src/routes/connection/+page.svelte
index 5c4fff3b..61e6c925 100644
--- a/frontend/src/routes/connection/+page.svelte
+++ b/frontend/src/routes/connection/+page.svelte
@@ -1,66 +1,75 @@
<script lang="ts">
- import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '$lib/components/ui/card';
- import { Button } from '$lib/components/ui/button';
- import { Input } from '$lib/components/ui/input';
- import { Label } from '$lib/components/ui/label';
- import { Copy, Check, Eye, EyeOff } from 'lucide-svelte';
- import { projectsState, type ProjectWithToken, type Framework } from '$lib/state/projects.svelte';
- import { Skeleton } from '$lib/components/ui/skeleton';
- import FrameworkIcon from '$lib/components/framework-icon.svelte';
- import Highlight from 'svelte-highlight';
- import go from 'svelte-highlight/languages/go';
- import bash from 'svelte-highlight/languages/bash';
- import { themeState } from '$lib/state/theme.svelte';
- import 'svelte-highlight/styles/github-dark.css';
+ import {
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle
+ } from '$lib/components/ui/card';
+ import { Button } from '$lib/components/ui/button';
+ import { Input } from '$lib/components/ui/input';
+ import { Label } from '$lib/components/ui/label';
+ import { Copy, Check, Eye, EyeOff } from 'lucide-svelte';
+ import { projectsState, type ProjectWithToken, type Framework } from '$lib/state/projects.svelte';
+ import { Skeleton } from '$lib/components/ui/skeleton';
+ import FrameworkIcon from '$lib/components/framework-icon.svelte';
+ import Highlight from 'svelte-highlight';
+ import go from 'svelte-highlight/languages/go';
+ import bash from 'svelte-highlight/languages/bash';
+ import { themeState } from '$lib/state/theme.svelte';
+ import 'svelte-highlight/styles/github-dark.css';
- let projectWithToken = $state<ProjectWithToken | null>(null);
- let loading = $state(true);
- let error = $state<string | null>(null);
- let copiedToken = $state(false);
- let copiedCode = $state(false);
- let copiedInstall = $state(false);
- let showToken = $state(false);
+ let projectWithToken = $state<ProjectWithToken | null>(null);
+ let loading = $state(true);
+ let error = $state<string | null>(null);
+ let copiedToken = $state(false);
+ let copiedCode = $state(false);
+ let copiedInstall = $state(false);
+ let showToken = $state(false);
- // React to project changes
- $effect(() => {
- const projectId = projectsState.currentProjectId;
- if (projectId) {
- loading = true;
- error = null;
- projectWithToken = null;
+ // React to project changes
+ $effect(() => {
+ const projectId = projectsState.currentProjectId;
+ if (projectId) {
+ loading = true;
+ error = null;
+ projectWithToken = null;
- projectsState.getProjectWithToken(projectId)
- .then((project) => {
- projectWithToken = project;
- })
- .catch((e) => {
- error = e instanceof Error ? e.message : 'Failed to load project';
- })
- .finally(() => {
- loading = false;
- });
- } else {
- loading = false;
- projectWithToken = null;
- }
- });
+ projectsState
+ .getProjectWithToken(projectId)
+ .then((project) => {
+ projectWithToken = project;
+ })
+ .catch((e) => {
+ error = e instanceof Error ? e.message : 'Failed to load project';
+ })
+ .finally(() => {
+ loading = false;
+ });
+ } else {
+ loading = false;
+ projectWithToken = null;
+ }
+ });
- async function copyToken() {
- if (projectWithToken?.token) {
- await navigator.clipboard.writeText(projectWithToken.token);
- copiedToken = true;
- setTimeout(() => copiedToken = false, 2000);
- }
- }
+ async function copyToken() {
+ if (projectWithToken?.token) {
+ await navigator.clipboard.writeText(projectWithToken.token);
+ copiedToken = true;
+ setTimeout(() => (copiedToken = false), 2000);
+ }
+ }
- // Framework-specific code snippets
- function getFrameworkCode(framework: Framework, token: string): string {
- const apiUrl = import.meta.env.VITE_API_URL || 'http://localhost:8082';
- const connectionString = token ? `${token}@${apiUrl}/api/client/report` : `YOUR_TOKEN@${apiUrl}/api/client/report`;
+ // Framework-specific code snippets
+ function getFrameworkCode(framework: Framework, token: string): string {
+ const apiUrl = import.meta.env.VITE_API_URL || 'http://localhost:8082';
+ const connectionString = token
+ ? `${token}@${apiUrl}/api/client/report`
+ : `YOUR_TOKEN@${apiUrl}/api/client/report`;
- switch (framework) {
- case 'gin':
- return `import "github.com/traceway-io/go-client/traceway_gin"
+ switch (framework) {
+ case 'gin':
+ return `import "github.com/traceway-io/go-client/traceway_gin"
func main() {
r := gin.Default()
@@ -68,13 +77,13 @@ func main() {
r.Run(":8080")
}`;
- case 'fiber':
- case 'chi':
- case 'fasthttp':
- case 'stdlib':
- case 'custom':
- default:
- return `// This framework is not currently supported.
+ case 'fiber':
+ case 'chi':
+ case 'fasthttp':
+ case 'stdlib':
+ case 'custom':
+ default:
+ return `// This framework is not currently supported.
//
// We welcome contributions! Please visit our GitHub repository
// to help implement support for ${framework === 'custom' ? 'custom frameworks' : framework}:
@@ -105,87 +114,83 @@ func main() {
// traceway.CaptureMessage("Something happened")
// traceway.CaptureMessageWithContext(ctx, "Something happened")
}`;
- }
- }
+ }
+ }
- function getInstallCommand(framework: Framework): string {
- const base = 'go get github.com/traceway-io/go-client';
- switch (framework) {
- case 'gin':
- return `${base}`;
- case 'fiber':
- case 'chi':
- case 'fasthttp':
- case 'stdlib':
- case 'custom':
- default:
- return base;
- }
- }
+ function getInstallCommand(framework: Framework): string {
+ const base = 'go get github.com/traceway-io/go-client';
+ switch (framework) {
+ case 'gin':
+ return `${base}`;
+ case 'fiber':
+ case 'chi':
+ case 'fasthttp':
+ case 'stdlib':
+ case 'custom':
+ default:
+ return base;
+ }
+ }
- function getFrameworkLabel(framework: Framework): string {
- const labels: Record<Framework, string> = {
- gin: 'Gin',
- fiber: 'Fiber',
- chi: 'Chi',
- fasthttp: 'FastHTTP',
- stdlib: 'Standard Library (net/http)',
- custom: 'Custom Integration'
- };
- return labels[framework] || framework;
- }
+ function getFrameworkLabel(framework: Framework): string {
+ const labels: Record<Framework, string> = {
+ gin: 'Gin',
+ fiber: 'Fiber',
+ chi: 'Chi',
+ fasthttp: 'FastHTTP',
+ stdlib: 'Standard Library (net/http)',
+ custom: 'Custom Integration'
+ };
+ return labels[framework] || framework;
+ }
- const sdkCode = $derived(
- projectWithToken
- ? getFrameworkCode(projectWithToken.framework, projectWithToken.token)
- : ''
- );
+ const sdkCode = $derived(
+ projectWithToken ? getFrameworkCode(projectWithToken.framework, projectWithToken.token) : ''
+ );
- const installCommand = $derived(
- projectWithToken
- ? getInstallCommand(projectWithToken.framework)
- : 'go get github.com/traceway-io/go-client'
- );
+ const installCommand = $derived(
+ projectWithToken
+ ? getInstallCommand(projectWithToken.framework)
+ : 'go get github.com/traceway-io/go-client'
+ );
- async function copyCode() {
- await navigator.clipboard.writeText(sdkCode);
- copiedCode = true;
- setTimeout(() => copiedCode = false, 2000);
- }
+ async function copyCode() {
+ await navigator.clipboard.writeText(sdkCode);
+ copiedCode = true;
+ setTimeout(() => (copiedCode = false), 2000);
+ }
- async function copyInstall() {
- await navigator.clipboard.writeText(installCommand);
- copiedInstall = true;
- setTimeout(() => copiedInstall = false, 2000);
- }
+ async function copyInstall() {
+ await navigator.clipboard.writeText(installCommand);
+ copiedInstall = true;
+ setTimeout(() => (copiedInstall = false), 2000);
+ }
</script>
-<div class="space-y-6">
- <div>
- <h2 class="text-3xl font-bold tracking-tight">Connection</h2>
- <p class="text-muted-foreground">
- Connect your application to Traceway using the SDK
- </p>
- </div>
+<div class="space-y-4">
+ <div>
+ <h2 class="text-2xl font-bold tracking-tight">Connection</h2>
+ <p class="text-muted-foreground">Connect your application to Traceway using the SDK</p>
+ </div>
- {#if loading}
- <Card>
- <CardHeader>
- <Skeleton class="h-6 w-32" />
- <Skeleton class="h-4 w-64" />
- </CardHeader>
- <CardContent class="space-y-4">
- <Skeleton class="h-10 w-full" />
- </CardContent>
- </Card>
- {:else if error}
- <Card>
- <CardContent class="p-6">
- <p class="text-destructive">{error}</p>
- </CardContent>
- </Card>
- {:else if projectWithToken}
- <!-- <Card>
+ {#if loading}
+ <Card>
+ <CardHeader>
+ <Skeleton class="h-6 w-32" />
+ <Skeleton class="h-4 w-64" />
+ </CardHeader>
+ <CardContent class="space-y-4">
+ <Skeleton class="h-10 w-full" />
+ </CardContent>
+ </Card>
+ {:else if error}
+ <Card>
+ <CardContent class="p-6">
+ <p class="text-destructive">{error}</p>
+ </CardContent>
+ </Card>
+ {:else if projectWithToken}
+ <!-- <Card>
<CardHeader>
<CardTitle>Project Token</CardTitle>
<CardDescription>
@@ -234,127 +239,125 @@ func main() {
</CardContent>
</Card> -->
- <Card>
- <CardHeader>
- <CardTitle class="flex items-center gap-2">
- <FrameworkIcon framework={projectWithToken.framework} />
- {getFrameworkLabel(projectWithToken.framework)} Integration
- </CardTitle>
- <CardDescription>
- Add Traceway to your Go application with just a few lines of code.
- </CardDescription>
- </CardHeader>
- <CardContent>
- <div class="relative">
- <div class="absolute top-2 right-2 z-10">
- <Button
- variant="outline"
- size="sm"
- onclick={copyCode}
- >
- {#if copiedCode}
- <Check class="h-4 w-4 mr-2 text-green-500" />
- Copied!
- {:else}
- <Copy class="h-4 w-4 mr-2" />
- Copy
- {/if}
- </Button>
- </div>
- <div class="rounded-lg overflow-x-auto text-sm {themeState.isDark ? 'dark-code' : 'light-code'}">
- <Highlight language={go} code={sdkCode} />
- </div>
- </div>
- </CardContent>
- </Card>
+ <Card>
+ <CardHeader>
+ <CardTitle class="flex items-center gap-2">
+ <FrameworkIcon framework={projectWithToken.framework} />
+ {getFrameworkLabel(projectWithToken.framework)} Integration
+ </CardTitle>
+ <CardDescription>
+ Add Traceway to your Go application with just a few lines of code.
+ </CardDescription>
+ </CardHeader>
+ <CardContent>
+ <div class="relative">
+ <div class="absolute top-2 right-2 z-10">
+ <Button variant="outline" size="sm" onclick={copyCode}>
+ {#if copiedCode}
+ <Check class="mr-2 h-4 w-4 text-green-500" />
+ Copied!
+ {:else}
+ <Copy class="mr-2 h-4 w-4" />
+ Copy
+ {/if}
+ </Button>
+ </div>
+ <div
+ class="overflow-x-auto rounded-lg text-sm {themeState.isDark
+ ? 'dark-code'
+ : 'light-code'}"
+ >
+ <Highlight language={go} code={sdkCode} />
+ </div>
+ </div>
+ </CardContent>
+ </Card>
- <Card>
- <CardHeader>
- <CardTitle>Installation</CardTitle>
- <CardDescription>
- Install the required packages using go get.
- </CardDescription>
- </CardHeader>
- <CardContent>
- <div class="relative">
- <div class="absolute top-2 right-2 z-10">
- <Button
- variant="outline"
- size="sm"
- onclick={copyInstall}
- >
- {#if copiedInstall}
- <Check class="h-4 w-4 mr-2 text-green-500" />
- Copied!
- {:else}
- <Copy class="h-4 w-4 mr-2" />
- Copy
- {/if}
- </Button>
- </div>
- <div class="rounded-lg overflow-x-auto text-sm {themeState.isDark ? 'dark-code' : 'light-code'}">
- <Highlight language={bash} code={installCommand} />
- </div>
- </div>
- </CardContent>
- </Card>
- {:else}
- <Card>
- <CardContent class="p-6 text-center">
- <p class="text-muted-foreground">
- No project selected. Please select or create a project from the dropdown above.
- </p>
- </CardContent>
- </Card>
- {/if}
+ <Card>
+ <CardHeader>
+ <CardTitle>Installation</CardTitle>
+ <CardDescription>Install the required packages using go get.</CardDescription>
+ </CardHeader>
+ <CardContent>
+ <div class="relative">
+ <div class="absolute top-2 right-2 z-10">
+ <Button variant="outline" size="sm" onclick={copyInstall}>
+ {#if copiedInstall}
+ <Check class="mr-2 h-4 w-4 text-green-500" />
+ Copied!
+ {:else}
+ <Copy class="mr-2 h-4 w-4" />
+ Copy
+ {/if}
+ </Button>
+ </div>
+ <div
+ class="overflow-x-auto rounded-lg text-sm {themeState.isDark
+ ? 'dark-code'
+ : 'light-code'}"
+ >
+ <Highlight language={bash} code={installCommand} />
+ </div>
+ </div>
+ </CardContent>
+ </Card>
+ {:else}
+ <Card>
+ <CardContent class="p-6 text-center">
+ <p class="text-muted-foreground">
+ No project selected. Please select or create a project from the dropdown above.
+ </p>
+ </CardContent>
+ </Card>
+ {/if}
</div>
<style>
- /* Light theme - override dark theme defaults */
- :global(.light-code .hljs) {
- background: #f6f8fa;
- color: #24292e;
- }
- :global(.light-code .hljs-keyword),
- :global(.light-code .hljs-selector-tag) {
- color: #d73a49;
- }
- :global(.light-code .hljs-string),
- :global(.light-code .hljs-attr) {
- color: #032f62;
- }
- :global(.light-code .hljs-function),
- :global(.light-code .hljs-title) {
- color: #6f42c1;
- }
- :global(.light-code .hljs-comment) {
- color: #6a737d;
- }
- :global(.light-code .hljs-built_in) {
- color: #005cc5;
- }
+ /* Light theme - override dark theme defaults */
+ :global(.light-code .hljs) {
+ background: #f6f8fa;
+ color: #24292e;
+ }
+ :global(.light-code .hljs-keyword),
+ :global(.light-code .hljs-selector-tag) {
+ color: #d73a49;
+ }
+ :global(.light-code .hljs-string),
+ :global(.light-code .hljs-attr) {
+ color: #032f62;
+ }
+ :global(.light-code .hljs-function),
+ :global(.light-code .hljs-title) {
+ color: #6f42c1;
+ }
+ :global(.light-code .hljs-comment) {
+ color: #6a737d;
+ }
+ :global(.light-code .hljs-built_in) {
+ color: #005cc5;
+ }
- /* Dark theme - ensure dark styles apply */
- :global(.dark-code .hljs) {
- background: #0d1117;
- color: #c9d1d9;
- }
- :global(.dark-code .hljs-keyword),
- :global(.dark-code .hljs-selector-tag) {
- color: #ff7b72;
- }
- :global(.dark-code .hljs-string),
- :global(.dark-code .hljs-attr) {
- color: #a5d6ff;
- }
- :global(.dark-code .hljs-function),
- :global(.dark-code .hljs-title) {
- color: #d2a8ff;
- }
- :global(.dark-code .hljs-comment) {
- color: #8b949e;
- }
- :global(.dark-code .hljs-built_in) {
- color: #79c0ff;
- }
+ /* Dark theme - ensure dark styles apply */
+ :global(.dark-code .hljs) {
+ background: #0d1117;
+ color: #c9d1d9;
+ }
+ :global(.dark-code .hljs-keyword),
+ :global(.dark-code .hljs-selector-tag) {
+ color: #ff7b72;
+ }
+ :global(.dark-code .hljs-string),
+ :global(.dark-code .hljs-attr) {
+ color: #a5d6ff;
+ }
+ :global(.dark-code .hljs-function),
+ :global(.dark-code .hljs-title) {
+ color: #d2a8ff;
+ }
+ :global(.dark-code .hljs-comment) {
+ color: #8b949e;
+ }
+ :global(.dark-code .hljs-built_in) {
+ color: #79c0ff;
+ }
</style>
diff --git a/frontend/src/routes/issues/+page.svelte b/frontend/src/routes/issues/+page.svelte
index f5fb1868..09eb337e 100644
--- a/frontend/src/routes/issues/+page.svelte
+++ b/frontend/src/routes/issues/+page.svelte
@@ -1,436 +1,470 @@
<script lang="ts">
- import { onMount } from 'svelte';
- import { createRowClickHandler } from '$lib/utils/navigation';
- import { api } from '$lib/api';
- import * as Table from "$lib/components/ui/table";
- import { Input } from "$lib/components/ui/input";
- import { Button } from "$lib/components/ui/button";
- import * as Select from "$lib/components/ui/select";
- import { LoadingCircle } from "$lib/components/ui/loading-circle";
- import { Checkbox } from "$lib/components/ui/checkbox";
- import { projectsState } from '$lib/state/projects.svelte';
- import IssueTrendChart from '$lib/components/issue-trend-chart.svelte';
- import Archive from "@lucide/svelte/icons/archive";
- import { CircleHelp } from "@lucide/svelte";
- import * as Tooltip from "$lib/components/ui/tooltip";
-
- type ExceptionTrendPoint = {
- timestamp: string;
- count: number;
- };
-
- type ExceptionGroup = {
- exceptionHash: string;
- stackTrace: string;
- lastSeen: string;
- firstSeen: string;
- count: number;
- hourlyTrend: ExceptionTrendPoint[];
- };
-
- let exceptions = $state<ExceptionGroup[]>([]);
- let loading = $state(true);
- let error = $state('');
- let archiving = $state(false);
-
- // Pagination State
- let page = $state(1);
- let pageSize = $state(10);
- let total = $state(0);
- let totalPages = $state(0);
-
- // Selection State
- let selectedHashes = $state<Set<string>>(new Set());
-
- // Derived selection states
- const selectedCount = $derived(selectedHashes.size);
- 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");
-
- // Select options for days back
- const daysOptions = [
- { value: "1", label: "24 Hours" },
- { value: "7", label: "7 Days" }
- ];
-
- // Page size options
- const pageSizeOptions = [
- { value: "10", label: "10" },
- { value: "20", label: "20" },
- { value: "50", label: "50" },
- { 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());
-
-
- async function loadData() {
- loading = true;
- error = '';
-
- try {
- const now = new Date();
- const fromDate = new Date();
- fromDate.setDate(now.getDate() - parseInt(daysBack));
-
- const requestBody = {
- fromDate: fromDate.toISOString(),
- toDate: now.toISOString(),
- orderBy: 'last_seen',
- pagination: {
- page: page,
- pageSize: pageSize
- },
- search: searchQuery.trim(),
- includeArchived: false
- };
-
- const response = await api.post('/exception-stack-traces', requestBody, { projectId: projectsState.currentProjectId ?? undefined });
-
- exceptions = response.data || [];
- total = response.pagination.total;
- totalPages = response.pagination.totalPages;
-
- // Clear selection when data changes
- selectedHashes = new Set();
-
- } catch (e: any) {
- console.error(e);
- error = e.message || 'Failed to load data';
- } finally {
- loading = false;
- }
- }
-
- function handlePageChange(newPage: number) {
- if (newPage >= 1 && newPage <= totalPages) {
- page = newPage;
- loadData();
- }
- }
-
- function handlePageSizeChange(newPageSize: string) {
- pageSize = parseInt(newPageSize);
- page = 1;
- loadData();
- }
-
- // Debounce search input
- let searchTimeout: ReturnType<typeof setTimeout> | null = null;
-
- function handleSearchInput() {
- if (searchTimeout) clearTimeout(searchTimeout);
- searchTimeout = setTimeout(() => {
- page = 1;
- loadData();
- }, 300);
- }
-
- // Selection handlers
- function toggleSelectAll() {
- if (allSelected) {
- selectedHashes = new Set();
- } else {
- selectedHashes = new Set(exceptions.map(e => e.exceptionHash));
- }
- }
-
- function toggleSelect(hash: string) {
- const newSet = new Set(selectedHashes);
- if (newSet.has(hash)) {
- newSet.delete(hash);
- } else {
- newSet.add(hash);
- }
- selectedHashes = newSet;
- }
-
- function isSelected(hash: string): boolean {
- return selectedHashes.has(hash);
- }
-
- // Archive handler
- async function archiveSelected() {
- if (selectedHashes.size === 0) return;
-
- archiving = true;
- try {
- await api.post('/exception-stack-traces/archive', {
- hashes: Array.from(selectedHashes)
- }, { projectId: projectsState.currentProjectId ?? undefined });
-
- selectedHashes = new Set();
- await loadData();
- } catch (e: any) {
- console.error('Archive failed:', e);
- error = e.message || 'Failed to archive issues';
- } finally {
- archiving = false;
- }
- }
-
- onMount(() => {
- loadData();
- });
+ import { onMount } from 'svelte';
+ import { createRowClickHandler } from '$lib/utils/navigation';
+ import { api } from '$lib/api';
+ import * as Table from '$lib/components/ui/table';
+ import { Input } from '$lib/components/ui/input';
+ import { Button } from '$lib/components/ui/button';
+ import * as Select from '$lib/components/ui/select';
+ import { LoadingCircle } from '$lib/components/ui/loading-circle';
+ import { Checkbox } from '$lib/components/ui/checkbox';
+ import { projectsState } from '$lib/state/projects.svelte';
+ import IssueTrendChart from '$lib/components/issue-trend-chart.svelte';
+ import Archive from '@lucide/svelte/icons/archive';
+ import { CircleQuestionMark } from '@lucide/svelte';
+ import * as Tooltip from '$lib/components/ui/tooltip';
+
+ type ExceptionTrendPoint = {
+ timestamp: string;
+ count: number;
+ };
+
+ type ExceptionGroup = {
+ exceptionHash: string;
+ stackTrace: string;
+ lastSeen: string;
+ firstSeen: string;
+ count: number;
+ hourlyTrend: ExceptionTrendPoint[];
+ };
+
+ let exceptions = $state<ExceptionGroup[]>([]);
+ let loading = $state(true);
+ let error = $state('');
+ let archiving = $state(false);
+
+ // Pagination State
+ let page = $state(1);
+ let pageSize = $state(10);
+ let total = $state(0);
+ let totalPages = $state(0);
+
+ // Selection State
+ let selectedHashes = $state<Set<string>>(new Set());
+
+ // Derived selection states
+ const selectedCount = $derived(selectedHashes.size);
+ 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');
+
+ // Select options for days back
+ const daysOptions = [
+ { value: '1', label: '24 Hours' },
+ { value: '7', label: '7 Days' }
+ ];
+
+ // Page size options
+ const pageSizeOptions = [
+ { value: '10', label: '10' },
+ { value: '20', label: '20' },
+ { value: '50', label: '50' },
+ { 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()
+ );
+
+ async function loadData() {
+ loading = true;
+ error = '';
+
+ try {
+ const now = new Date();
+ const fromDate = new Date();
+ fromDate.setDate(now.getDate() - parseInt(daysBack));
+
+ const requestBody = {
+ fromDate: fromDate.toISOString(),
+ toDate: now.toISOString(),
+ orderBy: 'last_seen',
+ pagination: {
+ page: page,
+ pageSize: pageSize
+ },
+ search: searchQuery.trim(),
+ includeArchived: false
+ };
+
+ const response = await api.post('/exception-stack-traces', requestBody, {
+ projectId: projectsState.currentProjectId ?? undefined
+ });
+
+ exceptions = response.data || [];
+ total = response.pagination.total;
+ totalPages = response.pagination.totalPages;
+
+ // Clear selection when data changes
+ selectedHashes = new Set();
+ } catch (e: any) {
+ console.error(e);
+ error = e.message || 'Failed to load data';
+ } finally {
+ loading = false;
+ }
+ }
+
+ function handlePageChange(newPage: number) {
+ if (newPage >= 1 && newPage <= totalPages) {
+ page = newPage;
+ loadData();
+ }
+ }
+
+ function handlePageSizeChange(newPageSize: string) {
+ pageSize = parseInt(newPageSize);
+ page = 1;
+ loadData();
+ }
+
+ // Debounce search input
+ let searchTimeout: ReturnType<typeof setTimeout> | null = null;
+
+ function handleSearchInput() {
+ if (searchTimeout) clearTimeout(searchTimeout);
+ searchTimeout = setTimeout(() => {
+ page = 1;
+ loadData();
+ }, 300);
+ }
+
+ // Selection handlers
+ function toggleSelectAll() {
+ if (allSelected) {
+ selectedHashes = new Set();
+ } else {
+ selectedHashes = new Set(exceptions.map((e) => e.exceptionHash));
+ }
+ }
+
+ function toggleSelect(hash: string) {
+ const newSet = new Set(selectedHashes);
+ if (newSet.has(hash)) {
+ newSet.delete(hash);
+ } else {
+ newSet.add(hash);
+ }
+ selectedHashes = newSet;
+ }
+
+ function isSelected(hash: string): boolean {
+ return selectedHashes.has(hash);
+ }
+
+ // Archive handler
+ async function archiveSelected() {
+ if (selectedHashes.size === 0) return;
+
+ archiving = true;
+ try {
+ await api.post(
+ '/exception-stack-traces/archive',
+ {
+ hashes: Array.from(selectedHashes)
+ },
+ { projectId: projectsState.currentProjectId ?? undefined }
+ );
+
+ selectedHashes = new Set();
+ await loadData();
+ } catch (e: any) {
+ console.error('Archive failed:', e);
+ error = e.message || 'Failed to archive issues';
+ } finally {
+ archiving = false;
+ }
+ }
+
+ onMount(() => {
+ loadData();
+ });
</script>
-<div class="space-y-6">
- <!-- Header with Title and Search + Period Filter -->
- <div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
- <h2 class="text-3xl font-bold tracking-tight">Issues</h2>
- <div class="flex">
- <Input
- placeholder="Search exceptions..."
- class="h-9 w-[250px] lg:w-[320px] rounded-r-none border-r-0 focus:relative focus:z-10"
- bind:value={searchQuery}
- oninput={handleSearchInput}
- />
- <Select.Root
- type="single"
- bind:value={daysBack}
- onValueChange={(v) => {
- if (v) {
- page = 1;
- loadData();
- }
- }}
- >
- <Select.Trigger class="h-9 w-[110px] rounded-l-none -ml-px 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>
-
- <!-- Archive Toolbar - shown when items selected -->
- {#if selectedCount > 0}
- <div class="flex items-center gap-3 p-3 bg-muted/50 border rounded-lg animate-in fade-in slide-in-from-top-1 duration-200">
- <span class="text-sm font-medium">{selectedCount} issue{selectedCount === 1 ? '' : 's'} selected</span>
- <Button
- variant="outline"
- size="sm"
- onclick={archiveSelected}
- disabled={archiving}
- class="gap-1.5"
- >
- <Archive class="h-4 w-4" />
- {archiving ? 'Archiving...' : 'Archive'}
- </Button>
- <Button
- variant="ghost"
- size="sm"
- onclick={() => selectedHashes = new Set()}
- >
- Clear selection
- </Button>
- </div>
- {/if}
-
- <div class="rounded-md border overflow-hidden">
- <Table.Root>
- {#if loading}
- <Table.Body>
- <Table.Row>
- <Table.Cell colspan={5} class="h-48">
- <div class="flex justify-center items-center h-full">
- <LoadingCircle size="xlg" />
- </div>
- </Table.Cell>
- </Table.Row>
- </Table.Body>
- {:else if error}
- <Table.Body>
- <Table.Row>
- <Table.Cell colspan={5} class="h-24 text-center text-red-500">
- {error}
- </Table.Cell>
- </Table.Row>
- </Table.Body>
- {:else if exceptions.length === 0}
- <Table.Body>
- <Table.Row>
- <Table.Cell colspan={5} class="h-24 text-center text-muted-foreground">
- No issues found.
- </Table.Cell>
- </Table.Row>
- </Table.Body>
- {:else}
- <Table.Header>
- <Table.Row>
- <Table.Head class="w-[40px] pl-4">
- <Checkbox
- checked={allSelected ? true : someSelected ? "indeterminate" : false}
- onCheckedChange={toggleSelectAll}
- aria-label="Select all"
- />
- </Table.Head>
- <Table.Head>
- <span class="flex items-center gap-1.5">
- Issue
- <Tooltip.Root>
- <Tooltip.Trigger>
- <CircleHelp class="h-3.5 w-3.5 text-muted-foreground/60" />
- </Tooltip.Trigger>
- <Tooltip.Content>
- <p class="text-xs">The error message or exception that occurred</p>
- </Tooltip.Content>
- </Tooltip.Root>
- </span>
- </Table.Head>
- <Table.Head class="w-[190px]">
- <span class="flex items-center gap-1.5">
- Trend
- <Tooltip.Root>
- <Tooltip.Trigger>
- <CircleHelp class="h-3.5 w-3.5 text-muted-foreground/60" />
- </Tooltip.Trigger>
- <Tooltip.Content>
- <p class="text-xs">Hourly occurrence pattern over the last 24h</p>
- </Tooltip.Content>
- </Tooltip.Root>
- </span>
- </Table.Head>
- <Table.Head class="w-[80px] text-right">
- <span class="flex items-center justify-end gap-1.5">
- Events
- <Tooltip.Root>
- <Tooltip.Trigger>
- <CircleHelp class="h-3.5 w-3.5 text-muted-foreground/60" />
- </Tooltip.Trigger>
- <Tooltip.Content>
- <p class="text-xs">Total number of times this issue occurred in the selected range</p>
- </Tooltip.Content>
- </Tooltip.Root>
- </span>
- </Table.Head>
- <Table.Head class="w-[180px]">
- <span class="flex items-center gap-1.5">
- Last Seen
- <Tooltip.Root>
- <Tooltip.Trigger>
- <CircleHelp class="h-3.5 w-3.5 text-muted-foreground/60" />
- </Tooltip.Trigger>
- <Tooltip.Content>
- <p class="text-xs">When this issue last occurred</p>
- </Tooltip.Content>
- </Tooltip.Root>
- </span>
- </Table.Head>
- </Table.Row>
- </Table.Header>
- <Table.Body>
- {#each exceptions as exception (exception.exceptionHash)}
- <Table.Row
- class="cursor-pointer hover:bg-muted/50 group"
- data-state={isSelected(exception.exceptionHash) ? "selected" : undefined}
- >
- <Table.Cell class="pl-4" onclick={(e) => e.stopPropagation()}>
- <Checkbox
- checked={isSelected(exception.exceptionHash)}
- onCheckedChange={() => toggleSelect(exception.exceptionHash)}
- aria-label="Select row"
- />
- </Table.Cell>
- <Table.Cell
- class="font-mono text-sm truncate max-w-[400px]"
- title={exception.stackTrace}
- onclick={createRowClickHandler(`/issues/${exception.exceptionHash}`)}
- >
- <span class="text-foreground">{exception.stackTrace.split('\n')[0]}</span>
- </Table.Cell>
- <Table.Cell onclick={createRowClickHandler(`/issues/${exception.exceptionHash}`)}>
- <IssueTrendChart trend={exception.hourlyTrend || []} />
- </Table.Cell>
- <Table.Cell
- class="text-right tabular-nums font-medium"
- onclick={createRowClickHandler(`/issues/${exception.exceptionHash}`)}
- >
- {exception.count.toLocaleString()}
- </Table.Cell>
- <Table.Cell
- class="text-muted-foreground"
- onclick={createRowClickHandler(`/issues/${exception.exceptionHash}`)}
- >
- {new Date(exception.lastSeen).toLocaleString()}
- </Table.Cell>
- </Table.Row>
- {/each}
- </Table.Body>
- {/if}
- </Table.Root>
- </div>
-
- <!-- Pagination Footer -->
- <div class="flex items-center justify-between px-2">
- <div class="flex-1 text-sm text-muted-foreground">
- {#if selectedCount > 0}
- {selectedCount} of {total} row(s) selected.
- {:else}
- {total} issue{total === 1 ? '' : 's'} total
- {/if}
- </div>
- <div class="flex items-center space-x-6 lg:space-x-8">
- <div class="flex items-center space-x-2">
- <p class="text-sm font-medium">Rows per page</p>
- <Select.Root
- type="single"
- value={pageSize.toString()}
- onValueChange={(v) => {
- if (v) {
- handlePageSizeChange(v);
- }
- }}
- >
- <Select.Trigger class="h-8 w-[70px]">
- {pageSizeLabel}
- </Select.Trigger>
- <Select.Content side="top">
- {#each pageSizeOptions as option}
- <Select.Item value={option.value} label={option.label}>{option.label}</Select.Item>
- {/each}
- </Select.Content>
- </Select.Root>
- </div>
- <div class="flex w-[100px] items-center justify-center text-sm font-medium">
- Page {page} of {totalPages || 1}
- </div>
- <div class="flex items-center space-x-2">
- <Button
- variant="outline"
- size="sm"
- class="h-8 w-8 p-0"
- onclick={() => handlePageChange(page - 1)}
- disabled={page <= 1 || loading}
- >
- <span class="sr-only">Go to previous page</span>
- <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15" fill="none" class="lucide lucide-chevron-left h-4 w-4">
- <path d="M8.84182 3.13514C9.04327 3.32401 9.05348 3.64042 8.86462 3.84188L5.43521 7.49991L8.86462 11.1579C9.05348 11.3594 9.04327 11.6758 8.84182 11.8647C8.64036 12.0535 8.32394 12.0433 8.13508 11.8419L4.38508 7.84188C4.20477 7.64955 4.20477 7.35027 4.38508 7.15794L8.13508 3.15794C8.32394 2.95648 8.64036 2.94628 8.84182 3.13514Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path>
- </svg>
- </Button>
- <Button
- variant="outline"
- size="sm"
- class="h-8 w-8 p-0"
- onclick={() => handlePageChange(page + 1)}
- disabled={page >= totalPages || loading}
- >
- <span class="sr-only">Go to next page</span>
- <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15" fill="none" class="lucide lucide-chevron-right h-4 w-4">
- <path d="M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z" fill="currentColor" fill-rule="evenodd" clip-rule="evenodd"></path>
- </svg>
- </Button>
- </div>
- </div>
- </div>
+<div class="space-y-4">
+ <!-- Header with Title and Search + Period Filter -->
+ <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}
+ />
+ <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>
+
+ <!-- Archive Toolbar - shown when items selected -->
+ {#if selectedCount > 0}
+ <div
+ class="flex animate-in items-center gap-3 rounded-lg border bg-muted/50 p-3 duration-200 fade-in slide-in-from-top-1"
+ >
+ <span class="text-sm font-medium"
+ >{selectedCount} issue{selectedCount === 1 ? '' : 's'} selected</span
+ >
+ <Button
+ variant="outline"
+ size="sm"
+ onclick={archiveSelected}
+ disabled={archiving}
+ class="gap-1.5"
+ >
+ <Archive class="h-4 w-4" />
+ {archiving ? 'Archiving...' : 'Archive'}
+ </Button>
+ <Button variant="ghost" size="sm" onclick={() => (selectedHashes = new Set())}>
+ Clear selection
+ </Button>
+ </div>
+ {/if}
+
+ <div class="overflow-hidden rounded-md border">
+ <Table.Root>
+ {#if loading}
+ <Table.Body>
+ <Table.Row>
+ <Table.Cell colspan={5} class="h-48">
+ <div class="flex h-full items-center justify-center">
+ <LoadingCircle size="xlg" />
+ </div>
+ </Table.Cell>
+ </Table.Row>
+ </Table.Body>
+ {:else if error}
+ <Table.Body>
+ <Table.Row>
+ <Table.Cell colspan={5} class="h-24 text-center text-red-500">
+ {error}
+ </Table.Cell>
+ </Table.Row>
+ </Table.Body>
+ {:else if exceptions.length === 0}
+ <Table.Body>
+ <Table.Row>
+ <Table.Cell colspan={5} class="h-24 text-center text-muted-foreground">
+ No issues found.
+ </Table.Cell>
+ </Table.Row>
+ </Table.Body>
+ {:else}
+ <Table.Header>
+ <Table.Row>
+ <Table.Head class="w-[40px] pl-4">
+ <Checkbox
+ checked={allSelected ? true : someSelected ? 'indeterminate' : false}
+ onCheckedChange={toggleSelectAll}
+ aria-label="Select all"
+ />
+ </Table.Head>
+ <Table.Head>
+ <span class="flex items-center gap-1.5">
+ Issue
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
+ </Tooltip.Trigger>
+ <Tooltip.Content>
+ <p class="text-xs">The error message or exception that occurred</p>
+ </Tooltip.Content>
+ </Tooltip.Root>
+ </span>
+ </Table.Head>
+ <Table.Head class="w-[190px]">
+ <span class="flex items-center gap-1.5">
+ Trend
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
+ </Tooltip.Trigger>
+ <Tooltip.Content>
+ <p class="text-xs">Hourly occurrence pattern over the last 24h</p>
+ </Tooltip.Content>
+ </Tooltip.Root>
+ </span>
+ </Table.Head>
+ <Table.Head class="w-[80px] text-right">
+ <span class="flex items-center justify-end gap-1.5">
+ Events
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
+ </Tooltip.Trigger>
+ <Tooltip.Content>
+ <p class="text-xs">
+ Total number of times this issue occurred in the selected range
+ </p>
+ </Tooltip.Content>
+ </Tooltip.Root>
+ </span>
+ </Table.Head>
+ <Table.Head class="w-[180px]">
+ <span class="flex items-center gap-1.5">
+ Last Seen
+ <Tooltip.Root>
+ <Tooltip.Trigger>
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
+ </Tooltip.Trigger>
+ <Tooltip.Content>
+ <p class="text-xs">When this issue last occurred</p>
+ </Tooltip.Content>
+ </Tooltip.Root>
+ </span>
+ </Table.Head>
+ </Table.Row>
+ </Table.Header>
+ <Table.Body>
+ {#each exceptions as exception (exception.exceptionHash)}
+ <Table.Row
+ class="group cursor-pointer hover:bg-muted/50"
+ data-state={isSelected(exception.exceptionHash) ? 'selected' : undefined}
+ >
+ <Table.Cell class="pl-4" onclick={(e) => e.stopPropagation()}>
+ <Checkbox
+ checked={isSelected(exception.exceptionHash)}
+ onCheckedChange={() => toggleSelect(exception.exceptionHash)}
+ aria-label="Select row"
+ />
+ </Table.Cell>
+ <Table.Cell
+ class="max-w-[400px] truncate font-mono text-sm"
+ title={exception.stackTrace}
+ onclick={createRowClickHandler(`/issues/${exception.exceptionHash}`)}
+ >
+ <span class="text-foreground">{exception.stackTrace.split('\n')[0]}</span>
+ </Table.Cell>
+ <Table.Cell onclick={createRowClickHandler(`/issues/${exception.exceptionHash}`)}>
+ <IssueTrendChart trend={exception.hourlyTrend || []} />
+ </Table.Cell>
+ <Table.Cell
+ class="text-right font-medium tabular-nums"
+ onclick={createRowClickHandler(`/issues/${exception.exceptionHash}`)}
+ >
+ {exception.count.toLocaleString()}
+ </Table.Cell>
+ <Table.Cell
+ class="text-muted-foreground"
+ onclick={createRowClickHandler(`/issues/${exception.exceptionHash}`)}
+ >
+ {new Date(exception.lastSeen).toLocaleString()}
+ </Table.Cell>
+ </Table.Row>
+ {/each}
+ </Table.Body>
+ {/if}
+ </Table.Root>
+ </div>
+
+ <!-- Pagination Footer -->
+ <div class="flex items-center justify-between px-2">
+ <div class="flex-1 text-sm text-muted-foreground">
+ {#if selectedCount > 0}
+ {selectedCount} of {total} row(s) selected.
+ {:else}
+ {total} issue{total === 1 ? '' : 's'} total
+ {/if}
+ </div>
+ <div class="flex items-center space-x-6 lg:space-x-8">
+ <div class="flex items-center space-x-2">
+ <p class="text-sm font-medium">Rows per page</p>
+ <Select.Root
+ type="single"
+ value={pageSize.toString()}
+ onValueChange={(v) => {
+ if (v) {
+ handlePageSizeChange(v);
+ }
+ }}
+ >
+ <Select.Trigger class="h-8 w-[70px]">
+ {pageSizeLabel}
+ </Select.Trigger>
+ <Select.Content side="top">
+ {#each pageSizeOptions as option}
+ <Select.Item value={option.value} label={option.label}>{option.label}</Select.Item>
+ {/each}
+ </Select.Content>
+ </Select.Root>
+ </div>
+ <div class="flex w-[100px] items-center justify-center text-sm font-medium">
+ Page {page} of {totalPages || 1}
+ </div>
+ <div class="flex items-center space-x-2">
+ <Button
+ variant="outline"
+ size="sm"
+ class="h-8 w-8 p-0"
+ onclick={() => handlePageChange(page - 1)}
+ disabled={page <= 1 || loading}
+ >
+ <span class="sr-only">Go to previous page</span>
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="15"
+ height="15"
+ viewBox="0 0 15 15"
+ fill="none"
+ class="lucide lucide-chevron-left h-4 w-4"
+ >
+ <path
+ d="M8.84182 3.13514C9.04327 3.32401 9.05348 3.64042 8.86462 3.84188L5.43521 7.49991L8.86462 11.1579C9.05348 11.3594 9.04327 11.6758 8.84182 11.8647C8.64036 12.0535 8.32394 12.0433 8.13508 11.8419L4.38508 7.84188C4.20477 7.64955 4.20477 7.35027 4.38508 7.15794L8.13508 3.15794C8.32394 2.95648 8.64036 2.94628 8.84182 3.13514Z"
+ fill="currentColor"
+ fill-rule="evenodd"
+ clip-rule="evenodd"
+ ></path>
+ </svg>
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
+ class="h-8 w-8 p-0"
+ onclick={() => handlePageChange(page + 1)}
+ disabled={page >= totalPages || loading}
+ >
+ <span class="sr-only">Go to next page</span>
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ width="15"
+ height="15"
+ viewBox="0 0 15 15"
+ fill="none"
+ class="lucide lucide-chevron-right h-4 w-4"
+ >
+ <path
+ d="M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z"
+ fill="currentColor"
+ fill-rule="evenodd"
+ clip-rule="evenodd"
+ ></path>
+ </svg>
+ </Button>
+ </div>
+ </div>
+ </div>
</div>
diff --git a/frontend/src/routes/issues/[exceptionHash]/events/+page.svelte b/frontend/src/routes/issues/[exceptionHash]/events/+page.svelte
index 31faab19..fc52409f 100644
--- a/frontend/src/routes/issues/[exceptionHash]/events/+page.svelte
+++ b/frontend/src/routes/issues/[exceptionHash]/events/+page.svelte
@@ -11,7 +11,7 @@
import { Skeleton } from "$lib/components/ui/skeleton";
import { ErrorDisplay } from "$lib/components/ui/error-display";
import { projectsState } from '$lib/state/projects.svelte';
- import { CircleHelp } from "lucide-svelte";
+ import { CircleQuestionMark } from "lucide-svelte";
import * as Tooltip from "$lib/components/ui/tooltip";
type ExceptionGroup = {
@@ -173,7 +173,7 @@
Recorded At
<Tooltip.Root>
<Tooltip.Trigger>
- <CircleHelp class="h-3.5 w-3.5 text-muted-foreground/60" />
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
</Tooltip.Trigger>
<Tooltip.Content>
<p class="text-xs">When this occurrence was recorded</p>
@@ -186,7 +186,7 @@
Server
<Tooltip.Root>
<Tooltip.Trigger>
- <CircleHelp class="h-3.5 w-3.5 text-muted-foreground/60" />
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
</Tooltip.Trigger>
<Tooltip.Content>
<p class="text-xs">Server instance where error occurred</p>
@@ -199,7 +199,7 @@
Transaction
<Tooltip.Root>
<Tooltip.Trigger>
- <CircleHelp class="h-3.5 w-3.5 text-muted-foreground/60" />
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
</Tooltip.Trigger>
<Tooltip.Content>
<p class="text-xs">Transaction ID if this occurred during a request</p>
diff --git a/frontend/src/routes/metrics/+page.svelte b/frontend/src/routes/metrics/+page.svelte
index c55bfdf5..b4ee84cd 100644
--- a/frontend/src/routes/metrics/+page.svelte
+++ b/frontend/src/routes/metrics/+page.svelte
@@ -6,7 +6,12 @@
import { RefreshCw } from 'lucide-svelte';
import MetricCard from '$lib/components/dashboard/metric-card.svelte';
import ServerFilter from '$lib/components/dashboard/server-filter.svelte';
- import type { DashboardData, DashboardMetric, ServerMetricTrend, MetricTrendPoint } from '$lib/types/dashboard';
+ import type {
+ DashboardData,
+ DashboardMetric,
+ ServerMetricTrend,
+ MetricTrendPoint
+ } from '$lib/types/dashboard';
import { Card, CardContent } from '$lib/components/ui/card';
import { api } from '$lib/api';
import { ErrorDisplay } from '$lib/components/ui/error-display';
@@ -38,7 +43,7 @@
'3d': 4320,
'7d': 10080,
'1M': 43200,
- '3M': 129600,
+ '3M': 129600
};
// Calculate time range from preset
@@ -50,7 +55,12 @@
}
// Parse URL params
- function parseUrlParams(): { preset: string | null; from: Date | null; to: Date | null; servers: string[] } {
+ function parseUrlParams(): {
+ preset: string | null;
+ from: Date | null;
+ to: Date | null;
+ servers: string[];
+ } {
if (!browser) return { preset: '6h', from: null, to: null, servers: [] };
const params = new URLSearchParams(window.location.search);
const presetParam = params.get('preset');
@@ -59,7 +69,7 @@
const serversParam = params.get('servers');
// Parse servers from URL
- const servers = serversParam ? serversParam.split(',').filter(s => s.length > 0) : [];
+ const servers = serversParam ? serversParam.split(',').filter((s) => s.length > 0) : [];
// If preset is specified, use it
if (presetParam && presetMinutes[presetParam]) {
@@ -167,7 +177,11 @@
return `${dateStr}T${toTime || '23:59'}`;
}
- function handleTimeRangeChange(from: { date: CalendarDate; time: string }, to: { date: CalendarDate; time: string }, preset: string | null) {
+ function handleTimeRangeChange(
+ from: { date: CalendarDate; time: string },
+ to: { date: CalendarDate; time: string },
+ preset: string | null
+ ) {
fromDate = from.date;
fromTime = from.time;
toDate = to.date;
@@ -224,29 +238,34 @@
// Transform the API response to match the DashboardData type
// Convert timestamp strings to Date objects
// Handle case where metrics might be null/undefined (no data)
- const metrics: DashboardMetric[] = (response.metrics && Array.isArray(response.metrics))
- ? response.metrics.map((m: any) => ({
- id: m.id,
- name: m.name,
- value: m.value,
- unit: m.unit,
- trend: (m.trend || []).map((t: any) => ({
- timestamp: new Date(t.timestamp),
- value: t.value
- })),
- change24h: m.change24h,
- status: m.status,
- // Include per-server data if available
- servers: m.servers?.map((s: any): ServerMetricTrend => ({
- serverName: s.serverName,
- value: s.value,
- trend: (s.trend || []).map((t: any): MetricTrendPoint => ({
- timestamp: new Date(t.timestamp),
- value: t.value
+ const metrics: DashboardMetric[] =
+ response.metrics && Array.isArray(response.metrics)
+ ? response.metrics.map((m: any) => ({
+ id: m.id,
+ name: m.name,
+ value: m.value,
+ unit: m.unit,
+ trend: (m.trend || []).map((t: any) => ({
+ timestamp: new Date(t.timestamp),
+ value: t.value
+ })),
+ change24h: m.change24h,
+ status: m.status,
+ // Include per-server data if available
+ servers: m.servers?.map(
+ (s: any): ServerMetricTrend => ({
+ serverName: s.serverName,
+ value: s.value,
+ trend: (s.trend || []).map(
+ (t: any): MetricTrendPoint => ({
+ timestamp: new Date(t.timestamp),
+ value: t.value
+ })
+ )
+ })
+ )
}))
- }))
- }))
- : [];
+ : [];
dashboardData = {
metrics,
@@ -290,7 +309,7 @@
<!-- Header -->
<div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
<div>
- <h2 class="text-3xl font-bold tracking-tight">Metrics</h2>
+ <h2 class="text-2xl font-bold tracking-tight">Metrics</h2>
{#if dashboardData}
<p class="mt-1 text-sm text-muted-foreground">Last updated: {lastUpdatedFormatted}</p>
{/if}
@@ -319,7 +338,13 @@
{#if error && !loading}
<ErrorDisplay
- status={errorStatus === 404 ? 404 : errorStatus === 400 ? 400 : errorStatus === 422 ? 422 : 400}
+ status={errorStatus === 404
+ ? 404
+ : errorStatus === 400
+ ? 400
+ : errorStatus === 422
+ ? 422
+ : 400}
title="Failed to Load Metrics"
description={error}
onRetry={() => loadDashboard()}
@@ -328,16 +353,21 @@
<!-- Metrics Grid -->
{#if !error}
- <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4">
- {#if loading}
- <div class="col-span-full flex justify-center items-center py-20">
- <LoadingCircle size="xlg" />
- </div>
- {:else if dashboardData}
- {#each dashboardData.metrics as metric (metric.id)}
- <MetricCard {metric} timeDomain={sharedTimeDomain} onRangeSelect={handleChartRangeSelect} {serverColorMap} />
- {/each}
- {/if}
- </div>
+ <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4">
+ {#if loading}
+ <div class="col-span-full flex items-center justify-center py-20">
+ <LoadingCircle size="xlg" />
+ </div>
+ {:else if dashboardData}
+ {#each dashboardData.metrics as metric (metric.id)}
+ <MetricCard
+ {metric}
+ timeDomain={sharedTimeDomain}
+ onRangeSelect={handleChartRangeSelect}
+ {serverColorMap}
+ />
+ {/each}
+ {/if}
+ </div>
{/if}
</div>
diff --git a/frontend/src/routes/transactions/+page.svelte b/frontend/src/routes/transactions/+page.svelte
index c4409306..0d8de55f 100644
--- a/frontend/src/routes/transactions/+page.svelte
+++ b/frontend/src/routes/transactions/+page.svelte
@@ -6,7 +6,7 @@
import { Button } from "$lib/components/ui/button";
import { LoadingCircle } from "$lib/components/ui/loading-circle";
import * as Select from "$lib/components/ui/select";
- import { ArrowUpDown, ArrowDown, ArrowUp, TriangleAlert, CircleHelp } from "@lucide/svelte";
+ import { ArrowUpDown, ArrowDown, ArrowUp, TriangleAlert, CircleQuestionMark } from "@lucide/svelte";
import * as Tooltip from "$lib/components/ui/tooltip";
import { TimeRangePicker } from "$lib/components/ui/time-range-picker";
import { CalendarDate, getLocalTimeZone, today } from "@internationalized/date";
@@ -310,10 +310,10 @@
});
</script>
-<div class="space-y-6">
+<div class="space-y-4">
<!-- Header with Title and Time Range Filter -->
<div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
- <h2 class="text-3xl font-bold tracking-tight">Transactions</h2>
+ <h2 class="text-2xl font-bold tracking-tight">Transactions</h2>
<TimeRangePicker
bind:fromDate
bind:toDate
@@ -361,7 +361,7 @@
Endpoint
<Tooltip.Root>
<Tooltip.Trigger>
- <CircleHelp class="h-3.5 w-3.5 text-muted-foreground/60" />
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
</Tooltip.Trigger>
<Tooltip.Content>
<p class="text-xs">The API route or page being accessed</p>
@@ -390,7 +390,7 @@
</Button>
<Tooltip.Root>
<Tooltip.Trigger>
- <CircleHelp class="h-3.5 w-3.5 text-muted-foreground/60" />
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
</Tooltip.Trigger>
<Tooltip.Content>
<p class="text-xs">Total number of requests</p>
@@ -419,7 +419,7 @@
</Button>
<Tooltip.Root>
<Tooltip.Trigger>
- <CircleHelp class="h-3.5 w-3.5 text-muted-foreground/60" />
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
</Tooltip.Trigger>
<Tooltip.Content>
<p class="text-xs">Median response time (P50)</p>
@@ -448,7 +448,7 @@
</Button>
<Tooltip.Root>
<Tooltip.Trigger>
- <CircleHelp class="h-3.5 w-3.5 text-muted-foreground/60" />
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
</Tooltip.Trigger>
<Tooltip.Content>
<p class="text-xs">95th percentile - slowest 5% of requests</p>
@@ -477,7 +477,7 @@
</Button>
<Tooltip.Root>
<Tooltip.Trigger>
- <CircleHelp class="h-3.5 w-3.5 text-muted-foreground/60" />
+ <CircleQuestionMark class="h-3.5 w-3.5 text-muted-foreground/60" />
</Tooltip.Trigger>
<Tooltip.Content>
<p class="text-xs">Priority based on traffic × response time variance</p>
diff --git a/frontend/src/routes/transactions/[endpoint]/[transactionId]/+page.svelte b/frontend/src/routes/transactions/[endpoint]/[transactionId]/+page.svelte
index 09a26c32..cd19ffcb 100644
--- a/frontend/src/routes/transactions/[endpoint]/[transactionId]/+page.svelte
+++ b/frontend/src/routes/transactions/[endpoint]/[transactionId]/+page.svelte
@@ -105,7 +105,7 @@
<h2 class="font-mono text-2xl font-bold tracking-tight">
{decodeURIComponent(data.endpoint)}
</h2>
- <p class="text-muted-foreground text-sm">Transaction ID: {data.transactionId}</p>
+ <p class="text-sm text-muted-foreground">Transaction ID: {data.transactionId}</p>
</div>
</div>
@@ -125,7 +125,7 @@
status={404}
title="Transaction Not Found"
description="The transaction you're looking for doesn't exist or may have expired."
- backHref={backHref}
+ {backHref}
backLabel="Back to Endpoint"
onRetry={loadData}
identifier={data.transactionId}
@@ -135,48 +135,73 @@
status={400}
title="Failed to Load Transaction"
description={error}
- backHref={backHref}
+ {backHref}
backLabel="Back to Endpoint"
onRetry={loadData}
/>
{:else if response}
- <!-- Transaction Summary Card -->
+ <!-- Transaction Details Card -->
<Card.Root>
<Card.Header>
<Card.Title>Transaction Details</Card.Title>
- <Card.Description>
- Recorded: {new Date(response.transaction.recordedAt).toLocaleString()}
- </Card.Description>
+ <Card.Description>Details of this specific transaction occurrence</Card.Description>
</Card.Header>
- <Card.Content>
+ <Card.Content class="space-y-6">
<div class="grid grid-cols-2 gap-4 md:grid-cols-4">
<div class="space-y-1">
- <p class="text-muted-foreground text-sm">Duration</p>
- <p class="font-mono text-lg">{formatDuration(response.transaction.duration)}</p>
+ <p class="text-sm text-muted-foreground">Endpoint</p>
+ <p class="truncate font-mono text-sm" title={decodeURIComponent(data.endpoint)}>
+ {decodeURIComponent(data.endpoint)}
+ </p>
</div>
<div class="space-y-1">
- <p class="text-muted-foreground text-sm">Status</p>
- <p class="font-mono text-lg {getStatusColor(response.transaction.statusCode)}">
+ <p class="text-sm text-muted-foreground">Status</p>
+ <p class="font-mono {getStatusColor(response.transaction.statusCode)}">
{response.transaction.statusCode}
</p>
</div>
<div class="space-y-1">
- <p class="text-muted-foreground text-sm">Body Size</p>
- <p class="font-mono">{formatBytes(response.transaction.bodySize)}</p>
+ <p class="text-sm text-muted-foreground">Duration</p>
+ <p class="font-mono">{formatDuration(response.transaction.duration)}</p>
+ </div>
+ <div class="space-y-1">
+ <p class="text-sm text-muted-foreground">Recorded At</p>
+ <p class="font-mono text-sm">
+ {new Date(response.transaction.recordedAt).toLocaleString()}
+ </p>
+ </div>
+ <div class="space-y-1">
+ <p class="text-sm text-muted-foreground">Server</p>
+ <p class="font-mono text-sm">{response.transaction.serverName || '-'}</p>
</div>
<div class="space-y-1">
- <p class="text-muted-foreground text-sm">Client IP</p>
- <p class="font-mono">{response.transaction.clientIP || '-'}</p>
+ <p class="text-sm text-muted-foreground">Version</p>
+ <p class="font-mono text-sm">{response.transaction.appVersion || '-'}</p>
</div>
<div class="space-y-1">
- <p class="text-muted-foreground text-sm">Server</p>
- <p class="font-mono">{response.transaction.serverName || '-'}</p>
+ <p class="text-sm text-muted-foreground">Client IP</p>
+ <p class="font-mono text-sm">{response.transaction.clientIP || '-'}</p>
</div>
<div class="space-y-1">
- <p class="text-muted-foreground text-sm">Version</p>
- <p class="font-mono">{response.transaction.appVersion || '-'}</p>
+ <p class="text-sm text-muted-foreground">Body Size</p>
+ <p class="font-mono text-sm">{formatBytes(response.transaction.bodySize)}</p>
</div>
</div>
+
+ {#if response.transaction.scope && Object.keys(response.transaction.scope).length > 0}
+ <hr class="border-border" />
+ <div>
+ <p class="mb-3 text-sm font-medium">Context</p>
+ <div class="grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3">
+ {#each Object.entries(response.transaction.scope).sort( (a, b) => a[0].localeCompare(b[0]) ) as [key, value]}
+ <div class="flex flex-col gap-1 rounded-md bg-muted p-3">
+ <span class="text-xs font-medium text-muted-foreground">{key}</span>
+ <span class="font-mono text-sm break-all">{value}</span>
+ </div>
+ {/each}
+ </div>
+ </div>
+ {/if}
</Card.Content>
</Card.Root>
@@ -191,10 +216,19 @@
<Card.Description>This transaction resulted in an exception</Card.Description>
</Card.Header>
<Card.Content>
- <div class="bg-muted rounded-md p-3 overflow-x-auto max-h-32 mb-4">
- <pre class="text-sm font-mono whitespace-pre-wrap">{response.exception.stackTrace.split('\n').slice(0, 4).join('\n')}{response.exception.stackTrace.split('\n').length > 4 ? '\n...' : ''}</pre>
+ <div class="mb-4 max-h-32 overflow-x-auto rounded-md bg-muted p-3">
+ <pre class="font-mono text-sm whitespace-pre-wrap">{response.exception.stackTrace
+ .split('\n')
+ .slice(0, 4)
+ .join('\n')}{response.exception.stackTrace.split('\n').length > 4
+ ? '\n...'
+ : ''}</pre>
</div>
- <Button variant="outline" size="sm" onclick={() => goto(`/issues/${response!.exception!.exceptionHash}`)}>
+ <Button
+ variant="outline"
+ size="sm"
+ onclick={() => goto(`/issues/${response!.exception!.exceptionHash}`)}
+ >
View Full Exception
<ArrowRight class="ml-2 h-4 w-4" />
</Button>
@@ -226,25 +260,5 @@
{/if}
</Card.Content>
</Card.Root>
-
- <!-- Context Card (if scope exists) -->
- {#if response.transaction.scope && Object.keys(response.transaction.scope).length > 0}
- <Card.Root>
- <Card.Header>
- <Card.Title>Context</Card.Title>
- <Card.Description>Additional context captured with this transaction</Card.Description>
- </Card.Header>
- <Card.Content>
- <div class="grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3">
- {#each Object.entries(response.transaction.scope).sort((a, b) => a[0].localeCompare(b[0])) as [key, value]}
- <div class="bg-muted flex flex-col gap-1 rounded-md p-3">
- <span class="text-muted-foreground text-xs font-medium">{key}</span>
- <span class="break-all font-mono text-sm">{value}</span>
- </div>
- {/each}
- </div>
- </Card.Content>
- </Card.Root>
- {/if}
{/if}
</div>