Skip to content

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

feat: made long query segments not show the full query

ddux073b6d2ce09c
diff --git a/frontend/src/lib/components/segments/segment-row.svelte b/frontend/src/lib/components/segments/segment-row.svelte
index afca23e3..2f1f4db4 100644
--- a/frontend/src/lib/components/segments/segment-row.svelte
+++ b/frontend/src/lib/components/segments/segment-row.svelte
@@ -4,17 +4,17 @@
import { formatDuration } from '$lib/utils/formatters';
type Props = {
- row: number,
+ row: number;
segment: Segment;
transactionStart: number;
transactionDuration: number;
isOdd: boolean;
nameColumnWidth: number;
- updateNameWidth: (width: number) => void;
+ updateNameWidth: (width: number) => void;
- segmentCellHandleMouseEnter: (x: number) => void,
- segmentCellHandleMouseMove: (x: number) => void,
- segmentCellHandleMouseLeave: () => void,
+ segmentCellHandleMouseEnter: (x: number) => void;
+ segmentCellHandleMouseMove: (x: number) => void;
+ segmentCellHandleMouseLeave: () => void;
};
let {
@@ -27,7 +27,7 @@
updateNameWidth,
segmentCellHandleMouseEnter,
segmentCellHandleMouseMove,
- segmentCellHandleMouseLeave,
+ segmentCellHandleMouseLeave
}: Props = $props();
const segmentStartMs = $derived(new Date(segment.startTime).getTime() - transactionStart);
@@ -54,7 +54,7 @@
{ bg: 'bg-lime-400', ring: 'ring-lime-500' },
{ bg: 'bg-rose-400', ring: 'ring-rose-500' },
{ bg: 'bg-sky-400', ring: 'ring-sky-500' },
- { bg: 'bg-slate-400', ring: 'ring-slate-500' },
+ { bg: 'bg-slate-400', ring: 'ring-slate-500' }
];
const segmentColor = $derived(segmentColors[row % segmentColors.length]);
@@ -85,32 +85,36 @@
let nameElement: HTMLDivElement;
- $effect(() => {
- if (nameElement) {
- // Measure the natural width needed
- const naturalWidth = nameElement.scrollWidth;
- updateNameWidth?.(naturalWidth);
- }
- });
+ $effect(() => {
+ if (nameElement) {
+ // Measure the natural width needed
+ const naturalWidth = nameElement.scrollWidth;
+ updateNameWidth?.(naturalWidth);
+ }
+ });
</script>
-<div class={cn('border-border flex items-center border-b last:border-b-0', isOdd ? 'bg-muted/40' : '')}>
+<div
+ class={cn('flex items-center border-b border-border last:border-b-0', isOdd ? 'bg-muted/40' : '')}
+>
<!-- Segment name -->
<div
bind:this={nameElement}
- class="border-border flex-shrink-0 truncate border-r px-3 py-1.5 font-mono text-xs"
- style="min-width: {nameColumnWidth}px"
+ class="flex-shrink-0 truncate border-r border-border px-3 py-1.5 font-mono text-xs"
+ style="min-width: {nameColumnWidth}px; max-width: {nameColumnWidth}px"
title={segment.name}
>
{segment.name}
</div>
<!-- Timeline bar -->
- <div class="relative flex-1 min-w-[200px] self-stretch flex items-center"
+ <div
+ class="relative flex min-w-[200px] flex-1 items-center self-stretch"
bind:this={containerElement}
onmouseenter={containerSegmentCellHandleMouseEnter}
onmousemove={containerSegmentCellHandleMouseMove}
- onmouseleave={segmentCellHandleMouseLeave}>
+ onmouseleave={segmentCellHandleMouseLeave}
+ >
<div class="relative h-4 w-full">
<div
bind:this={barElement}
@@ -128,7 +132,9 @@
</div>
<!-- Duration -->
- <div class="text-muted-foreground border-border w-[100px] flex-shrink-0 border-l px-3 py-1.5 text-right font-mono text-xs">
+ <div
+ class="w-[100px] flex-shrink-0 border-l border-border px-3 py-1.5 text-right font-mono text-xs text-muted-foreground"
+ >
{formatDuration(segment.duration)}
</div>
</div>
diff --git a/frontend/src/lib/components/segments/segment-waterfall.svelte b/frontend/src/lib/components/segments/segment-waterfall.svelte
index 49e366d9..3c31c340 100644
--- a/frontend/src/lib/components/segments/segment-waterfall.svelte
+++ b/frontend/src/lib/components/segments/segment-waterfall.svelte
@@ -21,14 +21,16 @@
);
const durationMs = $derived(transactionDuration / 1_000_000);
-
let nameColumnWidth = $state(180); // default minimum
- function updateNameWidth(width: number) {
- if (width > nameColumnWidth) {
- nameColumnWidth = width;
- }
- }
+ function updateNameWidth(width: number) {
+ if (width > 400) {
+ width = 400;
+ }
+ if (width > nameColumnWidth) {
+ nameColumnWidth = width;
+ }
+ }
let isHovered = $state(false);
let tooltipX = $state(0);
@@ -51,21 +53,26 @@
let timelineElement: HTMLDivElement;
</script>
-<ScrollArea orientation="horizontal" class="border-border rounded-lg border p-relative">
- <div class="overflow-hidden relative">
+<ScrollArea orientation="horizontal" class="p-relative rounded-lg border border-border">
+ <div class="relative overflow-hidden">
<!-- Header -->
- <div class="bg-muted/30 border-border flex border-b">
- <div class="border-border flex-shrink-0 border-r px-3 py-1.5 text-xs font-medium" style="min-width: {nameColumnWidth}px">
+ <div class="flex border-b border-border bg-muted/30">
+ <div
+ class="flex-shrink-0 border-r border-border px-3 py-1.5 text-xs font-medium"
+ style="min-width: {nameColumnWidth}px"
+ >
Segment Name
</div>
- <div bind:this={timelineElement} class="flex-1 px-3 py-1.5 min-w-[200px]">
- <div class="text-muted-foreground flex justify-between text-xs">
+ <div bind:this={timelineElement} class="min-w-[200px] flex-1 px-3 py-1.5">
+ <div class="flex justify-between text-xs text-muted-foreground">
<span>0ms</span>
<span>{(durationMs / 2).toFixed(0)}ms</span>
<span>{durationMs.toFixed(0)}ms</span>
</div>
</div>
- <div class="border-border w-[100px] flex-shrink-0 border-l px-3 py-1.5 text-right text-xs font-medium">
+ <div
+ class="w-[100px] flex-shrink-0 border-l border-border px-3 py-1.5 text-right text-xs font-medium"
+ >
Duration
</div>
</div>
@@ -80,7 +87,6 @@
isOdd={i % 2 === 1}
{nameColumnWidth}
{updateNameWidth}
-
segmentCellHandleMouseEnter={handleMouseEnter}
segmentCellHandleMouseMove={handleMouseMove}
segmentCellHandleMouseLeave={handleMouseLeave}
@@ -88,10 +94,17 @@
{/each}
{#if isHovered}
- <div class="top-[28px] bottom-0 border-l border-gray-300 absolute pointer-events-none" style="left: {tooltipX+nameColumnWidth}px"></div>
- <div class="top-[1px] absolute -translate-x-1/2" style="left: {tooltipX+nameColumnWidth}px">
- <div class="bg-popover text-popover-foreground whitespace-nowrap rounded-md border px-2 py-1 text-xs shadow-md">
- <div class="font-medium">{Math.round(durationMs*((tooltipX+1)/(timelineElement?.clientWidth||1)))}ms</div>
+ <div
+ class="pointer-events-none absolute top-[28px] bottom-0 border-l border-gray-300"
+ style="left: {tooltipX + nameColumnWidth}px"
+ ></div>
+ <div class="absolute top-[1px] -translate-x-1/2" style="left: {tooltipX + nameColumnWidth}px">
+ <div
+ class="rounded-md border bg-popover px-2 py-1 text-xs whitespace-nowrap text-popover-foreground shadow-md"
+ >
+ <div class="font-medium">
+ {Math.round(durationMs * ((tooltipX + 1) / (timelineElement?.clientWidth || 1)))}ms
+ </div>
</div>
</div>
{/if}
diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte
index e04a0448..0b8a8b3f 100644
--- a/frontend/src/routes/+page.svelte
+++ b/frontend/src/routes/+page.svelte
@@ -6,7 +6,17 @@
import { LoadingCircle } from '$lib/components/ui/loading-circle';
import * as Table from '$lib/components/ui/table';
import * as Tooltip from '$lib/components/ui/tooltip';
- import { ArrowRight, Gauge, Bug, CircleQuestionMark, CircleCheck, RefreshCw, Copy, Check, Unplug } from 'lucide-svelte';
+ import {
+ ArrowRight,
+ Gauge,
+ Bug,
+ CircleQuestionMark,
+ CircleCheck,
+ RefreshCw,
+ Copy,
+ Check,
+ Unplug
+ } from 'lucide-svelte';
import { TracewayTableHeader } from '$lib/components/ui/traceway-table-header';
import { ImpactBadge } from '$lib/components/ui/impact-badge';
import { ViewAllTableRow } from '$lib/components/ui/view-all-table-row';
@@ -25,9 +35,7 @@
getInstallCommand,
getTestingRouteCode,
getFrameworkLabel,
-
getTestingRouteCode2
-
} from '$lib/utils/framework-code';
import { toast } from 'svelte-sonner';
@@ -63,9 +71,7 @@
let errorStatus = $state<number>(0);
// Filter endpoints to only show those with impact > good (score >= 0.25)
- const impactfulEndpoints = $derived(
- data?.worstEndpoints?.filter((e) => e.impact >= 0.25) ?? []
- );
+ const impactfulEndpoints = $derived(data?.worstEndpoints?.filter((e) => e.impact >= 0.25) ?? []);
let projectWithToken = $derived(projectsState.currentProject);
let copiedInstall = $state(false);
@@ -111,7 +117,6 @@
setTimeout(() => (copiedTesting = false), 2000);
}
-
async function copyTesting2() {
await navigator.clipboard.writeText(testingRouteCode2);
copiedTesting2 = true;
@@ -126,7 +131,9 @@
// Show success toast if data was received
if (!hadDataBefore && data?.hasData) {
- toast.success('Integration successful! Data received from your application.', { position: 'top-center' });
+ toast.success('Integration successful! Data received from your application.', {
+ position: 'top-center'
+ });
} else if (!data?.hasData) {
toast.warning('No data received yet', {
position: 'top-center'
@@ -134,6 +141,10 @@
}
}
+ api.get('/account', {
+ projectId: projectsState.currentProjectId ?? undefined
+ });
+
async function loadDashboard(showFullPageLoading = true) {
if (showFullPageLoading) {
loading = true;
@@ -190,13 +201,14 @@
<!-- Integration Not Connected -->
<div class="space-y-6">
<div class="rounded-md border bg-card">
- <div class="flex flex-col items-center justify-center py-8 px-6 text-center">
- <div class="flex h-12 w-12 items-center justify-center rounded-full bg-muted mb-4">
+ <div class="flex flex-col items-center justify-center px-6 py-8 text-center">
+ <div class="mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted">
<Unplug class="h-6 w-6 text-muted-foreground" />
</div>
- <h3 class="text-lg font-semibold mb-2">Connect Your Application</h3>
- <p class="text-sm text-muted-foreground max-w-md mb-4">
- No data has been received yet. Follow the steps below to integrate Traceway into your application.
+ <h3 class="mb-2 text-lg font-semibold">Connect Your Application</h3>
+ <p class="mb-4 max-w-md text-sm text-muted-foreground">
+ No data has been received yet. Follow the steps below to integrate Traceway into your
+ application.
</p>
<Button variant="outline" onclick={checkAgain} disabled={checking}>
{#if checking}
@@ -214,7 +226,9 @@
<div class="rounded-md border bg-card">
<div class="border-b px-4 py-3">
<div class="flex items-center gap-3">
- <div class="flex h-6 w-6 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium">
+ <div
+ class="flex h-6 w-6 items-center justify-center rounded-full bg-primary text-sm font-medium text-primary-foreground"
+ >
1
</div>
<h3 class="font-semibold">Install the SDK</h3>
@@ -248,12 +262,16 @@
<div class="rounded-md border bg-card">
<div class="border-b px-4 py-3">
<div class="flex items-center gap-3">
- <div class="flex h-6 w-6 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium">
+ <div
+ class="flex h-6 w-6 items-center justify-center rounded-full bg-primary text-sm font-medium text-primary-foreground"
+ >
2
</div>
- <h3 class="font-semibold">{getFrameworkLabel(projectWithToken.framework)} Integration</h3>
+ <h3 class="font-semibold">
+ {getFrameworkLabel(projectWithToken.framework)} Integration
+ </h3>
</div>
- <p class="text-sm text-muted-foreground mt-1 ml-9">
+ <p class="mt-1 ml-9 text-sm text-muted-foreground">
Add the Traceway middleware to your application.
</p>
</div>
@@ -285,13 +303,17 @@
<div class="rounded-md border bg-card">
<div class="border-b px-4 py-3">
<div class="flex items-center gap-3">
- <div class="flex h-6 w-6 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium">
+ <div
+ class="flex h-6 w-6 items-center justify-center rounded-full bg-primary text-sm font-medium text-primary-foreground"
+ >
3
</div>
<h3 class="font-semibold">Add a Test Route</h3>
</div>
- <p class="text-sm text-muted-foreground mt-1 ml-9">
- Add this route to verify your integration, then visit <code class="rounded bg-muted px-1 py-0.5 text-xs font-mono">GET /testing</code> in your browser.
+ <p class="mt-1 ml-9 text-sm text-muted-foreground">
+ Add this route to verify your integration, then visit <code
+ class="rounded bg-muted px-1 py-0.5 font-mono text-xs">GET /testing</code
+ > in your browser.
</p>
</div>
<div class="p-4">
@@ -343,12 +365,16 @@
<!-- Bottom Check Again -->
<div class="rounded-md border bg-card">
- <div class="flex flex-col items-center justify-center py-6 px-6 text-center">
- <div class="flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 mb-4">
+ <div class="flex flex-col items-center justify-center px-6 py-6 text-center">
+ <div
+ class="mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10"
+ >
<Unplug class="h-6 w-6 text-destructive" />
</div>
- <p class="text-sm text-muted-foreground mb-4">
- Once you've completed the steps above and triggered the <code class="rounded bg-muted px-1 py-0.5 text-xs font-mono">/testing</code> endpoint, click below to verify.
+ <p class="mb-4 text-sm text-muted-foreground">
+ Once you've completed the steps above and triggered the <code
+ class="rounded bg-muted px-1 py-0.5 font-mono text-xs">/testing</code
+ > endpoint, click below to verify.
</p>
<Button variant="outline" onclick={checkAgain} disabled={checking}>
{#if checking}
@@ -376,9 +402,7 @@
<CircleQuestionMark class="h-4 w-4 text-muted-foreground/60" />
</Tooltip.Trigger>
<Tooltip.Content>
- <p>
- Endpoints needing attention based on response time and error rates
- </p>
+ <p>Endpoints needing attention based on response time and error rates</p>
</Tooltip.Content>
</Tooltip.Root>
</div>
@@ -445,24 +469,30 @@
</Table.Cell>
</Table.Row>
{/each}
- <ViewAllTableRow colspan={5} href="/endpoints" label="View all endpoints" onBeforeNavigate={resetEndpointsSortToImpact} />
+ <ViewAllTableRow
+ colspan={5}
+ href="/endpoints"
+ label="View all endpoints"
+ onBeforeNavigate={resetEndpointsSortToImpact}
+ />
</Table.Body>
</Table.Root>
</div>
{:else}
<!-- Empty state card for endpoints -->
<div class="rounded-md border bg-card">
- <div class="flex flex-col items-center justify-center py-12 px-6 text-center">
- <div class="flex h-12 w-12 items-center justify-center rounded-full mb-4">
+ <div class="flex flex-col items-center justify-center px-6 py-12 text-center">
+ <div class="mb-4 flex h-12 w-12 items-center justify-center rounded-full">
<CircleCheck class="h-12 w-12 text-green-500 dark:text-green-400" />
</div>
- <h3 class="text-lg font-semibold mb-2">All Endpoints Healthy</h3>
- <p class="text-sm text-muted-foreground max-w-sm mb-4">
- No endpoints have been experiencing performance issues in the last 24h. Endpoints with slow response times or high error rates will appear here when detected.
+ <h3 class="mb-2 text-lg font-semibold">All Endpoints Healthy</h3>
+ <p class="mb-4 max-w-sm text-sm text-muted-foreground">
+ No endpoints have been experiencing performance issues in the last 24h. Endpoints
+ with slow response times or high error rates will appear here when detected.
</p>
<a
href="/endpoints"
- class="text-sm font-medium text-primary hover:underline inline-flex items-center gap-1"
+ class="inline-flex items-center gap-1 text-sm font-medium text-primary hover:underline"
onclick={resetEndpointsSortToImpact}
>
View all endpoints
@@ -536,17 +566,18 @@
{:else}
<!-- Empty state card for issues -->
<div class="rounded-md border bg-card">
- <div class="flex flex-col items-center justify-center py-12 px-6 text-center">
- <div class="flex h-12 w-12 items-center justify-center rounded-full mb-4">
+ <div class="flex flex-col items-center justify-center px-6 py-12 text-center">
+ <div class="mb-4 flex h-12 w-12 items-center justify-center rounded-full">
<CircleCheck class="h-12 w-12 text-green-500 dark:text-green-400" />
</div>
- <h3 class="text-lg font-semibold mb-2">No Issues Found</h3>
- <p class="text-sm text-muted-foreground max-w-sm mb-4">
- No Issues have been recorded in the last 24 hours. When issues occur in your application, they will appear here for quick triage.
+ <h3 class="mb-2 text-lg font-semibold">No Issues Found</h3>
+ <p class="mb-4 max-w-sm text-sm text-muted-foreground">
+ No Issues have been recorded in the last 24 hours. When issues occur in your
+ application, they will appear here for quick triage.
</p>
<a
href="/issues"
- class="text-sm font-medium text-primary hover:underline inline-flex items-center gap-1"
+ class="inline-flex items-center gap-1 text-sm font-medium text-primary hover:underline"
>
View all issues
<ArrowRight class="h-4 w-4" />