Skip to content

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

progress

dduxd4c49fb5df82
diff --git a/backend/app/controllers/task_detail.controller.go b/backend/app/controllers/task_detail.controller.go
index 5b94d33c..ef71f1a2 100644
--- a/backend/app/controllers/task_detail.controller.go
+++ b/backend/app/controllers/task_detail.controller.go
@@ -20,11 +20,20 @@ type TaskExceptionInfo struct {
RecordedAt string `json:"recordedAt"`
}
+type TaskMessageInfo struct {
+ Id string `json:"id"`
+ ExceptionHash string `json:"exceptionHash"`
+ StackTrace string `json:"stackTrace"`
+ RecordedAt string `json:"recordedAt"`
+ Scope map[string]string `json:"scope,omitempty"`
+}
+
type TaskDetailResponse struct {
Task *models.Task `json:"task"`
Segments []models.Segment `json:"segments"`
HasSegments bool `json:"hasSegments"`
Exception *TaskExceptionInfo `json:"exception,omitempty"`
+ Messages []TaskMessageInfo `json:"messages"`
}
func (c taskDetailController) GetTaskDetail(ctx *gin.Context) {
@@ -53,25 +62,45 @@ func (c taskDetailController) GetTaskDetail(ctx *gin.Context) {
panic(err)
}
- // Get linked exception if any
+ // Get all linked exceptions and messages
var exceptionInfo *TaskExceptionInfo
- exception, err := repositories.ExceptionStackTraceRepository.FindByTransactionId(ctx, request.ProjectId, taskId)
+ var messages []TaskMessageInfo
+
+ allExceptions, err := repositories.ExceptionStackTraceRepository.FindAllByTransactionId(ctx, request.ProjectId, taskId)
if err != nil {
panic(err)
}
- if exception != nil {
- exceptionInfo = &TaskExceptionInfo{
- ExceptionHash: exception.ExceptionHash,
- StackTrace: exception.StackTrace,
- RecordedAt: exception.RecordedAt.Format("2006-01-02T15:04:05Z07:00"),
+
+ for _, exc := range allExceptions {
+ if exc.IsMessage {
+ // Add to messages list
+ messages = append(messages, TaskMessageInfo{
+ Id: exc.Id,
+ ExceptionHash: exc.ExceptionHash,
+ StackTrace: exc.StackTrace,
+ RecordedAt: exc.RecordedAt.Format("2006-01-02T15:04:05Z07:00"),
+ Scope: exc.Scope,
+ })
+ } else if exceptionInfo == nil {
+ // Only take the first actual exception
+ exceptionInfo = &TaskExceptionInfo{
+ ExceptionHash: exc.ExceptionHash,
+ StackTrace: exc.StackTrace,
+ RecordedAt: exc.RecordedAt.Format("2006-01-02T15:04:05Z07:00"),
+ }
}
}
+ if messages == nil {
+ messages = []TaskMessageInfo{}
+ }
+
ctx.JSON(http.StatusOK, TaskDetailResponse{
Task: task,
Segments: segments,
HasSegments: len(segments) > 0,
Exception: exceptionInfo,
+ Messages: messages,
})
}
diff --git a/backend/app/models/clientmodels/clientmodels.model.go b/backend/app/models/clientmodels/clientmodels.model.go
index bf92f8cf..9cee2cc9 100644
--- a/backend/app/models/clientmodels/clientmodels.model.go
+++ b/backend/app/models/clientmodels/clientmodels.model.go
@@ -66,7 +66,7 @@ func (c *ClientTransaction) ToEndpoint(appVersion, serverName string) models.End
Endpoint: c.Endpoint,
Duration: c.Duration,
RecordedAt: c.RecordedAt,
- StatusCode: int32(c.StatusCode),
+ StatusCode: int16(c.StatusCode),
BodySize: int32(c.BodySize),
ClientIP: c.ClientIP,
Scope: c.Scope,
diff --git a/backend/app/models/endpoint.model.go b/backend/app/models/endpoint.model.go
index f54cd9a2..d2663e6b 100644
--- a/backend/app/models/endpoint.model.go
+++ b/backend/app/models/endpoint.model.go
@@ -9,7 +9,7 @@ type Endpoint struct {
Endpoint string `json:"endpoint" ch:"endpoint"`
Duration time.Duration `json:"duration" ch:"duration"`
RecordedAt time.Time `json:"recordedAt" ch:"recorded_at"`
- StatusCode int32 `json:"statusCode" ch:"status_code"`
+ StatusCode int16 `json:"statusCode" ch:"status_code"`
BodySize int32 `json:"bodySize" ch:"body_size"`
ClientIP string `json:"clientIP" ch:"client_ip"`
Scope map[string]string `json:"scope" ch:"scope"`
diff --git a/backend/app/repositories/exception_stack_trace.repository.go b/backend/app/repositories/exception_stack_trace.repository.go
index d96b898f..a58957cb 100644
--- a/backend/app/repositories/exception_stack_trace.repository.go
+++ b/backend/app/repositories/exception_stack_trace.repository.go
@@ -321,8 +321,7 @@ func (e *exceptionStackTraceRepository) IsArchived(ctx context.Context, projectI
return count > 0, nil
}
-// FindByTransactionId returns the exception associated with a specific transaction
-func (e *exceptionStackTraceRepository) FindByTransactionId(ctx context.Context, projectId string, transactionId string) (*models.ExceptionStackTrace, error) {
+func (e *exceptionStackTraceRepository) FindExceptionByTransactionId(ctx context.Context, projectId string, transactionId string) (*models.ExceptionStackTrace, error) {
var est models.ExceptionStackTrace
var scopeJSON string
var isMessage uint8
@@ -330,7 +329,7 @@ func (e *exceptionStackTraceRepository) FindByTransactionId(ctx context.Context,
err := (*chdb.Conn).QueryRow(ctx,
`SELECT id, project_id, transaction_id, transaction_type, exception_hash, stack_trace, recorded_at, scope, app_version, server_name, is_message
FROM exception_stack_traces
- WHERE project_id = ? AND transaction_id = ?
+ WHERE project_id = ? AND transaction_id = ? AND is_message = false
LIMIT 1`,
projectId, transactionId).Scan(
&est.Id, &est.ProjectId, &est.TransactionId, &est.TransactionType, &est.ExceptionHash, &est.StackTrace,
diff --git a/frontend/src/lib/components/issues/stack-trace-card.svelte b/frontend/src/lib/components/issues/stack-trace-card.svelte
index abc3f32c..ac94ac26 100644
--- a/frontend/src/lib/components/issues/stack-trace-card.svelte
+++ b/frontend/src/lib/components/issues/stack-trace-card.svelte
@@ -23,7 +23,7 @@
</script>
<Card.Root>
- <Card.Header>
+ <Card.Header class={showStats ? '' : 'pb-0'}>
<div class="flex justify-between">
<div class="flex items-center gap-2">
<Card.Title>
diff --git a/frontend/src/routes/endpoints/[endpoint]/[endpointId]/+page.svelte b/frontend/src/routes/endpoints/[endpoint]/[endpointId]/+page.svelte
index 83f41ca7..89598a50 100644
--- a/frontend/src/routes/endpoints/[endpoint]/[endpointId]/+page.svelte
+++ b/frontend/src/routes/endpoints/[endpoint]/[endpointId]/+page.svelte
@@ -10,7 +10,7 @@
import { LoadingCircle } from '$lib/components/ui/loading-circle';
import { ErrorDisplay } from '$lib/components/ui/error-display';
import { projectsState } from '$lib/state/projects.svelte';
- import { ArrowLeft, ArrowRight, TriangleAlert, MessageSquare } from 'lucide-svelte';
+ import { ArrowLeft, ArrowRight, TriangleAlert, ClipboardList } from 'lucide-svelte';
import { LabelValue } from '$lib/components/ui/label-value';
import { ContextGrid } from '$lib/components/ui/context-grid';
import SegmentWaterfall from '$lib/components/segments/segment-waterfall.svelte';
@@ -195,23 +195,23 @@
<!-- Messages Section (if messages exist) -->
{#if response.messages.length > 0}
- <Card.Root class="border-blue-500/30 bg-blue-500/5">
+ <Card.Root>
<Card.Header>
<div class="flex items-center gap-2">
- <MessageSquare class="h-5 w-5 text-blue-500" />
- <Card.Title class="text-blue-600 dark:text-blue-400">Messages</Card.Title>
+ <ClipboardList class="h-5 w-5 text-muted-foreground" />
+ <Card.Title>Messages</Card.Title>
</div>
<Card.Description>
{response.messages.length} message{response.messages.length === 1 ? '' : 's'} logged during this request
</Card.Description>
</Card.Header>
- <Card.Content>
+ <Card.Content class="px-0 pb-0">
<Table.Root>
<Table.Header>
<Table.Row>
- <Table.Head>Message</Table.Head>
+ <Table.Head class="pl-6">Message</Table.Head>
<Table.Head class="w-[180px]">Recorded At</Table.Head>
- <Table.Head class="w-[100px]">Scope</Table.Head>
+ <Table.Head class="w-[100px] pr-6">Scope</Table.Head>
</Table.Row>
</Table.Header>
<Table.Body>
@@ -220,7 +220,7 @@
class="cursor-pointer hover:bg-muted/50"
onclick={() => goto(`/issues/${message.exceptionHash}/${message.id}`)}
>
- <Table.Cell>
+ <Table.Cell class="pl-6">
<div class="max-w-md truncate font-mono text-sm">
{message.stackTrace.split('\n')[0]}
</div>
@@ -228,7 +228,7 @@
<Table.Cell class="font-mono text-sm text-muted-foreground">
{formatDateTime(message.recordedAt, { timezone })}
</Table.Cell>
- <Table.Cell>
+ <Table.Cell class="pr-6">
{#if message.scope && Object.keys(message.scope).length > 0}
<span class="text-xs text-muted-foreground">
{Object.keys(message.scope).length} key{Object.keys(message.scope).length === 1 ? '' : 's'}
diff --git a/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.svelte b/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.svelte
index f9265f67..f77afcb3 100644
--- a/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.svelte
+++ b/frontend/src/routes/issues/[exceptionHash]/[exceptionId]/+page.svelte
@@ -67,13 +67,18 @@
if (occurrence.transactionId) {
try {
const isTask = occurrence.transactionType === 'task';
+ console.log('DEBUG linked transaction:', {
+ transactionId: occurrence.transactionId,
+ transactionType: occurrence.transactionType,
+ isTask
+ });
const endpoint = isTask ? '/tasks' : '/endpoints';
const txResponse = await api.post(
`${endpoint}/${occurrence.transactionId}`,
{},
{ projectId: projectsState.currentProjectId ?? undefined }
);
- const txData = isTask ? txResponse.task : txResponse.transaction;
+ const txData = isTask ? txResponse.task : txResponse.endpoint;
if (txData) {
linkedTransaction = {
id: txData.id,
@@ -85,7 +90,11 @@
};
}
} catch (txError) {
- console.warn('Could not load linked transaction:', txError);
+ console.error('Failed to load linked transaction:', {
+ error: txError,
+ transactionId: occurrence.transactionId,
+ transactionType: occurrence.transactionType
+ });
}
}
} catch (e: any) {
diff --git a/frontend/src/routes/tasks/[task]/[taskId]/+page.svelte b/frontend/src/routes/tasks/[task]/[taskId]/+page.svelte
index 531edc17..64c04653 100644
--- a/frontend/src/routes/tasks/[task]/[taskId]/+page.svelte
+++ b/frontend/src/routes/tasks/[task]/[taskId]/+page.svelte
@@ -6,10 +6,11 @@
import { getTimezone } from '$lib/state/timezone.svelte';
import { Button } from '$lib/components/ui/button';
import * as Card from '$lib/components/ui/card';
+ import * as Table from '$lib/components/ui/table';
import { LoadingCircle } from '$lib/components/ui/loading-circle';
import { ErrorDisplay } from '$lib/components/ui/error-display';
import { projectsState } from '$lib/state/projects.svelte';
- import { ArrowRight, TriangleAlert } from 'lucide-svelte';
+ import { ArrowRight, TriangleAlert, ClipboardList } from 'lucide-svelte';
import { LabelValue } from '$lib/components/ui/label-value';
import { ContextGrid } from '$lib/components/ui/context-grid';
import SegmentWaterfall from '$lib/components/segments/segment-waterfall.svelte';
@@ -33,6 +34,13 @@
exceptionHash: string;
stackTrace: string;
};
+ messages: {
+ id: string;
+ exceptionHash: string;
+ stackTrace: string;
+ recordedAt: string;
+ scope?: Record<string, string>;
+ }[];
segments: any[];
hasSegments: boolean;
};
@@ -140,11 +148,6 @@
value={response.task.appVersion}
mono
/>
- <LabelValue
- label="Client IP"
- value={response.task.clientIP}
- mono
- />
</div>
{#if response.task.scope && Object.keys(response.task.scope).length > 0}
@@ -188,6 +191,58 @@
</Card.Root>
{/if}
+ <!-- Messages Section (if messages exist) -->
+ {#if response.messages.length > 0}
+ <Card.Root>
+ <Card.Header>
+ <div class="flex items-center gap-2">
+ <ClipboardList class="h-5 w-5 text-muted-foreground" />
+ <Card.Title>Messages</Card.Title>
+ </div>
+ <Card.Description>
+ {response.messages.length} message{response.messages.length === 1 ? '' : 's'} logged during this task
+ </Card.Description>
+ </Card.Header>
+ <Card.Content class="px-0 pb-0">
+ <Table.Root>
+ <Table.Header>
+ <Table.Row>
+ <Table.Head class="pl-6">Message</Table.Head>
+ <Table.Head class="w-[180px]">Recorded At</Table.Head>
+ <Table.Head class="w-[100px] pr-6">Scope</Table.Head>
+ </Table.Row>
+ </Table.Header>
+ <Table.Body>
+ {#each response.messages as message}
+ <Table.Row
+ class="cursor-pointer hover:bg-muted/50"
+ onclick={() => goto(`/issues/${message.exceptionHash}/${message.id}`)}
+ >
+ <Table.Cell class="pl-6">
+ <div class="max-w-md truncate font-mono text-sm">
+ {message.stackTrace.split('\n')[0]}
+ </div>
+ </Table.Cell>
+ <Table.Cell class="font-mono text-sm text-muted-foreground">
+ {formatDateTime(message.recordedAt, { timezone })}
+ </Table.Cell>
+ <Table.Cell class="pr-6">
+ {#if message.scope && Object.keys(message.scope).length > 0}
+ <span class="text-xs text-muted-foreground">
+ {Object.keys(message.scope).length} key{Object.keys(message.scope).length === 1 ? '' : 's'}
+ </span>
+ {:else}
+ <span class="text-xs text-muted-foreground">-</span>
+ {/if}
+ </Table.Cell>
+ </Table.Row>
+ {/each}
+ </Table.Body>
+ </Table.Root>
+ </Card.Content>
+ </Card.Root>
+ {/if}
+
<!-- Segments Section -->
<Card.Root>
<Card.Header>
diff --git a/testing/devtesting/devtesting.go b/testing/devtesting/devtesting.go
index f8c60a3f..525ec01d 100644
--- a/testing/devtesting/devtesting.go
+++ b/testing/devtesting/devtesting.go
@@ -40,7 +40,7 @@ func testGin() {
seg.End()
for i := range 10 {
- traceway.CaptureMessageWithContext(ctx, "data loaded successfully "+strconv.Itoa(i))
+ traceway.CaptureMessageWithContext(twctx, "data loaded successfully "+strconv.Itoa(i))
}
traceway.CaptureExceptionWithContext(twctx, errors.New("what an error"))