Skip to content

Commit a27f6a7

Browse files
committed
crashEvent isn't used anymore
1 parent 1f68ff8 commit a27f6a7

File tree

5 files changed

+27
-59
lines changed

5 files changed

+27
-59
lines changed

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -810,14 +810,6 @@ export class ClickhouseEventRepository implements IEventRepository {
810810
this.addToBatch(event);
811811
}
812812

813-
async crashEvent(params: {
814-
event: TaskEventRecord;
815-
crashedAt: Date;
816-
exception: ExceptionEventProperties;
817-
}): Promise<void> {
818-
throw new Error("ClickhouseEventRepository.crashEvent not implemented");
819-
}
820-
821813
// Query methods
822814
async getTraceSummary(
823815
storeTable: TaskEventStoreTable,
@@ -847,6 +839,8 @@ export class ClickhouseEventRepository implements IEventRepository {
847839
queryBuilder.where("kind != {kind: String}", { kind: "DEBUG_EVENT" });
848840
}
849841

842+
queryBuilder.orderBy("start_time ASC");
843+
850844
const { query, params } = queryBuilder.build();
851845

852846
logger.debug("ClickhouseEventRepository.getTraceSummary query", {

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

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -415,42 +415,6 @@ export class EventRepository implements IEventRepository {
415415
});
416416
}
417417

418-
async crashEvent({
419-
event,
420-
crashedAt,
421-
exception,
422-
}: {
423-
event: TaskEventRecord;
424-
crashedAt: Date;
425-
exception: ExceptionEventProperties;
426-
}) {
427-
if (!event.isPartial) {
428-
return;
429-
}
430-
431-
await this.insertImmediate({
432-
...omit(event, "id"),
433-
isPartial: false,
434-
isError: true,
435-
isCancelled: false,
436-
status: "ERROR",
437-
events: [
438-
{
439-
name: "exception",
440-
time: crashedAt,
441-
properties: {
442-
exception,
443-
},
444-
} satisfies ExceptionSpanEvent,
445-
...((event.events as any[]) ?? []),
446-
],
447-
duration: calculateDurationFromStart(event.startTime, crashedAt),
448-
properties: event.properties as Attributes,
449-
metadata: event.metadata as Attributes,
450-
style: event.style as Attributes,
451-
});
452-
}
453-
454418
public async getTraceSummary(
455419
storeTable: TaskEventStoreTable,
456420
environmentId: string,

apps/webapp/app/v3/eventRepository/eventRepository.types.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,6 @@ export interface IEventRepository {
326326
cancelledAt: Date;
327327
}): Promise<void>;
328328

329-
crashEvent(params: {
330-
event: TaskEventRecord;
331-
crashedAt: Date;
332-
exception: ExceptionEventProperties;
333-
}): Promise<void>;
334-
335329
// Query methods
336330
getTraceSummary(
337331
storeTable: TaskEventStoreTable,

references/hello-world/src/trigger/init.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { logger, tasks } from "@trigger.dev/sdk";
22
// import { setDb } from "../db.js";
33

4-
tasks.middleware("db", ({ ctx, payload, next }) => {
5-
logger.info("Hello, world from the middleware", { ctx, payload });
6-
return next();
7-
});
4+
// tasks.middleware("db", ({ ctx, payload, next }) => {
5+
// logger.info("Hello, world from the middleware", { ctx, payload });
6+
// return next();
7+
// });
88

99
tasks.onCancel(async ({ ctx, payload }) => {
1010
logger.info("Hello, world from the global cancel", { ctx, payload });

references/hello-world/src/trigger/telemetry.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,30 @@ import { setTimeout } from "timers/promises";
44
export const simpleSuccessTask = task({
55
id: "otel/simple-success-task",
66
run: async (payload: any, { ctx }) => {
7-
logger.debug("Hello debug");
8-
logger.log("Hello log");
9-
logger.info("Hello info");
10-
logger.warn("Hello warn");
11-
logger.error("Hello error");
7+
logger.log("Hello log 1");
8+
logger.info("Hello info 1");
9+
logger.warn("Hello warn 1");
10+
logger.error("Hello error 1");
1211

1312
await setTimeout(5000);
1413

14+
logger.log("Hello log 2");
15+
logger.info("Hello info 2");
16+
logger.warn("Hello warn 2");
17+
logger.error("Hello error 2");
18+
1519
return { message: "Hello, world!" };
1620
},
1721
});
22+
23+
export const simpleFailureTask = task({
24+
id: "otel/simple-failure-task",
25+
retry: {
26+
maxAttempts: 1,
27+
},
28+
run: async (payload: any, { ctx }) => {
29+
await setTimeout(5000);
30+
31+
throw new Error("Hello error");
32+
},
33+
});

0 commit comments

Comments
 (0)