@@ -168,43 +168,53 @@ func Run(cfg config.Config) {
168168 // tasks and updates are empty.
169169 subscribe := calls .Subscribe (unacknowledgedTasks (state ), unacknowledgedUpdates (state ))
170170
171- log .Debug ("subscribing to agent for events" )
171+ log .WithField ("executorId" , state .executor .GetExecutorID ().Value ).
172+ Debug ("subscribing to agent for events" )
172173 // ↓ empty context ↓ we get a plain RequestFunc from the executor.Call value
173174 resp , err := subscriber .Send (context .TODO (), calls .NonStreaming (subscribe ))
174175 if resp != nil {
175176 defer resp .Close ()
176177 }
177178 if err == nil {
178179 log .WithField ("level" , infologger .IL_Support ).
180+ WithField ("executorId" , state .executor .GetExecutorID ().Value ).
179181 Info ("executor subscribed, ready to receive events" )
180182 // We're officially connected, start decoding events
181183 err = eventLoop (state , resp , handler )
182184 // If we're out of the eventLoop, means a disconnect happened, willingly or not.
183185 disconnected = time .Now ()
184- log .Debug ("event loop finished" )
186+ log .WithField ("level" , infologger .IL_Support ).
187+ WithField ("executorId" , state .executor .GetExecutorID ().Value ).
188+ Info ("event loop finished" )
185189 }
186190 if err != nil && err != io .EOF {
187191 log .WithField ("error" , err ).
192+ WithField ("executorId" , state .executor .GetExecutorID ().Value ).
188193 Error ("executor disconnected with error" )
189194 } else {
190- log .Info ("executor disconnected" )
195+ log .WithField ("executorId" , state .executor .GetExecutorID ().Value ).
196+ Info ("executor disconnected" )
191197 }
192198 }()
193199 if state .shouldQuit {
194- log .Info ("gracefully shutting down on request" )
200+ log .WithField ("executorId" , state .executor .GetExecutorID ().Value ).
201+ Info ("gracefully shutting down on request" )
195202 return
196203 }
197204 // The purpose of checkpointing is to handle recovery when mesos-agent exits.
198205 if ! cfg .Checkpoint {
199- log .Info ("gracefully exiting because framework checkpointing is not enabled" )
206+ log .WithField ("executorId" , state .executor .GetExecutorID ().Value ).
207+ Info ("gracefully exiting because framework checkpointing is not enabled" )
200208 return
201209 }
202210 if time .Now ().Sub (disconnected ) > cfg .RecoveryTimeout {
203211 log .WithField ("timeout" , cfg .RecoveryTimeout ).
212+ WithField ("executorId" , state .executor .GetExecutorID ().Value ).
204213 Error ("failed to re-establish subscription with agent within recovery timeout, aborting" )
205214 return
206215 }
207- log .Debug ("waiting for reconnect timeout" )
216+ log .WithField ("executorId" , state .executor .GetExecutorID ().Value ).
217+ Debug ("waiting for reconnect timeout" )
208218 <- shouldReconnect // wait for some amount of time before retrying subscription
209219 }
210220}
0 commit comments