Skip to content

Commit e7a100b

Browse files
committed
Add container id to the logs of ActivationClientProxy
1 parent bad5904 commit e7a100b

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/v2/ActivationClientProxy.scala

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ class ActivationClientProxy(
124124
stay()
125125

126126
case Event(e: RescheduleActivation, client: Client) =>
127-
logging.info(this, s"got a reschedule message ${e.msg.activationId} for action: ${e.msg.action}")
127+
logging.info(this, s"[${containerId.asString}] got a reschedule message ${e.msg.activationId} for action: ${e.msg.action}")
128128
client.activationClient
129129
.rescheduleActivation(
130130
RescheduleRequest(e.invocationNamespace, e.fqn.serialize, e.rev.serialize, e.msg.serialize))
131131
.recover {
132132
case t =>
133-
logging.error(this, s"Failed to reschedule activation (error: $t)")
133+
logging.error(this, s"[${containerId.asString}] Failed to reschedule activation (error: $t)")
134134
RescheduleResponse()
135135
}
136136
.foreach(res => {
@@ -139,7 +139,7 @@ class ActivationClientProxy(
139139
stay()
140140

141141
case Event(msg: ActivationMessage, _: Client) =>
142-
logging.debug(this, s"got a message ${msg.activationId} for action: ${msg.action}")
142+
logging.debug(this, s"[${containerId.asString}] got a message ${msg.activationId} for action: ${msg.action}")
143143
context.parent ! msg
144144

145145
stay()
@@ -152,7 +152,7 @@ class ActivationClientProxy(
152152
case _: NoMemoryQueue =>
153153
logging.error(
154154
this,
155-
s"The queue of action ${action} under invocationNamespace ${invocationNamespace} does not exist. Check for queues in other schedulers.")
155+
s"[${containerId.asString}] The queue of action ${action} under invocationNamespace ${invocationNamespace} does not exist. Check for queues in other schedulers.")
156156
c.activationClient
157157
.close()
158158
.flatMap(_ =>
@@ -162,15 +162,15 @@ class ActivationClientProxy(
162162
stay()
163163

164164
case _: ActionMismatch =>
165-
logging.error(this, s"action version does not match: $action")
165+
logging.error(this, s"[${containerId.asString}] action version does not match: $action")
166166
c.activationClient.close().andThen {
167167
case _ => self ! ClientClosed
168168
}
169169

170170
goto(ClientProxyRemoving)
171171

172172
case _: NoActivationMessage => // retry
173-
logging.debug(this, s"no activation message exist: $action")
173+
logging.debug(this, s"[${containerId.asString}] no activation message exist: $action")
174174
context.parent ! RetryRequestActivation
175175

176176
stay()
@@ -182,7 +182,7 @@ class ActivationClientProxy(
182182
case Event(f: FailureMessage, c: Client) =>
183183
f.cause match {
184184
case t: ParsingException =>
185-
logging.error(this, s"failed to parse activation message: $t")
185+
logging.error(this, s"[${containerId.asString}] failed to parse activation message: $t")
186186
context.parent ! RetryRequestActivation
187187

188188
stay()
@@ -191,13 +191,13 @@ class ActivationClientProxy(
191191
// In such situation, it is better to stop the activationClientProxy, otherwise, in short time,
192192
// it would print huge log due to create another grpcClient to fetch activation again.
193193
case t: StatusRuntimeException if t.getMessage.contains(ActivationClientProxy.hostResolveError) =>
194-
logging.error(this, s"akka grpc server connection failed: $t")
194+
logging.error(this, s"[${containerId.asString}] akka grpc server connection failed: $t")
195195
self ! ClientClosed
196196

197197
goto(ClientProxyRemoving)
198198

199199
case t: StatusRuntimeException =>
200-
logging.error(this, s"akka grpc server connection failed: $t")
200+
logging.error(this, s"[${containerId.asString}] akka grpc server connection failed: $t")
201201
c.activationClient
202202
.close()
203203
.flatMap(_ =>
@@ -207,13 +207,13 @@ class ActivationClientProxy(
207207
stay()
208208

209209
case _: ClientClosedException =>
210-
logging.error(this, s"grpc client is already closed for $action")
210+
logging.error(this, s"[${containerId.asString}] grpc client is already closed for $action")
211211
self ! ClientClosed
212212

213213
goto(ClientProxyRemoving)
214214

215215
case t: Throwable =>
216-
logging.error(this, s"get activation from remote server error: $t")
216+
logging.error(this, s"[${containerId.asString}] get activation from remote server error: $t")
217217
safelyCloseClient(c)
218218
goto(ClientProxyRemoving)
219219
}
@@ -247,7 +247,7 @@ class ActivationClientProxy(
247247
stay()
248248

249249
case Event(f: FailureMessage, c: Client) =>
250-
logging.error(this, s"some error happened for action: ${action} in state: $stateName, caused by: $f")
250+
logging.error(this, s"[${containerId.asString}] some error happened for action: ${action} in state: $stateName, caused by: $f")
251251
safelyCloseClient(c)
252252
stay()
253253

@@ -276,18 +276,18 @@ class ActivationClientProxy(
276276
// to the container(parent), rather than sending `RetryRequestActivation`.
277277
// When a container proxy(parent) receives `ClientClosed`, it will finally shut down.
278278
case Event(GracefulShutdown, _: Client) =>
279-
logging.info(this, "safely close client proxy and go to the ClientProxyRemoving state")
279+
logging.info(this, s"[${containerId.asString}] safely close client proxy and go to the ClientProxyRemoving state")
280280

281281
goto(ClientProxyRemoving)
282282

283283
case Event(ClientClosed, _) =>
284-
logging.info(this, "the underlying client is closed, stopping the activation client proxy")
284+
logging.info(this, s"[${containerId.asString}] the underlying client is closed, stopping the activation client proxy")
285285
context.parent ! ClientClosed
286286

287287
stop()
288288

289289
case Event(StopClientProxy, c: Client) =>
290-
logging.info(this, "stop close client proxy and go to the ClientProxyRemoving state")
290+
logging.info(this, s"[${containerId.asString}] stop close client proxy and go to the ClientProxyRemoving state")
291291
safelyCloseClient(c)
292292
stay()
293293
}

0 commit comments

Comments
 (0)