Merge "Some improved traces"
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/clients/AsyncRestClient.java b/policy-agent/src/main/java/org/oransc/policyagent/clients/AsyncRestClient.java
index 4ba58c7..b292c51 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/clients/AsyncRestClient.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/clients/AsyncRestClient.java
@@ -196,7 +196,7 @@
logger.debug("{} HTTP error status = '{}', body '{}'", traceTag, exception.getStatusCode(),
exception.getResponseBodyAsString());
} else {
- logger.debug("{} HTTP error: {}", traceTag, t.getMessage());
+ logger.debug("{} HTTP error", traceTag, t);
}
}
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java b/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java
index 49d7702..832bbe9 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/controllers/PolicyController.java
@@ -269,6 +269,7 @@
RejectionException e = new RejectionException("Policy cannot change RIC, policyId: " + current.id() + //
", RIC name: " + current.ric().name() + //
", new name: " + policy.ric().name(), HttpStatus.CONFLICT);
+ logger.debug("Request rejected, {}", e);
return Mono.error(e);
}
return Mono.just("OK");
@@ -276,6 +277,7 @@
private Mono<Object> checkSupportedType(Ric ric, PolicyType type) {
if (!ric.isSupportingType(type.name())) {
+ logger.debug("Request rejected, type not supported, RIC: {}", ric);
RejectionException e = new RejectionException(
"Type: " + type.name() + " not supported by RIC: " + ric.name(), HttpStatus.NOT_FOUND);
return Mono.error(e);
@@ -287,6 +289,7 @@
if (ric.getState() == Ric.RicState.AVAILABLE) {
return Mono.just("OK");
} else {
+ logger.debug("Request rejected RIC not IDLE, ric: {}", ric);
RejectionException e = new RejectionException(
"Ric is not operational, RIC name: " + ric.name() + ", state: " + ric.getState(), HttpStatus.LOCKED);
return Mono.error(e);
diff --git a/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageHandler.java b/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageHandler.java
index c50a46f..19d1564 100644
--- a/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageHandler.java
+++ b/policy-agent/src/main/java/org/oransc/policyagent/dmaap/DmaapMessageHandler.java
@@ -35,6 +35,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
+import org.springframework.web.reactive.function.client.WebClientException;
import org.springframework.web.reactive.function.client.WebClientResponseException;
import reactor.core.publisher.Mono;
@@ -81,7 +82,7 @@
private Mono<ResponseEntity<String>> handleAgentCallError(Throwable t, String originalMessage,
DmaapRequestMessage dmaapRequestMessage) {
logger.debug("Agent call failed: {}", t.getMessage());
- HttpStatus status = HttpStatus.NOT_FOUND;
+ HttpStatus status = HttpStatus.INTERNAL_SERVER_ERROR;
String errorMessage = t.getMessage();
if (t instanceof WebClientResponseException) {
WebClientResponseException exception = (WebClientResponseException) t;
@@ -90,7 +91,8 @@
} else if (t instanceof ServiceException) {
status = HttpStatus.BAD_REQUEST;
errorMessage = prepareBadOperationErrorMessage(t, originalMessage);
-
+ } else if (!(t instanceof WebClientException)) {
+ logger.warn("Unexpected exception ", t);
}
return sendDmaapResponse(errorMessage, dmaapRequestMessage, status) //
.flatMap(notUsed -> Mono.empty());
@@ -119,7 +121,6 @@
} else {
return Mono.error(new ServiceException("Not implemented operation: " + operation));
}
-
}
private String payload(DmaapRequestMessage message) {