Skip to content

Commit 3295f35

Browse files
committed
removed a bunch of unnecessary data
1 parent 0d5eb9f commit 3295f35

14 files changed

+290
-430
lines changed

TaskEvent_Property_Analysis.md

Lines changed: 74 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,10 @@ This document analyzes every property in TaskEvent/CreatableEvent to determine w
2828
| `style` | Json | TraceSummary, SpanDetails | Icons, variants, accessories (`RunIcon`, `SpanTitle`) |
2929
| `properties` | Json | SpanDetails | Displayed as JSON in span properties (`CodeBlock`) |
3030
| `metadata` | Json? | SpanDetails | Event transformation, span details processing |
31-
| `links` | Json? | SpanDetails | Span linking functionality (processed but not currently displayed) |
3231
| **Context (Query/Processing)** |
3332
| `runId` | String | Query operations | Used in queries, not displayed in TraceSummary UI |
34-
| `idempotencyKey` | String? | SpanDetails | Displayed in span detail properties (conditional) |
3533
| `attemptNumber` | Int? | Processing logic | Used for attempt failed logic, not displayed |
3634
| `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 |
3935

4036
## Properties to REMOVE (Not Used in UI)
4137

@@ -59,6 +55,13 @@ This document analyzes every property in TaskEvent/CreatableEvent to determine w
5955
| **Task Information** |
6056
| `taskPath` | String? | Selected but not rendered | Selected in DetailedTraceEvent but not used |
6157
| `taskExportName` | String? | Not selected or used | Not selected in any queries |
58+
| `taskSlug` | String | Not displayed in current UI | Previously used for filtering, no longer needed |
59+
| **Worker Information** |
60+
| `workerVersion` | String? | Not displayed in current UI | Previously used for version display, removed |
61+
| **Key Information** |
62+
| `idempotencyKey` | String? | Not displayed in current UI | Previously used for span details, removed |
63+
| **Link Information** |
64+
| `links` | Json? | Not displayed in current UI | Span linking functionality, not currently used |
6265
| **Attempt Information** |
6366
| `attemptId` | String? | Not selected or used | Legacy field, not used |
6467
| `isDebug` | Boolean | Deprecated field | Replaced by `kind === TaskEventKind.LOG` |
@@ -79,8 +82,8 @@ This document analyzes every property in TaskEvent/CreatableEvent to determine w
7982
## Summary Statistics
8083

8184
- **Total Properties**: ~51 properties in TaskEvent
82-
- **Properties to Keep**: 22 properties (43%)
83-
- **Properties to Remove**: 29 properties (57%)
85+
- **Properties to Keep**: 18 properties (35%)
86+
- **Properties to Remove**: 33 properties (65%)
8487

8588
## Optimization Opportunities
8689

@@ -93,20 +96,20 @@ This document analyzes every property in TaskEvent/CreatableEvent to determine w
9396
### Span Details (getSpan)
9497

9598
- **Current Selection**: ALL TaskEvent properties (full object)
96-
- **Used in UI**: 19 properties
99+
- **Used in UI**: 15 properties (after removing idempotencyKey, taskSlug, workerVersion, links)
97100
- **Optimization**: Could remove ~65% of properties
98-
- **Major Removals**: `payload`, `output`, all context/metadata fields
101+
- **Major Removals**: `payload`, `output`, `idempotencyKey`, `taskSlug`, `workerVersion`, `links`, all context/metadata fields
99102

100103
### CreatableEvent (Event Creation)
101104

102105
- **Current**: Includes many unused fields
103-
- **Optimization**: Remove ~29 properties that are never displayed
106+
- **Optimization**: Remove ~33 properties that are never displayed
104107
- **Keep**: Core fields needed for queries and UI display
105108

106109
## Implementation Notes
107110

108111
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%
112+
2. **getSpan** has the biggest optimization opportunity - fetches full TaskEvent but only uses ~30%
110113
3. **CreatableEvent** could be split into:
111114
- `MinimalCreatableEvent` for TraceSummary use cases
112115
- `DetailedCreatableEvent` for full span details
@@ -122,3 +125,64 @@ This document analyzes every property in TaskEvent/CreatableEvent to determine w
122125
- Actual UI rendering code
123126

124127
This analysis is based on comprehensive examination of the actual UI components and their property access patterns.
128+
129+
## Properties and Metadata Column Extraction Analysis
130+
131+
This table shows the specific keys that are extracted from the `properties` and `metadata` JSON columns and how they are used.
132+
133+
### Properties Column Extractions
134+
135+
| Key | SemanticInternalAttribute | Used In | Usage Description | Status |
136+
| ---------------------------------------- | ------------------------- | --------------------- | ------------------------------------------------------- | ------- |
137+
| **Entity Information** |
138+
| `$entity.type` | `ENTITY_TYPE` | SpanPresenter | Entity type switching (waitpoint, attempt, etc.) | ✅ USED |
139+
| `$entity.id` | `ENTITY_ID` | SpanPresenter | Entity ID for waitpoint/attempt lookup | ✅ USED |
140+
| **Run Relationships** |
141+
| `$original_run_id` | `ORIGINAL_RUN_ID` | SpanPresenter | Points to original run for cached spans | ✅ USED |
142+
| **Display Control** |
143+
| `$show.actions` | `SHOW_ACTIONS` | EventRepository | Controls action bar display (computed to showActionBar) | ✅ USED |
144+
| **Styling (from enrichCreatableEvents)** |
145+
| `gen_ai.system` | N/A | enrichCreatableEvents | Icon determination for AI spans | ✅ USED |
146+
| `name` | N/A | enrichCreatableEvents | Icon determination for agent workflows | ✅ USED |
147+
| **Exception Handling** |
148+
| `project.dir` | `PROJECT_DIR` | transformException | Stack trace correction in development | ✅ USED |
149+
| **All Other Properties** |
150+
| Various | N/A | SpanDetails UI | Displayed as JSON in properties CodeBlock | ✅ USED |
151+
152+
### Metadata Column Extractions
153+
154+
| Key | SemanticInternalAttribute | Used In | Usage Description | Status |
155+
| ------------------------ | ------------------------- | --------------- | ------------------------------------ | ------- |
156+
| **Warm Start Detection** |
157+
| `$warm_start` | `WARM_START` | SpanPresenter | Determines if attempt was warm start | ✅ USED |
158+
| **Event Transformation** |
159+
| Various | N/A | transformEvents | Used in event transformation logic | ✅ USED |
160+
161+
### Properties/Metadata Keys NOT Extracted (Unused)
162+
163+
Based on SemanticInternalAttributes that are NOT used in UI code:
164+
165+
| Key | SemanticInternalAttribute | Reason Not Used |
166+
| ------------------------ | ------------------------- | ------------------------ |
167+
| `ctx.environment.id` | `ENVIRONMENT_ID` | Backend context only |
168+
| `ctx.environment.type` | `ENVIRONMENT_TYPE` | Backend context only |
169+
| `ctx.organization.id` | `ORGANIZATION_ID` | Backend context only |
170+
| `ctx.project.id` | `PROJECT_ID` | Backend context only |
171+
| `ctx.run.id` | `RUN_ID` | Backend context only |
172+
| `ctx.task.id` | `TASK_SLUG` | No longer displayed |
173+
| `worker.version` | `WORKER_VERSION` | No longer displayed |
174+
| `ctx.run.idempotencyKey` | `IDEMPOTENCY_KEY` | No longer displayed |
175+
| `ctx.queue.name` | `QUEUE_NAME` | Backend context only |
176+
| `ctx.machine.*` | `MACHINE_PRESET_*` | Not displayed in UI |
177+
| `$output` | `OUTPUT` | Not displayed in span UI |
178+
| `$payload` | `PAYLOAD` | Not displayed in span UI |
179+
| And many others... | | Backend/processing only |
180+
181+
### Summary
182+
183+
- **Properties Column**: ~9 specific keys extracted and used in UI
184+
- **Metadata Column**: ~2 specific keys extracted and used in UI
185+
- **Unused Keys**: ~30+ SemanticInternalAttributes not used in UI
186+
- **Generic Usage**: Properties are also displayed as JSON in span details
187+
188+
The majority of data in both columns is either backend context or unused in the current UI implementation.

apps/webapp/app/runEngine/concerns/traceEvents.server.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export class DefaultTraceEventsConcern implements TraceEventConcern {
2020
{
2121
context: request.options?.traceContext,
2222
spanParentAsLink: request.options?.spanParentAsLink,
23-
parentAsLinkType: request.options?.parentAsLinkType,
2423
kind: "SERVER",
2524
environment: request.environment,
2625
taskSlug: request.taskId,
@@ -31,11 +30,6 @@ export class DefaultTraceEventsConcern implements TraceEventConcern {
3130
style: {
3231
icon: request.options?.customIcon ?? "task",
3332
},
34-
runIsTest: request.body.options?.test ?? false,
35-
batchId: request.options?.batchId
36-
? BatchId.toFriendlyId(request.options.batchId)
37-
: undefined,
38-
idempotencyKey: request.options?.idempotencyKey,
3933
},
4034
incomplete: true,
4135
immediate: true,
@@ -73,7 +67,6 @@ export class DefaultTraceEventsConcern implements TraceEventConcern {
7367
{
7468
context: request.options?.traceContext,
7569
spanParentAsLink: request.options?.spanParentAsLink,
76-
parentAsLinkType: request.options?.parentAsLinkType,
7770
kind: "SERVER",
7871
environment: request.environment,
7972
taskSlug: request.taskId,
@@ -85,11 +78,6 @@ export class DefaultTraceEventsConcern implements TraceEventConcern {
8578
style: {
8679
icon: "task-cached",
8780
},
88-
runIsTest: request.body.options?.test ?? false,
89-
batchId: request.options?.batchId
90-
? BatchId.toFriendlyId(request.options.batchId)
91-
: undefined,
92-
idempotencyKey,
9381
runId: existingRun.friendlyId,
9482
},
9583
incomplete,

apps/webapp/app/v3/clickhouseEventRepository.server.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { EventEmitter } from "node:stream";
22
import type { ClickHouse } from "@internal/clickhouse";
33
import type {
44
IEventRepository,
5-
CreatableEvent,
5+
CreateEventInput,
66
CompleteableTaskRun,
77
TraceEventOptions,
88
EventBuilder,
@@ -42,19 +42,19 @@ export class ClickhouseEventRepository implements IEventRepository {
4242
}
4343

4444
// Event insertion methods
45-
async insert(event: CreatableEvent): Promise<void> {
45+
async insert(event: CreateEventInput): Promise<void> {
4646
throw new Error("ClickhouseEventRepository.insert not implemented");
4747
}
4848

49-
async insertImmediate(event: CreatableEvent): Promise<void> {
49+
async insertImmediate(event: CreateEventInput): Promise<void> {
5050
throw new Error("ClickhouseEventRepository.insertImmediate not implemented");
5151
}
5252

53-
async insertMany(events: CreatableEvent[]): Promise<void> {
53+
async insertMany(events: CreateEventInput[]): Promise<void> {
5454
throw new Error("ClickhouseEventRepository.insertMany not implemented");
5555
}
5656

57-
async insertManyImmediate(events: CreatableEvent[]): Promise<CreatableEvent[]> {
57+
async insertManyImmediate(events: CreateEventInput[]): Promise<void> {
5858
throw new Error("ClickhouseEventRepository.insertManyImmediate not implemented");
5959
}
6060

@@ -164,7 +164,7 @@ export class ClickhouseEventRepository implements IEventRepository {
164164
async recordEvent(
165165
message: string,
166166
options: TraceEventOptions & { duration?: number; parentId?: string }
167-
): Promise<CreatableEvent> {
167+
): Promise<CreateEventInput> {
168168
throw new Error("ClickhouseEventRepository.recordEvent not implemented");
169169
}
170170

apps/webapp/app/v3/dynamicFlushScheduler.server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export class DynamicFlushScheduler<T> {
243243
// Don't await here - let them run concurrently
244244
Promise.allSettled(flushPromises).then(() => {
245245
// After flush completes, check if we need to flush more
246-
if (this.batchQueue.length > 0) {
246+
if (this.batchQueue.length > 0 && !this.isShuttingDown && this.consecutiveFlushFailures < 3) {
247247
this.flushBatches();
248248
}
249249
});

0 commit comments

Comments
 (0)