Merge pull request #13623 from volodymyr-babak/edge-logs-impr
EdgeGrpcSession - improve logs on delivery failues
This commit is contained in:
		
						commit
						24d695727a
					
				@ -452,14 +452,15 @@ public abstract class EdgeGrpcSession implements Closeable {
 | 
				
			|||||||
                    List<DownlinkMsg> copy = new ArrayList<>(sessionState.getPendingMsgsMap().values());
 | 
					                    List<DownlinkMsg> copy = new ArrayList<>(sessionState.getPendingMsgsMap().values());
 | 
				
			||||||
                    if (attempt > 1) {
 | 
					                    if (attempt > 1) {
 | 
				
			||||||
                        String error = "Failed to deliver the batch";
 | 
					                        String error = "Failed to deliver the batch";
 | 
				
			||||||
                        String failureMsg = String.format("{%s}: {%s}", error, copy);
 | 
					                        String failureMsg = String.format("{%s} (size: {%s})", error, copy.size());
 | 
				
			||||||
                        if (attempt == 2) {
 | 
					                        if (attempt == 2) {
 | 
				
			||||||
                            // Send a failure notification only on the second attempt.
 | 
					                            // Send a failure notification only on the second attempt.
 | 
				
			||||||
                            // This ensures that failure alerts are sent just once to avoid redundant notifications.
 | 
					                            // This ensures that failure alerts are sent just once to avoid redundant notifications.
 | 
				
			||||||
                            ctx.getRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(tenantId)
 | 
					                            ctx.getRuleProcessor().process(EdgeCommunicationFailureTrigger.builder().tenantId(tenantId)
 | 
				
			||||||
                                    .edgeId(edge.getId()).customerId(edge.getCustomerId()).edgeName(edge.getName()).failureMsg(failureMsg).error(error).build());
 | 
					                                    .edgeId(edge.getId()).customerId(edge.getCustomerId()).edgeName(edge.getName()).failureMsg(failureMsg).error(error).build());
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        log.warn("[{}][{}] {}, attempt: {}", tenantId, edge.getId(), failureMsg, attempt);
 | 
					                        log.warn("[{}][{}] {} on attempt {}", tenantId, edge.getId(), failureMsg, attempt);
 | 
				
			||||||
 | 
					                        log.debug("[{}][{}] entities in failed batch: {}", tenantId, edge.getId(), copy);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    log.trace("[{}][{}][{}] downlink msg(s) are going to be send.", tenantId, edge.getId(), copy.size());
 | 
					                    log.trace("[{}][{}][{}] downlink msg(s) are going to be send.", tenantId, edge.getId(), copy.size());
 | 
				
			||||||
                    for (DownlinkMsg downlinkMsg : copy) {
 | 
					                    for (DownlinkMsg downlinkMsg : copy) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user