@@ -102,13 +102,7 @@ export const runsSchema: TableSchema = {
102102 customRenderType : "queue" ,
103103 } ) ,
104104 } ,
105- schedule_id : {
106- name : "schedule_id" ,
107- ...column ( "String" , {
108- description : "Schedule ID (if triggered by schedule)" ,
109- example : "sched_1234abcd" ,
110- } ) ,
111- } ,
105+
112106 batch_id : {
113107 name : "batch_id" ,
114108 ...column ( "String" , {
@@ -120,19 +114,17 @@ export const runsSchema: TableSchema = {
120114 } ,
121115
122116 // Related runs
123- root_run : {
124- name : "root_run" ,
125- clickhouseName : "root_run_id" ,
117+ root_run_id : {
118+ name : "root_run_id" ,
126119 ...column ( "String" , {
127120 description : "Root run ID (for child runs)" ,
128121 example : "run_cm1a2b3c4d5e6f7g8h9i" ,
129122 customRenderType : "runId" ,
130123 expression : "if(root_run_id = '', NULL, 'run_' || root_run_id)" ,
131124 } ) ,
132125 } ,
133- parent_run : {
134- name : "parent_run" ,
135- clickhouseName : "parent_run_id" ,
126+ parent_run_id : {
127+ name : "parent_run_id" ,
136128 ...column ( "String" , {
137129 description : "Parent run ID (for child runs)" ,
138130 example : "run_cm1a2b3c4d5e6f7g8h9i" ,
@@ -155,55 +147,51 @@ export const runsSchema: TableSchema = {
155147 expression : "if(depth > 0, true, false)" ,
156148 } ,
157149
158- // Telemetry
159- span_id : {
160- name : "span_id" ,
161- ...column ( "String" , { description : "OpenTelemetry span ID" , example : "a1b2c3d4e5f6g7h8" } ) ,
162- } ,
163- trace_id : {
164- name : "trace_id" ,
165- ...column ( "String" , {
166- description : "OpenTelemetry trace ID" ,
167- example : "abc123def456ghi789jkl012mno345pq" ,
168- } ) ,
169- } ,
150+ // Useless until we show the user-provided key
170151 idempotency_key : {
171152 name : "idempotency_key" ,
172153 ...column ( "String" , { description : "Idempotency key" , example : "user-123-action-456" } ) ,
173154 } ,
174155 region : {
175156 name : "region" ,
176157 clickhouseName : "worker_queue" ,
177- ...column ( "String" , { description : "Region" , example : "us-east-1" } ) ,
158+ ...column ( "String" , {
159+ description : "Region" ,
160+ example : "us-east-1" ,
161+ } ) ,
178162 expression : "if(startsWith(worker_queue, 'cm'), NULL, worker_queue)" ,
179163 } ,
180164
181165 // Timing
182- created_at : {
183- name : "created_at" ,
166+ triggered_at : {
167+ name : "triggered_at" ,
168+ clickhouseName : "created_at" ,
184169 ...column ( "DateTime64" , {
185- description : "When the run was created " ,
170+ description : "When the run was triggered. " ,
186171 example : "2024-01-15 09:30:00.000" ,
187172 } ) ,
188173 } ,
189- updated_at : {
190- name : "updated_at" ,
191- ...column ( "DateTime64" , {
192- description : "When the run was last updated" ,
193- example : "2024-01-15 09:30:05.123" ,
174+ queued_at : {
175+ name : "queued_at" ,
176+ ...column ( "Nullable(DateTime64)" , {
177+ description :
178+ "When the run was added to the queue. This is normally the same time as the triggered_at time, unless a delay is passed in or it's a scheduled run." ,
179+ example : "2024-01-15 09:30:01.000" ,
194180 } ) ,
195181 } ,
196- started_at : {
197- name : "started_at" ,
182+ dequeued_at : {
183+ name : "dequeued_at" ,
184+ clickhouseName : "started_at" ,
198185 ...column ( "Nullable(DateTime64)" , {
199- description : "When the run started executing" ,
186+ description :
187+ "When the run was dequeued for execution. This happens when there is available concurrency to execute your run." ,
200188 example : "2024-01-15 09:30:01.000" ,
201189 } ) ,
202190 } ,
203191 executed_at : {
204192 name : "executed_at" ,
205193 ...column ( "Nullable(DateTime64)" , {
206- description : "When execution began" ,
194+ description : "When execution of the run began. " ,
207195 example : "2024-01-15 09:30:01.500" ,
208196 } ) ,
209197 } ,
@@ -221,23 +209,58 @@ export const runsSchema: TableSchema = {
221209 example : "2024-01-15 10:00:00.000" ,
222210 } ) ,
223211 } ,
224- queued_at : {
225- name : "queued_at" ,
226- ...column ( "Nullable(DateTime64)" , {
227- description : "When the run was queued" ,
228- example : "2024-01-15 09:30:00.500" ,
229- } ) ,
212+ has_delay : {
213+ name : "has_delay" ,
214+ ...column ( "UInt8" , { description : "Whether the run had a delay passed in" , example : "1" } ) ,
215+ expression : "if(isNotNull(delay_until), true, false)" ,
230216 } ,
231217 expired_at : {
232218 name : "expired_at" ,
233219 ...column ( "Nullable(DateTime64)" , {
234- description : "When the run expired" ,
220+ description :
221+ 'If there was a TTL on the run, this is when the run "expired". By default dev runs have a TTL of 10 minutes.' ,
235222 example : "2024-01-15 09:35:00.000" ,
236223 } ) ,
237224 } ,
238- expiration_ttl : {
239- name : "expiration_ttl" ,
240- ...column ( "String" , { description : "TTL string for expiration" , example : "5m" } ) ,
225+ ttl : {
226+ name : "ttl" ,
227+ clickhouseName : "expiration_ttl" ,
228+ ...column ( "String" , {
229+ description : "TTL string for expiration. By default dev runs have a TTL of 10m." ,
230+ example : "10m" ,
231+ } ) ,
232+ } ,
233+
234+ // Useful time periods
235+ execution_duration : {
236+ name : "execution_duration" ,
237+ ...column ( "Nullable(Int64)" , {
238+ description :
239+ "The time between starting to execute and completing. This includes any time spent waiting (it is not compute time, use `usage_duration` for that)." ,
240+ customRenderType : "duration" ,
241+ example : "4000" ,
242+ } ) ,
243+ expression : "dateDiff('millisecond', executed_at, completed_at)" ,
244+ } ,
245+ total_duration : {
246+ name : "total_duration" ,
247+ ...column ( "Nullable(Int64)" , {
248+ description :
249+ "The time between being triggered and completing (if it has). This includes any time spent waiting (it is not compute time, use `usage_duration` for that)." ,
250+ customRenderType : "duration" ,
251+ example : "4000" ,
252+ } ) ,
253+ expression : "dateDiff('millisecond', created_at, completed_at)" ,
254+ } ,
255+ queued_duration : {
256+ name : "queued_duration" ,
257+ ...column ( "Nullable(Int64)" , {
258+ description :
259+ "The time between being queued and dequeued. Remember you need enough available concurrency for runs to be dequeued and start executing." ,
260+ customRenderType : "duration" ,
261+ example : "4000" ,
262+ } ) ,
263+ expression : "dateDiff('millisecond', queued_at, started_at)" ,
241264 } ,
242265
243266 // Cost & usage
@@ -331,18 +354,6 @@ export const runsSchema: TableSchema = {
331354 ...column ( "UInt8" , { description : "Whether this is a test run (0 or 1)" , example : "0" } ) ,
332355 expression : "if(is_test > 0, true, false)" ,
333356 } ,
334-
335- // Virtual columns
336- execution_duration : {
337- name : "execution_duration" ,
338- ...column ( "Nullable(Int64)" , {
339- description :
340- "The time between the run starting and completing. This includes any time spent waiting (it is not compute time, use `usage_duration` for that)." ,
341- customRenderType : "duration" ,
342- example : "4000" ,
343- } ) ,
344- expression : "dateDiff('millisecond', started_at, completed_at)" ,
345- } ,
346357 } ,
347358} ;
348359
0 commit comments