The only tool you need to know what is happening and how to fix it.
Go alertingexception-trackerissue-trackinglogsmetricsmonitoringobservability-platformopen-telemetryotelsession-replaytelemetrytraces
added setup guided page
ddux0fdad7f44ae5
diff --git a/backend/app/controllers/dashboard.controller.go b/backend/app/controllers/dashboard.controller.goindex 229a20b2..24c9d6b6 100644--- a/backend/app/controllers/dashboard.controller.go+++ b/backend/app/controllers/dashboard.controller.go@@ -15,8 +15,9 @@ import (type dashboardController struct{}type DashboardOverviewResponse struct {- RecentIssues []models.ExceptionGroup `json:"recentIssues"`- WorstEndpoints []models.EndpointStats `json:"worstEndpoints"`+ RecentIssues []models.ExceptionGroup `json:"recentIssues"`+ WorstEndpoints []models.EndpointStats `json:"worstEndpoints"`+ HasData bool `json:"hasData"`}func (d dashboardController) GetDashboardOverview(c *gin.Context) {@@ -41,9 +42,19 @@ func (d dashboardController) GetDashboardOverview(c *gin.Context) {panic(err)}+ hasData := true+ if len(worstEndpoints) == 0 && len(recentIssues) == 0 {+ // Check if project has received ANY data (all time, not just 24h)+ var epoch time.Time // zero time = beginning of time+ endpointCount, _ := repositories.EndpointRepository.CountBetween(c, projectId, epoch, now)+ exceptionCount, _ := repositories.ExceptionStackTraceRepository.CountBetween(c, projectId, epoch, now)+ hasData = endpointCount > 0 || exceptionCount > 0+ }+c.JSON(http.StatusOK, DashboardOverviewResponse{RecentIssues: recentIssues,WorstEndpoints: worstEndpoints,+ HasData: hasData,})}diff --git a/backend/app/models/endpoint.model.go b/backend/app/models/endpoint.model.goindex cf942648..16b4c208 100644--- a/backend/app/models/endpoint.model.go+++ b/backend/app/models/endpoint.model.go@@ -28,6 +28,7 @@ type EndpointStats struct {P95Duration time.Duration `json:"p95Duration"`AvgDuration time.Duration `json:"avgDuration"`LastSeen time.Time `json:"lastSeen"`+ Impact float64 `json:"impact"` // 0-1 Apdex-based impact score}// EndpointDetailStats contains detailed statistics for a specific endpointdiff --git a/backend/app/repositories/endpoint.repository.go b/backend/app/repositories/endpoint.repository.goindex 7a3a8734..557e4d32 100644--- a/backend/app/repositories/endpoint.repository.go+++ b/backend/app/repositories/endpoint.repository.go@@ -101,12 +101,12 @@ func (e *endpointRepository) FindGroupedByEndpoint(ctx context.Context, projectI"p95_duration": "p95_duration","avg_duration": "avg_duration","last_seen": "last_seen",- "impact": "count * (p95_duration - p50_duration)",+ "impact": "impact",}orderExpr, ok := orderByMap[orderBy]if !ok {- orderExpr = orderByMap["impact"] // Default to impact expression+ orderExpr = "impact" // Default to impact}// Validate sort direction@@ -115,13 +115,33 @@ func (e *endpointRepository) FindGroupedByEndpoint(ctx context.Context, projectIsortDir = "ASC"}+ // Apdex thresholds: Good <= 500ms, Tolerable <= 2000ms, Bad > 2000ms or error+ // Duration is in nanoseconds: 500ms = 500,000,000ns, 2000ms = 2,000,000,000nsquery := `SELECTendpoint,count() as count,quantile(0.5)(duration) as p50_duration,quantile(0.95)(duration) as p95_duration,avg(duration) as avg_duration,- max(recorded_at) as last_seen+ max(recorded_at) as last_seen,+ greatest(+ -- Base score: 1 - apdex+ if(count() > 0,+ 1.0 - (+ (countIf(duration <= 500000000 AND status_code < 400) ++ countIf(duration > 500000000 AND duration <= 2000000000 AND status_code < 400) * 0.5)+ / count()+ ),+ 0.0+ ),+ -- Floor based on bad percentage+ multiIf(+ countIf(duration > 2000000000 OR status_code >= 400) / count() > 0.33, 0.75,+ countIf(duration > 2000000000 OR status_code >= 400) / count() > 0.20, 0.50,+ countIf(duration > 2000000000 OR status_code >= 400) / count() > 0.10, 0.25,+ 0.0+ )+ ) as impactFROM endpointsWHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ?GROUP BY endpoint@@ -138,7 +158,7 @@ func (e *endpointRepository) FindGroupedByEndpoint(ctx context.Context, projectIfor rows.Next() {var s models.EndpointStatsvar p50, p95, avg float64- if err := rows.Scan(&s.Endpoint, &s.Count, &p50, &p95, &avg, &s.LastSeen); err != nil {+ if err := rows.Scan(&s.Endpoint, &s.Count, &p50, &p95, &avg, &s.LastSeen, &s.Impact); err != nil {return nil, 0, err}s.P50Duration = time.Duration(p50)@@ -398,20 +418,40 @@ func (e *endpointRepository) ErrorRateByInterval(ctx context.Context, projectIdreturn points, nil}-// FindWorstEndpoints returns endpoints ordered by impact score (count * variance)-// Higher call volume + larger variance = higher impact+// FindWorstEndpoints returns endpoints ordered by Apdex-based impact score+// Higher score = worse performance (1 - apdex with floor based on bad request percentage)func (e *endpointRepository) FindWorstEndpoints(ctx context.Context, projectId uuid.UUID, start, end time.Time, limit int) ([]models.EndpointStats, error) {+ // Apdex thresholds: Good <= 500ms, Tolerable <= 2000ms, Bad > 2000ms or error+ // Duration is in nanoseconds: 500ms = 500,000,000ns, 2000ms = 2,000,000,000nsquery := `SELECTendpoint,count() as count,quantile(0.5)(duration) as p50_duration,quantile(0.95)(duration) as p95_duration,avg(duration) as avg_duration,- max(recorded_at) as last_seen+ max(recorded_at) as last_seen,+ greatest(+ -- Base score: 1 - apdex+ if(count() > 0,+ 1.0 - (+ (countIf(duration <= 500000000 AND status_code < 400) ++ countIf(duration > 500000000 AND duration <= 2000000000 AND status_code < 400) * 0.5)+ / count()+ ),+ 0.0+ ),+ -- Floor based on bad percentage+ multiIf(+ countIf(duration > 2000000000 OR status_code >= 400) / count() > 0.33, 0.75,+ countIf(duration > 2000000000 OR status_code >= 400) / count() > 0.20, 0.50,+ countIf(duration > 2000000000 OR status_code >= 400) / count() > 0.10, 0.25,+ 0.0+ )+ ) as impactFROM endpointsWHERE project_id = ? AND recorded_at >= ? AND recorded_at <= ?GROUP BY endpoint- ORDER BY count * (p95_duration - p50_duration) DESC+ ORDER BY impact DESCLIMIT ?`rows, err := (*chdb.Conn).Query(ctx, query, projectId, start, end, limit)@@ -424,7 +464,7 @@ func (e *endpointRepository) FindWorstEndpoints(ctx context.Context, projectId ufor rows.Next() {var s models.EndpointStatsvar p50, p95, avg float64- if err := rows.Scan(&s.Endpoint, &s.Count, &p50, &p95, &avg, &s.LastSeen); err != nil {+ if err := rows.Scan(&s.Endpoint, &s.Count, &p50, &p95, &avg, &s.LastSeen, &s.Impact); err != nil {return nil, err}s.P50Duration = time.Duration(p50)diff --git a/frontend/src/lib/components/ui/impact-badge/impact-badge.svelte b/frontend/src/lib/components/ui/impact-badge/impact-badge.svelteindex 45db5497..fae24281 100644--- a/frontend/src/lib/components/ui/impact-badge/impact-badge.svelte+++ b/frontend/src/lib/components/ui/impact-badge/impact-badge.svelte@@ -1,16 +1,22 @@<script lang="ts">- import { TriangleAlert } from 'lucide-svelte';-- type ImpactLevel = 'critical' | 'high' | 'medium' | null;+ import { TriangleAlert, CheckCircle } from 'lucide-svelte';let {- level,+ score,showIcon}: {- level: ImpactLevel;+ score: number; // 0-1 Apdex-based impact scoreshowIcon?: boolean;} = $props();+ // Map score to impact level+ type ImpactLevel = 'critical' | 'high' | 'medium' | 'good';+ const level = $derived<ImpactLevel>(+ score >= 0.75 ? 'critical' :+ score >= 0.50 ? 'high' :+ score >= 0.25 ? 'medium' : 'good'+ );+// Default showIcon to true for critical and high levelsconst shouldShowIcon = $derived(showIcon ?? (level === 'critical' || level === 'high'));@@ -20,22 +26,30 @@return {bg: 'bg-red-500/15',text: 'text-red-600 dark:text-red-400',- label: 'Critical'+ label: 'Critical',+ icon: 'alert'};case 'high':return {bg: 'bg-orange-500/15',text: 'text-orange-600 dark:text-orange-400',- label: 'High'+ label: 'High',+ icon: 'alert'};case 'medium':return {bg: 'bg-yellow-500/15',text: 'text-yellow-600 dark:text-yellow-500',- label: 'Medium'+ label: 'Medium',+ icon: 'alert'+ };+ case 'good':+ return {+ bg: 'bg-green-500/15',+ text: 'text-green-600 dark:text-green-400',+ label: 'Good',+ icon: 'check'};- default:- return null;}});</script>@@ -46,7 +60,11 @@?.bg} {config()?.text}">{#if shouldShowIcon}- <TriangleAlert class="h-3 w-3" />+ {#if config()?.icon === 'check'}+ <CheckCircle class="h-3 w-3" />+ {:else}+ <TriangleAlert class="h-3 w-3" />+ {/if}{/if}{config()?.label}</span>diff --git a/frontend/src/lib/utils/framework-code.ts b/frontend/src/lib/utils/framework-code.tsnew file mode 100644index 00000000..0975ca47--- /dev/null+++ b/frontend/src/lib/utils/framework-code.ts@@ -0,0 +1,94 @@+import type { Framework } from '$lib/state/projects.svelte';++export 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;+ }+}++export function getFrameworkCode(framework: Framework, token: string, backendUrl: string): string {+ const connectionString = token+ ? `${token}@${backendUrl}/api/report`+ : `YOUR_TOKEN@${backendUrl}/api/report`;++ switch (framework) {+ case 'gin':+ return `package main++import (+ "github.com/gin-gonic/gin"+ "github.com/traceway-io/go-client/traceway_gin"+)++func main() {+ r := gin.Default()+ r.Use(traceway_gin.New("${connectionString}"))+ r.Run(":8080")+}`;++ 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}:+//+// https://github.com/traceway-io/go-client+//+// In the meantime, you can use the core SDK directly:++package main++import (+ "github.com/traceway-io/go-client"+)++func main() {+ // Initialize Traceway+ traceway.Init(+ "${connectionString}",+ traceway.WithVersion("1.0.0"),+ traceway.WithServerName("my-server"),+ )++ // Capture exceptions manually+ // traceway.CaptureException(err)+ // traceway.CaptureExceptionWithContext(ctx, err)++ // Capture messages+ // traceway.CaptureMessage("Something happened")+ // traceway.CaptureMessageWithContext(ctx, "Something happened")+}`;+ }+}++export function getTestingRouteCode(): string {+ return `r.GET("/testing", func(c *gin.Context) {+ panic("Test error from Traceway integration")+})`;+}++export 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;+}diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelteindex 2b8cfe1a..d8019918 100644--- a/frontend/src/routes/+layout.svelte+++ b/frontend/src/routes/+layout.svelte@@ -124,7 +124,7 @@onProjectCreated={handleProjectCreated}/>- <Toaster richColors position="bottom-right" />+ <Toaster position="bottom-right" />{:else}<main class="h-screen w-screen">{@render children()}diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelteindex 80f9973a..a07a6c45 100644--- a/frontend/src/routes/+page.svelte+++ b/frontend/src/routes/+page.svelte@@ -6,15 +6,27 @@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, Info, Gauge, Bug, CircleQuestionMark } 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 { TableEmptyState } from '$lib/components/ui/table-empty-state';import { ViewAllTableRow } from '$lib/components/ui/view-all-table-row';import { api } from '$lib/api';import { ErrorDisplay } from '$lib/components/ui/error-display';- import { projectsState } from '$lib/state/projects.svelte';+ import { projectsState, type ProjectWithToken } from '$lib/state/projects.svelte';import { setSortState } from '$lib/utils/sort-storage';+ import { Button } from '$lib/components/ui/button';+ 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 {+ getFrameworkCode,+ getInstallCommand,+ getTestingRouteCode,+ getFrameworkLabel+ } from '$lib/utils/framework-code';+ import { toast } from 'svelte-sonner';const timezone = $derived(getTimezone());@@ -33,11 +45,13 @@p95Duration: number;avgDuration: number;lastSeen: string;+ impact: number; // 0-1 Apdex-based impact score from backend};type DashboardOverview = {recentIssues: ExceptionGroup[];worstEndpoints: EndpointStats[];+ hasData: boolean;};let data = $state<DashboardOverview | null>(null);@@ -45,8 +59,84 @@let error = $state('');let errorStatus = $state<number>(0);- async function loadDashboard() {- loading = true;+ // Filter endpoints to only show those with impact > good (score >= 0.25)+ const impactfulEndpoints = $derived(+ data?.worstEndpoints?.filter((e) => e.impact >= 0.25) ?? []+ );++ // Integration setup state+ let projectWithToken = $state<ProjectWithToken | null>(null);+ let copiedInstall = $state(false);+ let copiedCode = $state(false);+ let copiedTesting = $state(false);+ let checking = $state(false);++ // Load project with token when hasData is false+ $effect(() => {+ if (data && !data.hasData && projectsState.currentProjectId) {+ projectsState+ .getProjectWithToken(projectsState.currentProjectId)+ .then((p) => (projectWithToken = p))+ .catch(() => (projectWithToken = null));+ }+ });++ const sdkCode = $derived(+ projectWithToken+ ? getFrameworkCode(+ projectWithToken.framework,+ projectWithToken.token,+ projectWithToken.backendUrl+ )+ : ''+ );++ const installCommand = $derived(+ projectWithToken+ ? getInstallCommand(projectWithToken.framework)+ : 'go get github.com/traceway-io/go-client'+ );++ const testingRouteCode = getTestingRouteCode();++ async function copyInstall() {+ await navigator.clipboard.writeText(installCommand);+ copiedInstall = true;+ setTimeout(() => (copiedInstall = false), 2000);+ }++ async function copyCode() {+ await navigator.clipboard.writeText(sdkCode);+ copiedCode = true;+ setTimeout(() => (copiedCode = false), 2000);+ }++ async function copyTesting() {+ await navigator.clipboard.writeText(testingRouteCode);+ copiedTesting = true;+ setTimeout(() => (copiedTesting = false), 2000);+ }++ async function checkAgain() {+ checking = true;+ const hadDataBefore = data?.hasData ?? false;+ await loadDashboard(false);+ checking = false;++ // Show success toast if data was received+ if (!hadDataBefore && data?.hasData) {+ toast.success('Integration successful! Data received from your application.');+ } else if (!data?.hasData) {+ toast.warning('No data received yet', {+ position: 'top-center'+ });+ }+ }++ async function loadDashboard(showFullPageLoading = true) {+ if (showFullPageLoading) {+ loading = true;+ }error = '';errorStatus = 0;@@ -60,7 +150,9 @@error = e.message || 'Failed to load dashboard data';console.error(e);} finally {- loading = false;+ if (showFullPageLoading) {+ loading = false;+ }}}@@ -68,21 +160,6 @@loadDashboard();});- // 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 {- const varianceMs = (p95 - p50) / 1_000_000;- const score = count * varianceMs;- if (score > 100) return 'critical';- if (score > 10) return 'high';- if (score > 1) return 'medium';- return null;- }-function resetEndpointsSortToImpact() {setSortState('endpoints', { field: 'impact', direction: 'desc' });}@@ -108,6 +185,159 @@<div class="flex items-center justify-center py-20"><LoadingCircle size="xlg" /></div>+ {:else if !error && data && !data.hasData}+ <!-- 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">+ <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.+ </p>+ <Button variant="outline" onclick={checkAgain} disabled={checking}>+ {#if checking}+ <RefreshCw class="mr-2 h-4 w-4 animate-spin" />+ {:else}+ <RefreshCw class="mr-2 h-4 w-4" />+ {/if}+ Check Again+ </Button>+ </div>+ </div>++ {#if projectWithToken}+ <!-- Step 1: Install -->+ <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">+ 1+ </div>+ <h3 class="font-semibold">Install the SDK</h3>+ </div>+ </div>+ <div class="p-4">+ <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>+ </div>+ </div>++ <!-- Step 2: Setup Integration -->+ <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">+ 2+ </div>+ <h3 class="font-semibold">{getFrameworkLabel(projectWithToken.framework)} Integration</h3>+ </div>+ <p class="text-sm text-muted-foreground mt-1 ml-9">+ Add the Traceway middleware to your application.+ </p>+ </div>+ <div class="p-4">+ <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>+ </div>+ </div>++ <!-- Step 3: Add Testing Route -->+ <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">+ 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>+ </div>+ <div class="p-4">+ <div class="relative">+ <div class="absolute top-2 right-2 z-10">+ <Button variant="outline" size="sm" onclick={copyTesting}>+ {#if copiedTesting}+ <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={testingRouteCode} />+ </div>+ </div>+ </div>+ </div>++ <!-- 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">+ <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>+ <Button variant="outline" onclick={checkAgain} disabled={checking}>+ {#if checking}+ <RefreshCw class="mr-2 h-4 w-4 animate-spin" />+ {:else}+ <RefreshCw class="mr-2 h-4 w-4" />+ {/if}+ Check Again+ </Button>+ </div>+ </div>+ {/if}+ </div>{:else if !error}<div class="space-y-6"><!-- Endpoints -->@@ -123,14 +353,14 @@</Tooltip.Trigger><Tooltip.Content><p>- Most impactful endpoints to optimize based on traffic and response time variance+ Endpoints needing attention based on response time and error rates</p></Tooltip.Content></Tooltip.Root></div>- <div class="overflow-hidden rounded-md border">- <Table.Root>- {#if data?.worstEndpoints && data.worstEndpoints.length > 0}+ {#if impactfulEndpoints.length > 0}+ <div class="overflow-hidden rounded-md border">+ <Table.Root><Table.Header><Table.Row class="hover:bg-transparent"><TracewayTableHeader@@ -157,19 +387,14 @@/><TracewayTableHeaderlabel="Impact"- tooltip="Priority based on traffic × variance"+ tooltip="Priority based on response time and error rates"align="right"class="w-[80px]"/></Table.Row></Table.Header><Table.Body>- {#each data.worstEndpoints as endpoint}- {@const impactLevel = getImpactLevel(- endpoint.count,- endpoint.p50Duration,- endpoint.p95Duration- )}+ {#each impactfulEndpoints as endpoint}<Table.Rowclass="cursor-pointer hover:bg-muted/50"onclick={createRowClickHandler(@@ -192,19 +417,36 @@{formatDuration(endpoint.p95Duration)}</Table.Cell><Table.Cell class="py-3 text-right">- <ImpactBadge level={impactLevel} />+ <ImpactBadge score={endpoint.impact} /></Table.Cell></Table.Row>{/each}<ViewAllTableRow colspan={5} href="/endpoints" label="View all endpoints" onBeforeNavigate={resetEndpointsSortToImpact} /></Table.Body>- {:else}- <Table.Body>- <TableEmptyState colspan={5} message="No transaction data received yet" />- </Table.Body>- {/if}- </Table.Root>- </div>+ </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">+ <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.+ </p>+ <a+ href="/endpoints"+ class="text-sm font-medium text-primary hover:underline inline-flex items-center gap-1"+ onclick={resetEndpointsSortToImpact}+ >+ View all endpoints+ <ArrowRight class="h-4 w-4" />+ </a>+ </div>+ </div>+ {/if}</div><!-- Issues Section -->@@ -223,9 +465,9 @@</Tooltip.Content></Tooltip.Root></div>- <div class="overflow-hidden rounded-md border">- <Table.Root>- {#if data?.recentIssues && data.recentIssues.length > 0}+ {#if data?.recentIssues && data.recentIssues.length > 0}+ <div class="overflow-hidden rounded-md border">+ <Table.Root><Table.Header><Table.Row class="hover:bg-transparent"><TracewayTableHeader@@ -265,14 +507,80 @@{/each}<ViewAllTableRow colspan={3} href="/issues" label="View all issues" /></Table.Body>- {:else}- <Table.Body>- <TableEmptyState colspan={3} message="No issues in the last 24 hours" />- </Table.Body>- {/if}- </Table.Root>- </div>+ </Table.Root>+ </div>+ {: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">+ <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.+ </p>+ <a+ href="/issues"+ class="text-sm font-medium text-primary hover:underline inline-flex items-center gap-1"+ >+ View all issues+ <ArrowRight class="h-4 w-4" />+ </a>+ </div>+ </div>+ {/if}</div></div>{/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;+ }++ /* 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/connection/+page.svelte b/frontend/src/routes/connection/+page.svelteindex 34aed6f3..5f811e98 100644--- a/frontend/src/routes/connection/+page.svelte+++ b/frontend/src/routes/connection/+page.svelte@@ -7,10 +7,8 @@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 { Copy, Check } from 'lucide-svelte';+ import { projectsState, type ProjectWithToken } from '$lib/state/projects.svelte';import { LoadingCircle } from '$lib/components/ui/loading-circle';import FrameworkIcon from '$lib/components/framework-icon.svelte';import Highlight from 'svelte-highlight';@@ -18,14 +16,17 @@import bash from 'svelte-highlight/languages/bash';import { themeState } from '$lib/state/theme.svelte';import 'svelte-highlight/styles/github-dark.css';+ import {+ getFrameworkCode,+ getInstallCommand,+ getFrameworkLabel+ } from '$lib/utils/framework-code';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(() => {@@ -52,100 +53,13 @@}});- 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, backendUrl: string): string {- const connectionString = token- ? `${token}@${backendUrl}/api/report`- : `YOUR_TOKEN@${backendUrl}/api/report`;-- switch (framework) {- case 'gin':- return `import "github.com/traceway-io/go-client/traceway_gin"--func main() {- r := gin.Default()- r.Use(traceway_gin.New("${connectionString}"))- r.Run(":8080")-}`;-- 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}:-//-// https://github.com/traceway-io/go-client-//-// In the meantime, you can use the core SDK directly:--package main--import (- "github.com/traceway-io/go-client"-)--func main() {- // Initialize Traceway- traceway.Init(- "${connectionString}",- traceway.WithVersion("1.0.0"),- traceway.WithServerName("my-server"),- )-- // Capture exceptions manually- // traceway.CaptureException(err)- // traceway.CaptureExceptionWithContext(ctx, err)-- // Capture messages- // 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 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, projectWithToken.backendUrl)+ ? getFrameworkCode(+ projectWithToken.framework,+ projectWithToken.token,+ projectWithToken.backendUrl+ ): '');@@ -187,55 +101,6 @@ func main() {</CardContent></Card>{:else if projectWithToken}- <!-- <Card>- <CardHeader>- <CardTitle>Project Token</CardTitle>- <CardDescription>- Use this token to authenticate your application with Traceway.- Keep it secure and don't share it publicly.- </CardDescription>- </CardHeader>- <CardContent class="space-y-4">- <div class="space-y-2">- <Label>Token for {projectWithToken.name}</Label>- <div class="flex gap-2">- <div class="relative flex-1">- <Input- type={showToken ? 'text' : 'password'}- value={projectWithToken.token}- readonly- class="pr-20 font-mono text-sm"- />- </div>- <Button- variant="outline"- size="icon"- onclick={() => showToken = !showToken}- title={showToken ? 'Hide token' : 'Show token'}- >- {#if showToken}- <EyeOff class="h-4 w-4" />- {:else}- <Eye class="h-4 w-4" />- {/if}- </Button>- <Button- variant="outline"- size="icon"- onclick={copyToken}- title="Copy token"- >- {#if copiedToken}- <Check class="h-4 w-4 text-green-500" />- {:else}- <Copy class="h-4 w-4" />- {/if}- </Button>- </div>- </div>- </CardContent>- </Card> -->-<Card><CardHeader><CardTitle class="flex items-center gap-2">diff --git a/frontend/src/routes/endpoints/+page.svelte b/frontend/src/routes/endpoints/+page.svelteindex 5b9d0525..3a64dd97 100644--- a/frontend/src/routes/endpoints/+page.svelte+++ b/frontend/src/routes/endpoints/+page.svelte@@ -42,6 +42,7 @@p95Duration: number;avgDuration: number;lastSeen: string;+ impact: number; // 0-1 Apdex-based impact score from backend};type SortField = 'count' | 'p50_duration' | 'p95_duration' | 'last_seen' | 'impact';@@ -141,17 +142,6 @@return count.toLocaleString();}- // 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 {- const varianceMs = (p95 - p50) / 1_000_000;- const score = count * varianceMs;- if (score > 100) return 'critical';- if (score > 10) return 'high';- if (score > 1) return 'medium';- return null;- }-async function loadData(pushToHistory = true) {loading = true;error = '';@@ -262,7 +252,7 @@</Table.Body>{:else if endpoints.length === 0}<Table.Body>- <TableEmptyState colspan={5} message="No endpoint data received yet" />+ <TableEmptyState colspan={5} message="No endpoint data available for your search parameters" /></Table.Body>{:else}<Table.Header>@@ -313,7 +303,6 @@</Table.Header><Table.Body>{#each endpoints as endpoint}- {@const impactLevel = getImpactLevel(endpoint.count, endpoint.p50Duration, endpoint.p95Duration)}<Table.Rowclass="cursor-pointer hover:bg-muted/50"onclick={createRowClickHandler(resolve(`/endpoints/${encodeURIComponent(endpoint.endpoint)}`), 'preset', 'from', 'to')}@@ -331,7 +320,7 @@{formatDuration(endpoint.p95Duration)}</Table.Cell><Table.Cell class="text-right">- <ImpactBadge level={impactLevel} />+ <ImpactBadge score={endpoint.impact} /></Table.Cell></Table.Row>{/each}diff --git a/frontend/src/routes/issues/+page.svelte b/frontend/src/routes/issues/+page.svelteindex cce2dd31..c8dd2574 100644--- a/frontend/src/routes/issues/+page.svelte+++ b/frontend/src/routes/issues/+page.svelte@@ -287,7 +287,7 @@{ projectId: projectsState.currentProjectId ?? undefined });- toast.success('Successfully archived the Issue' + (selectedHashes.size > 1 ? 's' : ''));+ toast.success('Successfully archived the Issue' + (selectedHashes.size > 1 ? 's' : ''), { position: 'top-center' });selectedHashes = new Set();await loadData();} catch (e: any) {diff --git a/frontend/src/routes/issues/[exceptionHash]/+page.svelte b/frontend/src/routes/issues/[exceptionHash]/+page.svelteindex e436298d..5fd1b45c 100644--- a/frontend/src/routes/issues/[exceptionHash]/+page.svelte+++ b/frontend/src/routes/issues/[exceptionHash]/+page.svelte@@ -96,7 +96,7 @@{ hashes: [exceptionHash] },{ projectId: projectsState.currentProjectId ?? undefined });- toast.success('Successfully archived the Issue');+ toast.success('Successfully archived the Issue', { position: 'top-center' });goto('/issues');} catch (e: any) {console.error('Archive failed:', e);diff --git a/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.svelte b/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.svelteindex f77afcb3..be105cfe 100644--- a/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.svelte+++ b/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.svelte@@ -117,7 +117,7 @@{ hashes: [data.exceptionHash] },{ projectId: projectsState.currentProjectId ?? undefined });- toast.success('Successfully archived the Issue');+ toast.success('Successfully archived the Issue', { position: 'top-center' });goto(resolve("/issues"));} catch (e: any) {console.error('Archive failed:', e);diff --git a/frontend/src/routes/issues/[exceptionHash]/events/+page.svelte b/frontend/src/routes/issues/[exceptionHash]/events/+page.svelteindex 99093cf3..566ea93e 100644--- a/frontend/src/routes/issues/[exceptionHash]/events/+page.svelte+++ b/frontend/src/routes/issues/[exceptionHash]/events/+page.svelte@@ -117,7 +117,7 @@{ hashes: [page.params.exceptionHash] },{ projectId: projectsState.currentProjectId ?? undefined });- toast.success('Successfully archived the Issue');+ toast.success('Successfully archived the Issue', { position: 'top-center' });goto('/issues');} catch (e: any) {console.error('Archive failed:', e);diff --git a/frontend/src/routes/layout.css b/frontend/src/routes/layout.cssindex 73f8df02..8867ade5 100644--- a/frontend/src/routes/layout.css+++ b/frontend/src/routes/layout.css@@ -128,4 +128,38 @@body {@apply bg-background text-foreground;}+}++/* Sonner toast overrides - clean black/white styling */+[data-sonner-toaster] [data-sonner-toast] {+ --normal-bg: white;+ --normal-text: #1a1a1a;+ --normal-border: #e5e5e5;+ background: var(--normal-bg);+ color: var(--normal-text);+ border-color: var(--normal-border);+}++[data-sonner-toaster] [data-sonner-toast][data-type="warning"],+[data-sonner-toaster] [data-sonner-toast][data-type="success"],+[data-sonner-toaster] [data-sonner-toast][data-type="error"],+[data-sonner-toaster] [data-sonner-toast][data-type="info"] {+ background: var(--normal-bg);+ color: var(--normal-text);+ border-color: var(--normal-border);+}++.dark [data-sonner-toaster] [data-sonner-toast] {+ --normal-bg: #1a1a1a;+ --normal-text: #fafafa;+ --normal-border: #333;+}++.dark [data-sonner-toaster] [data-sonner-toast][data-type="warning"],+.dark [data-sonner-toaster] [data-sonner-toast][data-type="success"],+.dark [data-sonner-toaster] [data-sonner-toast][data-type="error"],+.dark [data-sonner-toaster] [data-sonner-toast][data-type="info"] {+ background: var(--normal-bg);+ color: var(--normal-text);+ border-color: var(--normal-border);}\ No newline at end of filediff --git a/testing/devtesting/devtesting.go b/testing/devtesting/devtesting.goindex bb58d2cd..a7bc2020 100644--- a/testing/devtesting/devtesting.go+++ b/testing/devtesting/devtesting.go@@ -4,6 +4,7 @@ import ("context""errors""math/rand/v2"+ "net/http""os""strconv""time"@@ -18,6 +19,10 @@ func main() {testGin()}+type JsonRecordingTest struct {+ Name string+}+func testGin() {endpoint := os.Getenv("TRACEWAY_ENDPOINT")if endpoint == "" {@@ -30,8 +35,22 @@ func testGin() {endpoint,tracewaygin.WithDebug(true),tracewaygin.WithRepanic(true),+ tracewaygin.WithOnErrorRecording(tracewaygin.RecordingUrl|tracewaygin.RecordingQuery|tracewaygin.RecordingHeader|tracewaygin.RecordingBody),))+ router.POST("/test-recording/:param", func(ctx *gin.Context) {+ var data JsonRecordingTest++ if err := ctx.ShouldBindJSON(&data); err != nil {+ ctx.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})+ return+ }++ if data.Name != "good" {+ panic("Bad") // lol+ }+ })+router.GET("/test-task", func(ctx *gin.Context) {go func() {traceway.MeasureTask("traceway data processor", func(twctx context.Context) {