Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .server-changes/task-run-plan-type-clickhouse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
area: webapp
type: improvement
---

Store the run's plan type on the runs analytics table so reporting can group runs by plan.
1 change: 1 addition & 0 deletions apps/webapp/app/services/runsReplicationService.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,7 @@ export class RunsReplicationService {
run.bulkActionGroupIds ?? [], // bulk_action_group_ids
baseWorkerQueue(run.masterQueue ?? ""), // worker_queue (raw - operators slice by this)
run.region ?? "", // region (geo for customers)
run.planType ?? "", // plan_type
run.maxDurationInSeconds ?? null, // max_duration_in_seconds
annotations?.triggerSource ?? "", // trigger_source
annotations?.rootTriggerSource ?? "", // root_trigger_source
Expand Down
2 changes: 2 additions & 0 deletions apps/webapp/test/runsReplicationService.part1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ describe("RunsReplicationService (part 1/7)", () => {
queue: "test",
workerQueue: "us-east-1-next",
region: "us-east-1",
planType: "free",
runtimeEnvironmentId: runtimeEnvironment.id,
projectId: project.id,
organizationId: organization.id,
Expand Down Expand Up @@ -126,6 +127,7 @@ describe("RunsReplicationService (part 1/7)", () => {
// worker_queue stays the raw backing (operators); region is the geo (customers)
worker_queue: "us-east-1-next",
region: "us-east-1",
plan_type: "free",
})
);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-- +goose Up
ALTER TABLE trigger_dev.task_runs_v2
ADD COLUMN IF NOT EXISTS plan_type LowCardinality(String) DEFAULT '';

-- +goose Down
ALTER TABLE trigger_dev.task_runs_v2
DROP COLUMN IF EXISTS plan_type;
8 changes: 8 additions & 0 deletions internal-packages/clickhouse/src/taskRuns.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ describe("Task Runs V2", () => {
["bulk_action_group_id_1234", "bulk_action_group_id_1235"], // bulk_action_group_ids
"", // worker_queue
"", // region
"", // plan_type
null, // max_duration_in_seconds
"", // trigger_source
"", // root_trigger_source
Expand Down Expand Up @@ -217,6 +218,7 @@ describe("Task Runs V2", () => {
[], // bulk_action_group_ids
"", // worker_queue
"", // region
"", // plan_type
null, // max_duration_in_seconds
"", // trigger_source
"", // root_trigger_source
Expand Down Expand Up @@ -273,6 +275,7 @@ describe("Task Runs V2", () => {
[], // bulk_action_group_ids
"", // worker_queue
"", // region
"", // plan_type
null, // max_duration_in_seconds
"", // trigger_source
"", // root_trigger_source
Expand Down Expand Up @@ -376,6 +379,7 @@ describe("Task Runs V2", () => {
[], // bulk_action_group_ids
"", // worker_queue
"", // region
"", // plan_type
null, // max_duration_in_seconds
"", // trigger_source
"", // root_trigger_source
Expand Down Expand Up @@ -487,6 +491,7 @@ describe("Task Runs V2", () => {
[], // bulk_action_group_ids
"", // worker_queue
"", // region
"", // plan_type
null, // max_duration_in_seconds
"", // trigger_source
"", // root_trigger_source
Expand Down Expand Up @@ -543,6 +548,7 @@ describe("Task Runs V2", () => {
[],
"", // worker_queue
"", // region
"", // plan_type
null,
"",
"",
Expand Down Expand Up @@ -605,6 +611,7 @@ describe("Task Runs V2", () => {
[],
"", // worker_queue
"", // region
"", // plan_type
null,
"",
"",
Expand Down Expand Up @@ -661,6 +668,7 @@ describe("Task Runs V2", () => {
[],
"", // worker_queue
"", // region
"", // plan_type
null,
"",
"",
Expand Down
4 changes: 4 additions & 0 deletions internal-packages/clickhouse/src/taskRuns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const TaskRunV2 = z.object({
bulk_action_group_ids: z.array(z.string()).default([]),
worker_queue: z.string().default(""),
region: z.string().default(""),
plan_type: z.string().default(""),
max_duration_in_seconds: z.number().int().nullish(),
trigger_source: z.string().default(""),
root_trigger_source: z.string().default(""),
Expand Down Expand Up @@ -110,6 +111,7 @@ export const TASK_RUN_COLUMNS = [
"bulk_action_group_ids",
"worker_queue",
"region",
"plan_type",
"max_duration_in_seconds",
"trigger_source",
"root_trigger_source",
Expand Down Expand Up @@ -178,6 +180,7 @@ export type TaskRunFieldTypes = {
bulk_action_group_ids: string[];
worker_queue: string;
region: string;
plan_type: string;
max_duration_in_seconds: number | null;
trigger_source: string;
root_trigger_source: string;
Expand Down Expand Up @@ -317,6 +320,7 @@ export type TaskRunInsertArray = [
bulk_action_group_ids: string[],
worker_queue: string,
region: string,
plan_type: string,
max_duration_in_seconds: number | null,
trigger_source: string,
root_trigger_source: string,
Expand Down