@@ -217,14 +217,24 @@ func (cp *CommandPlugin) processDataPlaneHealth(ctx context.Context, msg *bus.Me
217217
218218 cp .processDataPlaneResponse (ctx , & bus.Message {
219219 Topic : bus .DataPlaneResponseTopic ,
220- Data : cp .createDataPlaneResponse (correlationID , mpi .CommandResponse_COMMAND_STATUS_FAILURE ,
221- "Failed to send the health status update" , err .Error ()),
220+ Data : cp .createDataPlaneResponse (
221+ correlationID ,
222+ mpi .CommandResponse_COMMAND_STATUS_FAILURE ,
223+ mpi .DataPlaneResponse_HEALTH_REQUEST ,
224+ "Failed to send the health status update" ,
225+ err .Error (),
226+ ),
222227 })
223228 }
224229 cp .processDataPlaneResponse (ctx , & bus.Message {
225230 Topic : bus .DataPlaneResponseTopic ,
226- Data : cp .createDataPlaneResponse (correlationID , mpi .CommandResponse_COMMAND_STATUS_OK ,
227- "Successfully sent health status update" , "" ),
231+ Data : cp .createDataPlaneResponse (
232+ correlationID ,
233+ mpi .CommandResponse_COMMAND_STATUS_OK ,
234+ mpi .DataPlaneResponse_HEALTH_REQUEST ,
235+ "Successfully sent health status update" ,
236+ "" ,
237+ ),
228238 })
229239 }
230240}
@@ -242,8 +252,25 @@ func (cp *CommandPlugin) processInstanceHealth(ctx context.Context, msg *bus.Mes
242252func (cp * CommandPlugin ) processDataPlaneResponse (ctx context.Context , msg * bus.Message ) {
243253 slog .DebugContext (ctx , "Command plugin received data plane response message" )
244254 if response , ok := msg .Data .(* mpi.DataPlaneResponse ); ok {
245- slog .InfoContext (ctx , "Sending data plane response message" , "message" ,
246- response .GetCommandResponse ().GetMessage (), "status" , response .GetCommandResponse ().GetStatus ())
255+ // To prevent this type of request from spamming the logs too much, we use debug level
256+ if response .GetRequestType () != mpi .DataPlaneResponse_HEALTH_REQUEST {
257+ slog .InfoContext (
258+ ctx ,
259+ "Sending data plane response message" ,
260+ "message" , response .GetCommandResponse ().GetMessage (),
261+ "status" , response .GetCommandResponse ().GetStatus (),
262+ "error" , response .GetCommandResponse ().GetError (),
263+ )
264+ } else {
265+ slog .DebugContext (
266+ ctx ,
267+ "Sending data plane response message" ,
268+ "message" , response .GetCommandResponse ().GetMessage (),
269+ "status" , response .GetCommandResponse ().GetStatus (),
270+ "error" , response .GetCommandResponse ().GetError (),
271+ )
272+ }
273+
247274 err := cp .commandService .SendDataPlaneResponse (ctx , response )
248275 if err != nil {
249276 slog .ErrorContext (ctx , "Unable to send data plane response" , "error" , err )
@@ -318,7 +345,8 @@ func (cp *CommandPlugin) monitorSubscribeChannel(ctx context.Context) {
318345 slog .InfoContext (ctx , "Received management plane config apply request" )
319346 cp .handleConfigApplyRequest (newCtx , message )
320347 case * mpi.ManagementPlaneRequest_HealthRequest :
321- slog .InfoContext (ctx , "Received management plane health request" )
348+ // To prevent this type of request from spamming the logs too much, we use debug level
349+ slog .DebugContext (ctx , "Received management plane health request" )
322350 cp .handleHealthRequest (newCtx )
323351 case * mpi.ManagementPlaneRequest_ActionRequest :
324352 if cp .commandServerType != model .Command {
@@ -445,7 +473,10 @@ func (cp *CommandPlugin) handleInvalidRequest(ctx context.Context,
445473 }
446474}
447475
448- func (cp * CommandPlugin ) createDataPlaneResponse (correlationID string , status mpi.CommandResponse_CommandStatus ,
476+ func (cp * CommandPlugin ) createDataPlaneResponse (
477+ correlationID string ,
478+ status mpi.CommandResponse_CommandStatus ,
479+ requestType mpi.DataPlaneResponse_RequestType ,
449480 message , err string ,
450481) * mpi.DataPlaneResponse {
451482 return & mpi.DataPlaneResponse {
@@ -459,5 +490,6 @@ func (cp *CommandPlugin) createDataPlaneResponse(correlationID string, status mp
459490 Message : message ,
460491 Error : err ,
461492 },
493+ RequestType : requestType ,
462494 }
463495}
0 commit comments