@@ -184,6 +184,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
184184 */
185185 private wideRoute < T > (
186186 ctx : { req : IncomingMessage ; res : ServerResponse ; params ?: unknown } ,
187+ op : string ,
187188 route : string ,
188189 method : string ,
189190 fn : ( ) => Promise < T > | T ,
@@ -199,7 +200,11 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
199200 method,
200201 traceparent : this . headerValueFromRequest ( ctx . req , "traceparent" ) ,
201202 inboundRequestId : this . headerValueFromRequest ( ctx . req , "x-request-id" ) ,
202- setup : ( state ) => this . attachRouteMeta ( state , ctx . params ) ,
203+ setup : ( state ) => {
204+ state . extras . op = op ;
205+ state . extras . kind = "inbound" ;
206+ this . attachRouteMeta ( state , ctx . params ) ;
207+ } ,
203208 } ,
204209 fn ,
205210 ( state ) => {
@@ -231,6 +236,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
231236 handler : async ( ctx ) =>
232237 this . wideRoute (
233238 ctx ,
239+ "attempt.start" ,
234240 "/api/v1/workload-actions/runs/:runFriendlyId/snapshots/:snapshotFriendlyId/attempts/start" ,
235241 "POST" ,
236242 async ( ) => {
@@ -266,6 +272,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
266272 handler : async ( ctx ) =>
267273 this . wideRoute (
268274 ctx ,
275+ "attempt.complete" ,
269276 "/api/v1/workload-actions/runs/:runFriendlyId/snapshots/:snapshotFriendlyId/attempts/complete" ,
270277 "POST" ,
271278 async ( ) => {
@@ -303,6 +310,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
303310 handler : async ( ctx ) =>
304311 this . wideRoute (
305312 ctx ,
313+ "heartbeat" ,
306314 "/api/v1/workload-actions/runs/:runFriendlyId/snapshots/:snapshotFriendlyId/heartbeat" ,
307315 "POST" ,
308316 async ( ) => {
@@ -339,6 +347,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
339347 handler : async ( ctx ) =>
340348 this . wideRoute (
341349 ctx ,
350+ "suspend" ,
342351 "/api/v1/workload-actions/runs/:runFriendlyId/snapshots/:snapshotFriendlyId/suspend" ,
343352 "GET" ,
344353 async ( ) => {
@@ -434,6 +443,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
434443 handler : async ( ctx ) =>
435444 this . wideRoute (
436445 ctx ,
446+ "continue" ,
437447 "/api/v1/workload-actions/runs/:runFriendlyId/snapshots/:snapshotFriendlyId/continue" ,
438448 "GET" ,
439449 async ( ) => {
@@ -475,6 +485,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
475485 handler : async ( ctx ) =>
476486 this . wideRoute (
477487 ctx ,
488+ "snapshots.since" ,
478489 "/api/v1/workload-actions/runs/:runFriendlyId/snapshots/since/:snapshotFriendlyId" ,
479490 "GET" ,
480491 async ( ) => {
@@ -510,6 +521,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
510521 handler : async ( ctx ) =>
511522 this . wideRoute (
512523 ctx ,
524+ "deployment.dequeue" ,
513525 "/api/v1/workload-actions/deployments/:deploymentId/dequeue" ,
514526 "GET" ,
515527 async ( ) => {
@@ -541,6 +553,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
541553 handler : async ( ctx ) =>
542554 this . wideRoute (
543555 ctx ,
556+ "logs.debug" ,
544557 "/api/v1/workload-actions/runs/:runFriendlyId/logs/debug" ,
545558 "POST" ,
546559 async ( ) => {
@@ -562,6 +575,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
562575 handler : async ( ctx ) =>
563576 this . wideRoute (
564577 ctx ,
578+ "logs.debug" ,
565579 "/api/v1/workload-actions/runs/:runFriendlyId/logs/debug" ,
566580 "POST" ,
567581 async ( ) => {
@@ -576,7 +590,7 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
576590 httpServer . route ( "/api/v1/compute/snapshot-complete" , "POST" , {
577591 bodySchema : SnapshotCallbackPayloadSchema ,
578592 handler : async ( ctx ) =>
579- this . wideRoute ( ctx , "/api/v1/compute/snapshot-complete" , "POST" , async ( ) => {
593+ this . wideRoute ( ctx , "snapshot.callback" , " /api/v1/compute/snapshot-complete", "POST" , async ( ) => {
580594 const { reply, body } = ctx ;
581595 if ( ! this . snapshotService ) {
582596 reply . empty ( 404 ) ;
@@ -666,6 +680,8 @@ export class WorkloadServer extends EventEmitter<WorkloadServerEvents> {
666680 emitOneShot ( {
667681 ...this . wideEventOpts ,
668682 populate : ( state ) => {
683+ state . extras . op = event === "run_connected" ? "socket.run.connected" : "socket.run.disconnected" ;
684+ state . extras . kind = "event" ;
669685 state . extras . event = event ;
670686 setMeta ( state , "run_id" , friendlyId ) ;
671687 if ( socket . data . deploymentId ) {
0 commit comments