@@ -196,6 +196,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
196196 */
197197 private wideRoute < T > (
198198 ctx : { req : IncomingMessage ; res : ServerResponse ; params ?: unknown } ,
199+ op : string ,
199200 route : string ,
200201 method : string ,
201202 fn : ( ) => Promise < T > | T ,
@@ -211,7 +212,11 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
211212 method,
212213 traceparent : this . headerValueFromRequest ( ctx . req , "traceparent" ) ,
213214 inboundRequestId : this . headerValueFromRequest ( ctx . req , "x-request-id" ) ,
214- setup : ( state ) => this . attachRouteMeta ( state , ctx . params ) ,
215+ setup : ( state ) => {
216+ state . extras . op = op ;
217+ state . extras . kind = "inbound" ;
218+ this . attachRouteMeta ( state , ctx . params ) ;
219+ } ,
215220 } ,
216221 fn ,
217222 ( state ) => {
@@ -243,6 +248,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
243248 handler : async ( ctx ) =>
244249 this . wideRoute (
245250 ctx ,
251+ "attempt.start" ,
246252 "/api/v1/workload-actions/runs/:runFriendlyId/snapshots/:snapshotFriendlyId/attempts/start" ,
247253 "POST" ,
248254 async ( ) => {
@@ -278,6 +284,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
278284 handler : async ( ctx ) =>
279285 this . wideRoute (
280286 ctx ,
287+ "attempt.complete" ,
281288 "/api/v1/workload-actions/runs/:runFriendlyId/snapshots/:snapshotFriendlyId/attempts/complete" ,
282289 "POST" ,
283290 async ( ) => {
@@ -315,6 +322,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
315322 handler : async ( ctx ) =>
316323 this . wideRoute (
317324 ctx ,
325+ "heartbeat" ,
318326 "/api/v1/workload-actions/runs/:runFriendlyId/snapshots/:snapshotFriendlyId/heartbeat" ,
319327 "POST" ,
320328 async ( ) => {
@@ -351,6 +359,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
351359 handler : async ( ctx ) =>
352360 this . wideRoute (
353361 ctx ,
362+ "suspend" ,
354363 "/api/v1/workload-actions/runs/:runFriendlyId/snapshots/:snapshotFriendlyId/suspend" ,
355364 "GET" ,
356365 async ( ) => {
@@ -446,6 +455,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
446455 handler : async ( ctx ) =>
447456 this . wideRoute (
448457 ctx ,
458+ "continue" ,
449459 "/api/v1/workload-actions/runs/:runFriendlyId/snapshots/:snapshotFriendlyId/continue" ,
450460 "GET" ,
451461 async ( ) => {
@@ -487,6 +497,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
487497 handler : async ( ctx ) =>
488498 this . wideRoute (
489499 ctx ,
500+ "snapshots.since" ,
490501 "/api/v1/workload-actions/runs/:runFriendlyId/snapshots/since/:snapshotFriendlyId" ,
491502 "GET" ,
492503 async ( ) => {
@@ -522,6 +533,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
522533 handler : async ( ctx ) =>
523534 this . wideRoute (
524535 ctx ,
536+ "deployment.dequeue" ,
525537 "/api/v1/workload-actions/deployments/:deploymentId/dequeue" ,
526538 "GET" ,
527539 async ( ) => {
@@ -555,6 +567,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
555567 handler : async ( ctx ) =>
556568 this . wideRoute (
557569 ctx ,
570+ "logs.debug" ,
558571 "/api/v1/workload-actions/runs/:runFriendlyId/logs/debug" ,
559572 "POST" ,
560573 async ( ) => {
@@ -576,6 +589,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
576589 handler : async ( ctx ) =>
577590 this . wideRoute (
578591 ctx ,
592+ "logs.debug" ,
579593 "/api/v1/workload-actions/runs/:runFriendlyId/logs/debug" ,
580594 "POST" ,
581595 async ( ) => {
@@ -590,7 +604,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
590604 httpServer . route ( "/api/v1/compute/snapshot-complete" , "POST" , {
591605 bodySchema : SnapshotCallbackPayloadSchema ,
592606 handler : async ( ctx ) =>
593- this . wideRoute ( ctx , "/api/v1/compute/snapshot-complete" , "POST" , async ( ) => {
607+ this . wideRoute ( ctx , "snapshot.callback" , " /api/v1/compute/snapshot-complete", "POST" , async ( ) => {
594608 const { reply, body } = ctx ;
595609 if ( ! this . snapshotService ) {
596610 reply . empty ( 404 ) ;
@@ -680,6 +694,8 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
680694 emitOneShot ( {
681695 ...this . wideEventOpts ,
682696 populate : ( state ) => {
697+ state . extras . op = event === "run_connected" ? "socket.run.connected" : "socket.run.disconnected" ;
698+ state . extras . kind = "event" ;
683699 state . extras . event = event ;
684700 setMeta ( state , "run_id" , friendlyId ) ;
685701 if ( socket . data . deploymentId ) {
0 commit comments