@@ -29,7 +29,7 @@ private async Async.Task<HttpResponseData> Post(HttpRequestData req) {
2929        } 
3030
3131        var  envelope  =  request . OkV ; 
32-         _log . Info ( $ "node event: machine_id:  { envelope . MachineId }  event:  { EntityConverter . ToJsonString ( envelope ) } ") ; 
32+         _log . WithTag ( "HttpRequest" ,   "POST" ) . Info ( $ "node event: { envelope . MachineId : Tag:MachineId }   { EntityConverter . ToJsonString ( envelope ) : Tag:Event } ") ; 
3333
3434        var  error  =  envelope . Event  switch  { 
3535            NodeStateUpdate  updateEvent  =>  await  OnStateUpdate ( envelope . MachineId ,  updateEvent ) , 
@@ -66,20 +66,20 @@ private async Async.Task<HttpResponseData> Post(HttpRequestData req) {
6666    private  async  Async . Task < Error ? >  OnStateUpdate ( Guid  machineId ,  NodeStateUpdate  ev )  { 
6767        var  node  =  await  _context . NodeOperations . GetByMachineId ( machineId ) ; 
6868        if  ( node  is  null )  { 
69-             _log . Warning ( $ "unable to process state update event. machine_id: { machineId }  state event: { ev } ") ; 
69+             _log . Warning ( $ "unable to process state update event. { machineId : Tag:MachineId }   { ev : Tag:Event } ") ; 
7070            return  null ; 
7171        } 
7272
7373        if  ( ev . State  ==  NodeState . Free )  { 
7474            if  ( node . ReimageRequested  ||  node . DeleteRequested )  { 
75-                 _log . Info ( $ "stopping free node with reset flags: { machineId } ") ; 
75+                 _log . Info ( $ "stopping free node with reset flags: { machineId : Tag:MachineId } ") ; 
7676                // discard result: node not used after this point 
7777                _  =  await  _context . NodeOperations . Stop ( node ) ; 
7878                return  null ; 
7979            } 
8080
8181            if  ( await  _context . NodeOperations . CouldShrinkScaleset ( node ) )  { 
82-                 _log . Info ( $ "stopping free node to resize scaleset: { machineId } ") ; 
82+                 _log . Info ( $ "stopping free node to resize scaleset: { machineId : Tag:MachineId } ") ; 
8383                // discard result: node not used after this point 
8484                _  =  await  _context . NodeOperations . SetHalt ( node ) ; 
8585                return  null ; 
@@ -88,7 +88,7 @@ private async Async.Task<HttpResponseData> Post(HttpRequestData req) {
8888
8989        if  ( ev . State  ==  NodeState . Init )  { 
9090            if  ( node . DeleteRequested )  { 
91-                 _log . Info ( $ "stopping node (init and delete_requested): { machineId } ") ; 
91+                 _log . Info ( $ "stopping node (init and delete_requested): { machineId : Tag:MachineId } ") ; 
9292                // discard result: node not used after this point 
9393                _  =  await  _context . NodeOperations . Stop ( node ) ; 
9494                return  null ; 
@@ -103,11 +103,11 @@ private async Async.Task<HttpResponseData> Post(HttpRequestData req) {
103103            return  null ; 
104104        } 
105105
106-         _log . Info ( $ "node state update: { machineId }  from { node . State }  to { ev . State } ") ; 
106+         _log . Info ( $ "node state update: { machineId : Tag:MachineId }  from { node . State : Tag:FromState }  to { ev . State : Tag:ToState } ") ; 
107107        node  =  await  _context . NodeOperations . SetState ( node ,  ev . State ) ; 
108108
109109        if  ( ev . State  ==  NodeState . Free )  { 
110-             _log . Info ( $ "node now available for work: { machineId } ") ; 
110+             _log . Info ( $ "node now available for work: { machineId : Tag:MachineId } ") ; 
111111        }  else  if  ( ev . State  ==  NodeState . SettingUp )  { 
112112            if  ( ev . Data  is  NodeSettingUpEventData  settingUpData )  { 
113113                if  ( ! settingUpData . Tasks . Any ( ) )  { 
@@ -124,7 +124,7 @@ private async Async.Task<HttpResponseData> Post(HttpRequestData req) {
124124                            Errors :  new  string [ ]  {  $ "unable to find task: { taskId } "} ) ; 
125125                    } 
126126
127-                     _log . Info ( $ "node starting task.  machine_id:  { machineId }  job_id:  { task . JobId }  task_id:  { task . TaskId } ") ; 
127+                     _log . Info ( $ "node starting task. { machineId : Tag:MachineId }   { task . JobId : Tag:JobId }   { task . TaskId : Tag: TaskId} ") ; 
128128
129129                    // The task state may be `running` if it has `vm_count` > 1, and 
130130                    // another node is concurrently executing the task. If so, leave 
@@ -142,7 +142,7 @@ private async Async.Task<HttpResponseData> Post(HttpRequestData req) {
142142                        State :  NodeTaskState . SettingUp ) ; 
143143                    var  r  =  await  _context . NodeTasksOperations . Replace ( nodeTask ) ; 
144144                    if  ( ! r . IsOk )  { 
145-                         _log . WithHttpStatus ( r . ErrorV ) . Error ( $ "Failed to replace node task { task . TaskId } ") ; 
145+                         _log . WithHttpStatus ( r . ErrorV ) . Error ( $ "Failed to replace node task { task . TaskId : Tag:TaskId } ") ; 
146146                    } 
147147                } 
148148            } 
@@ -152,7 +152,7 @@ private async Async.Task<HttpResponseData> Post(HttpRequestData req) {
152152                if  ( doneData . Error  is  not null )  { 
153153                    var  errorText  =  EntityConverter . ToJsonString ( doneData ) ; 
154154                    error  =  new  Error ( ErrorCode . TASK_FAILED ,  Errors :  new  string [ ]  {  errorText  } ) ; 
155-                     _log . Error ( $ "node 'done' with error: machine_id: { machineId } , data: { errorText } ") ; 
155+                     _log . Error ( $ "node 'done' { machineId : Tag:MachineId }  -  { errorText : Tag:Error } ") ; 
156156                } 
157157            } 
158158
@@ -208,15 +208,15 @@ private async Async.Task<HttpResponseData> Post(HttpRequestData req) {
208208            State :  NodeTaskState . Running ) ; 
209209        var  r  =  await  _context . NodeTasksOperations . Replace ( nodeTask ) ; 
210210        if  ( ! r . IsOk )  { 
211-             _log . WithHttpStatus ( r . ErrorV ) . Error ( $ "failed to replace node task { nodeTask . TaskId } ") ; 
211+             _log . WithHttpStatus ( r . ErrorV ) . Error ( $ "failed to replace node task { nodeTask . TaskId : Tag:TaskId } ") ; 
212212        } 
213213
214214        if  ( task . State . ShuttingDown ( ) )  { 
215-             _log . Info ( $ "ignoring task start from node. machine_id: { machineId }  job_id: { task . JobId }  task_id: { task . TaskId }  (state:  { task . State } )") ; 
215+             _log . Info ( $ "ignoring task start from node. { machineId : Tag:MachineId }   { task . JobId : Tag:JobId }   { task . TaskId : Tag:TaskId }  ({ task . State : Tag: State} )") ; 
216216            return  null ; 
217217        } 
218218
219-         _log . Info ( $ "task started on node. machine_id: { machineId }  job_id: { task . JobId }  task_id: { task . TaskId } ") ; 
219+         _log . Info ( $ "task started on node. { machineId : Tag:MachineId }   { task . JobId : Tag:JobId }   { task . TaskId : Tag: TaskId} ") ; 
220220        task  =  await  _context . TaskOperations . SetState ( task ,  TaskState . Running ) ; 
221221
222222        var  taskEvent  =  new  TaskEvent ( 
@@ -225,7 +225,7 @@ private async Async.Task<HttpResponseData> Post(HttpRequestData req) {
225225            EventData :  new  WorkerEvent ( Running :  running ) ) ; 
226226        r  =  await  _context . TaskEventOperations . Replace ( taskEvent ) ; 
227227        if  ( ! r . IsOk )  { 
228-             _log . WithHttpStatus ( r . ErrorV ) . Error ( $ "failed to replace taskEvent for task with id  { taskEvent . TaskId } ") ; 
228+             _log . WithHttpStatus ( r . ErrorV ) . Error ( $ "failed to replace taskEvent { taskEvent . TaskId : Tag: TaskId} ") ; 
229229        } 
230230
231231        return  null ; 
@@ -255,15 +255,15 @@ private async Async.Task<HttpResponseData> Post(HttpRequestData req) {
255255        } ; 
256256
257257        if  ( done . ExitStatus . Success )  { 
258-             _log . Info ( $ "task done. { task . JobId } :{ task . TaskId }  status: { done . ExitStatus } ") ; 
258+             _log . Info ( $ "task done. { task . JobId : Tag:JobId } :{ task . TaskId : Tag:TaskId }   { done . ExitStatus : Tag:Status } ") ; 
259259            await  _context . TaskOperations . MarkStopping ( task ) ; 
260260
261261            // keep node if keep-on-completion is set 
262262            if  ( task . Config . Debug ? . Contains ( TaskDebugFlag . KeepNodeOnCompletion )  ==  true )  { 
263263                node  =  node  with  {  DebugKeepNode  =  true  } ; 
264264                var  r  =  await  _context . NodeOperations . Replace ( node ) ; 
265265                if  ( ! r . IsOk )  { 
266-                     _log . WithHttpStatus ( r . ErrorV ) . Error ( $ "keepNodeOnCompletion: failed to replace node { node . MachineId }  when setting debug keep node to true") ; 
266+                     _log . WithHttpStatus ( r . ErrorV ) . Error ( $ "keepNodeOnCompletion: failed to replace node { node . MachineId : Tag:MachineId }  when setting debug keep node to true") ; 
267267                } 
268268            } 
269269        }  else  { 
@@ -283,22 +283,22 @@ await _context.TaskOperations.MarkFailed(
283283                node  =  node  with  {  DebugKeepNode  =  true  } ; 
284284                var  r  =  await  _context . NodeOperations . Replace ( node ) ; 
285285                if  ( ! r . IsOk )  { 
286-                     _log . WithHttpStatus ( r . ErrorV ) . Error ( $ "keepNodeOnfFailure: failed to replace node { node . MachineId }  when setting debug keep node to true") ; 
286+                     _log . WithHttpStatus ( r . ErrorV ) . Error ( $ "keepNodeOnfFailure: failed to replace node { node . MachineId : Tag:MachineId }  when setting debug keep node to true") ; 
287287                } 
288288            } 
289289        } 
290290
291291        if  ( ! node . DebugKeepNode )  { 
292292            var  r  =  await  _context . NodeTasksOperations . Delete ( new  NodeTasks ( machineId ,  done . TaskId ) ) ; 
293293            if  ( ! r . IsOk )  { 
294-                 _log . WithHttpStatus ( r . ErrorV ) . Error ( $ "failed to deleting node task since DebugKeepNode is false") ; 
294+                 _log . WithHttpStatus ( r . ErrorV ) . Error ( $ "failed to deleting node task { done . TaskId : Tag:TaskId }  for:  { machineId : Tag:MachineId }   since DebugKeepNode is false") ; 
295295            } 
296296        } 
297297
298298        var  taskEvent  =  new  TaskEvent ( done . TaskId ,  machineId ,  new  WorkerEvent  {  Done  =  done  } ) ; 
299299        var  r1  =  await  _context . TaskEventOperations . Replace ( taskEvent ) ; 
300300        if  ( ! r1 . IsOk )  { 
301-             _log . WithHttpStatus ( r1 . ErrorV ) . Error ( $ "failed to update task event for done task { done . TaskId } ") ; 
301+             _log . WithHttpStatus ( r1 . ErrorV ) . Error ( $ "failed to update task event for done task { done . TaskId : Tag:TaskId } ") ; 
302302        } 
303303        return  null ; 
304304    } 
0 commit comments