Skip to content

Commit 2c0b7bf

Browse files
committed
wip
1 parent cbf0872 commit 2c0b7bf

File tree

1 file changed

+124
-0
lines changed

1 file changed

+124
-0
lines changed

TaskEvent_Property_Analysis.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# TaskEvent/CreatableEvent Property Usage Analysis
2+
3+
This document analyzes every property in TaskEvent/CreatableEvent to determine which ones are actually used in the UI and which can be removed for optimization.
4+
5+
## Properties to KEEP (Used in UI)
6+
7+
| Property | Type | Used In | Usage Description |
8+
| ------------------------------ | ---------------------- | -------------------------------------- | ------------------------------------------------------------------------ |
9+
| **Core Identity & Structure** |
10+
| `id` | String | Database operations | Primary key, generated automatically |
11+
| `traceId` | String | Query operations, trace identification | Used for trace queries and grouping |
12+
| `spanId` | String | TraceSummary, SpanDetails | Tree structure, span identification |
13+
| `parentId` | String? | TraceSummary | Tree hierarchy in `createTreeFromFlatItems` |
14+
| `message` | String | TraceSummary, SpanDetails | Displayed as span title in `SpanTitle.tsx:20`, tree view |
15+
| **Status & State** |
16+
| `isError` | Boolean | TraceSummary, SpanDetails | Error status display, filtering, status icons |
17+
| `isPartial` | Boolean | TraceSummary, SpanDetails | In-progress status display, timeline calculations |
18+
| `isCancelled` | Boolean | TraceSummary, SpanDetails | Cancelled status display, status determination |
19+
| `level` | TaskEventLevel | TraceSummary, SpanDetails | Text styling (`SpanTitle.tsx:91-109`), timeline rendering decisions |
20+
| `kind` | TaskEventKind | TraceSummary | Filter "UNSPECIFIED" events, determine debug status |
21+
| `status` | TaskEventStatus | Event creation | Status tracking in event creation |
22+
| **Timing** |
23+
| `startTime` | BigInt | TraceSummary, SpanDetails | Timeline calculations, display (`RunPresenter.server.ts:166,171`) |
24+
| `duration` | BigInt | TraceSummary, SpanDetails | Timeline width, duration display, calculations |
25+
| `createdAt` | DateTime | Database queries | Time-based queries, automatic generation |
26+
| **Content & Display** |
27+
| `events` | Json | TraceSummary, SpanDetails | Timeline events (`RunPresenter.server.ts:181-185`), SpanEvents component |
28+
| `style` | Json | TraceSummary, SpanDetails | Icons, variants, accessories (`RunIcon`, `SpanTitle`) |
29+
| `properties` | Json | SpanDetails | Displayed as JSON in span properties (`CodeBlock`) |
30+
| `metadata` | Json? | SpanDetails | Event transformation, span details processing |
31+
| `links` | Json? | SpanDetails | Span linking functionality (processed but not currently displayed) |
32+
| **Context (Query/Processing)** |
33+
| `runId` | String | Query operations | Used in queries, not displayed in TraceSummary UI |
34+
| `idempotencyKey` | String? | SpanDetails | Displayed in span detail properties (conditional) |
35+
| `attemptNumber` | Int? | Processing logic | Used for attempt failed logic, not displayed |
36+
| `environmentType` | RuntimeEnvironmentType | Processing | Selected in queries, used in processing |
37+
| `taskSlug` | String | SpanDetails | Displayed in span details, task filtering |
38+
| `workerVersion` | String? | SpanDetails | Displayed in span version field |
39+
40+
## Properties to REMOVE (Not Used in UI)
41+
42+
| Property | Type | Reason for Removal | Notes |
43+
| ---------------------------------- | ------- | ------------------------------------- | ------------------------------------------------ |
44+
| **Service Information** |
45+
| `serviceName` | String | Set to "api server", never displayed | Hardcoded value, no UI usage |
46+
| `serviceNamespace` | String | Set to "trigger.dev", never displayed | Hardcoded value, no UI usage |
47+
| `tracestate` | String? | OpenTelemetry tracestate, not used | OpenTelemetry field, no UI display |
48+
| **Organization & Project Context** |
49+
| `environmentId` | String | Used for queries, not displayed | Backend context only |
50+
| `organizationId` | String | Used for queries, not displayed | Backend context only |
51+
| `projectId` | String | Used for queries, not displayed | Backend context only |
52+
| `projectRef` | String | Used for queries, not displayed | Backend context only |
53+
| `runIsTest` | Boolean | Not displayed in UI | Backend flag, no UI display |
54+
| **Worker & Queue Information** |
55+
| `workerId` | String? | Not used in UI rendering | Backend context only |
56+
| `queueId` | String? | Not used in UI rendering | Backend context only |
57+
| `queueName` | String? | Selected but not rendered | Selected in DetailedTraceEvent but not displayed |
58+
| `batchId` | String? | Not used in UI rendering | Backend context only |
59+
| **Task Information** |
60+
| `taskPath` | String? | Selected but not rendered | Selected in DetailedTraceEvent but not used |
61+
| `taskExportName` | String? | Not selected or used | Not selected in any queries |
62+
| **Attempt Information** |
63+
| `attemptId` | String? | Not selected or used | Legacy field, not used |
64+
| `isDebug` | Boolean | Deprecated field | Replaced by `kind === TaskEventKind.LOG` |
65+
| **Content (Unused)** |
66+
| `output` | Json? | **NOT DISPLAYED** in span UI | Returned by getSpan but never rendered |
67+
| `payload` | Json? | **NOT DISPLAYED** in span UI | Returned by getSpan but never rendered |
68+
| `outputType` | String? | Not used in UI rendering | Type information not displayed |
69+
| `payloadType` | String? | Not used in UI rendering | Type information not displayed |
70+
| **Usage & Cost Tracking** |
71+
| `usageDurationMs` | Int | Not used in UI rendering | Analytics data, no UI display |
72+
| `usageCostInCents` | Float | Not used in UI rendering | Analytics data, no UI display |
73+
| **Machine Information** |
74+
| `machinePreset` | String? | Selected but not rendered | Selected in DetailedTraceEvent but not displayed |
75+
| `machinePresetCpu` | Float? | Not selected or used | Not selected in queries |
76+
| `machinePresetMemory` | Float? | Not selected or used | Not selected in queries |
77+
| `machinePresetCentsPerMs` | Float? | Not selected or used | Not selected in queries |
78+
79+
## Summary Statistics
80+
81+
- **Total Properties**: ~51 properties in TaskEvent
82+
- **Properties to Keep**: 22 properties (43%)
83+
- **Properties to Remove**: 29 properties (57%)
84+
85+
## Optimization Opportunities
86+
87+
### TraceSummary (getTraceSummary)
88+
89+
- **Current Selection**: 15 properties via `QueriedEvent`
90+
- **Optimization**: Already optimized, only selects necessary fields
91+
- **Potential Removal**: `runId`, `environmentType` (selected but not used in UI)
92+
93+
### Span Details (getSpan)
94+
95+
- **Current Selection**: ALL TaskEvent properties (full object)
96+
- **Used in UI**: 19 properties
97+
- **Optimization**: Could remove ~65% of properties
98+
- **Major Removals**: `payload`, `output`, all context/metadata fields
99+
100+
### CreatableEvent (Event Creation)
101+
102+
- **Current**: Includes many unused fields
103+
- **Optimization**: Remove ~29 properties that are never displayed
104+
- **Keep**: Core fields needed for queries and UI display
105+
106+
## Implementation Notes
107+
108+
1. **TraceSummary** is already well-optimized with selective field queries
109+
2. **getSpan** has the biggest optimization opportunity - fetches full TaskEvent but only uses ~35%
110+
3. **CreatableEvent** could be split into:
111+
- `MinimalCreatableEvent` for TraceSummary use cases
112+
- `DetailedCreatableEvent` for full span details
113+
4. Properties marked as "Selected but not rendered" could be removed unless needed for future features
114+
115+
## Verification Status
116+
117+
**Verified**: All property usage has been systematically verified by examining:
118+
119+
- TraceSummary UI components and data flow
120+
- Span detail UI components (`SpanBody`, `SpanEntity`, `SpanTitle`)
121+
- All query selectors (`QueriedEvent`, `DetailedTraceEvent`)
122+
- Actual UI rendering code
123+
124+
This analysis is based on comprehensive examination of the actual UI components and their property access patterns.

0 commit comments

Comments
 (0)