Skip to content

Commit f6e156d

Browse files
committed
reduce log level of occurring "precondition" DittoRuntimeExceptions to "DEBUG"
1 parent c6a2c98 commit f6e156d

File tree

3 files changed

+41
-22
lines changed

3 files changed

+41
-22
lines changed

connectivity/service/src/main/java/org/eclipse/ditto/connectivity/service/messaging/OutboundMappingProcessorActor.java

+9-5
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
import org.eclipse.ditto.base.model.acks.AcknowledgementLabel;
5050
import org.eclipse.ditto.base.model.acks.AcknowledgementRequest;
5151
import org.eclipse.ditto.base.model.acks.DittoAcknowledgementLabel;
52+
import org.eclipse.ditto.base.model.common.HttpStatus;
5253
import org.eclipse.ditto.base.model.entity.id.EntityId;
5354
import org.eclipse.ditto.base.model.entity.id.WithEntityId;
5455
import org.eclipse.ditto.base.model.exceptions.DittoRuntimeException;
@@ -553,14 +554,17 @@ private Object handleErrorResponse(final DittoRuntimeException exception, final
553554

554555
final ThreadSafeDittoLoggingAdapter l = logger.withCorrelationId(exception);
555556

556-
if (l.isInfoEnabled()) {
557-
l.info("Got DittoRuntimeException '{}' when ExternalMessage was processed: {} - {}",
558-
exception.getErrorCode(), exception.getMessage(), exception.getDescription().orElse(""));
557+
if (exception.getHttpStatus().equals(HttpStatus.PRECONDITION_FAILED)) {
558+
l.debug("Precondition failed when ExternalMessage was processed: <{}: {}>",
559+
exception.getClass().getSimpleName(), exception.getMessage());
560+
} else {
561+
l.info("Got DittoRuntimeException when ExternalMessage was processed: <{}: {}> - {}",
562+
exception.getClass().getSimpleName(), exception.getMessage(), exception.getDescription().orElse(""));
559563
}
560564
if (l.isDebugEnabled()) {
561565
final String stackTrace = stackTraceAsString(exception);
562-
l.debug("Got DittoRuntimeException '{}' when ExternalMessage was processed: {} - {}. StackTrace: {}",
563-
exception.getErrorCode(), exception.getMessage(), exception.getDescription().orElse(""),
566+
l.debug("Got DittoRuntimeException when ExternalMessage was processed: <{}: {}> - {}. StackTrace: {}",
567+
exception.getClass().getSimpleName(), exception.getMessage(), exception.getDescription().orElse(""),
564568
stackTrace);
565569
}
566570

edge/service/src/main/java/org/eclipse/ditto/edge/service/dispatching/AskWithRetryCommandForwarder.java

+18-12
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,15 @@
1919

2020
import javax.annotation.Nullable;
2121

22+
import org.apache.pekko.actor.AbstractExtensionId;
23+
import org.apache.pekko.actor.ActorRef;
24+
import org.apache.pekko.actor.ActorSystem;
25+
import org.apache.pekko.actor.ExtendedActorSystem;
26+
import org.apache.pekko.actor.Extension;
27+
import org.apache.pekko.cluster.pubsub.DistributedPubSubMessage;
28+
import org.apache.pekko.pattern.AskTimeoutException;
2229
import org.eclipse.ditto.base.model.acks.DittoAcknowledgementLabel;
30+
import org.eclipse.ditto.base.model.common.HttpStatus;
2331
import org.eclipse.ditto.base.model.exceptions.AskException;
2432
import org.eclipse.ditto.base.model.exceptions.DittoInternalErrorException;
2533
import org.eclipse.ditto.base.model.exceptions.DittoRuntimeException;
@@ -28,21 +36,13 @@
2836
import org.eclipse.ditto.base.model.signals.commands.Command;
2937
import org.eclipse.ditto.base.model.signals.commands.CommandResponse;
3038
import org.eclipse.ditto.edge.service.EdgeServiceTimeoutException;
31-
import org.eclipse.ditto.internal.utils.pekko.PekkoClassLoader;
32-
import org.eclipse.ditto.internal.utils.pekko.logging.DittoLoggerFactory;
33-
import org.eclipse.ditto.internal.utils.pekko.logging.ThreadSafeDittoLogger;
3439
import org.eclipse.ditto.internal.utils.cacheloaders.AskWithRetry;
3540
import org.eclipse.ditto.internal.utils.cacheloaders.config.AskWithRetryConfig;
3641
import org.eclipse.ditto.internal.utils.cacheloaders.config.DefaultAskWithRetryConfig;
3742
import org.eclipse.ditto.internal.utils.config.DefaultScopedConfig;
38-
39-
import org.apache.pekko.actor.AbstractExtensionId;
40-
import org.apache.pekko.actor.ActorRef;
41-
import org.apache.pekko.actor.ActorSystem;
42-
import org.apache.pekko.actor.ExtendedActorSystem;
43-
import org.apache.pekko.actor.Extension;
44-
import org.apache.pekko.cluster.pubsub.DistributedPubSubMessage;
45-
import org.apache.pekko.pattern.AskTimeoutException;
43+
import org.eclipse.ditto.internal.utils.pekko.PekkoClassLoader;
44+
import org.eclipse.ditto.internal.utils.pekko.logging.DittoLoggerFactory;
45+
import org.eclipse.ditto.internal.utils.pekko.logging.ThreadSafeDittoLogger;
4646

4747
/**
4848
* Forwards commands from the edges to a specified ActorRef, waiting for a response if the command demands one.
@@ -208,7 +208,13 @@ private DittoRuntimeException reportError(final Command<?> command,
208208
: throwable;
209209
final var dre = DittoRuntimeException.asDittoRuntimeException(
210210
error, t -> reportUnexpectedError(command, t));
211-
LOGGER.withCorrelationId(command).info("{}: {}", dre.getClass().getSimpleName(), dre.getMessage());
211+
if (dre.getHttpStatus().equals(HttpStatus.PRECONDITION_FAILED)) {
212+
LOGGER.withCorrelationId(command)
213+
.debug("Precondition failed: <{}: {}>", dre.getClass().getSimpleName(), dre.getMessage());
214+
} else {
215+
LOGGER.withCorrelationId(command)
216+
.info("{}: {}", dre.getClass().getSimpleName(), dre.getMessage());
217+
}
212218
return dre;
213219
}
214220

internal/utils/persistent-actors/src/main/java/org/eclipse/ditto/internal/utils/persistentactors/AbstractPersistenceSupervisor.java

+14-5
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.apache.pekko.stream.javadsl.StreamRefs;
4646
import org.bson.BsonDocument;
4747
import org.eclipse.ditto.base.api.commands.sudo.SudoCommand;
48+
import org.eclipse.ditto.base.model.common.HttpStatus;
4849
import org.eclipse.ditto.base.model.entity.id.EntityId;
4950
import org.eclipse.ditto.base.model.exceptions.DittoInternalErrorException;
5051
import org.eclipse.ditto.base.model.exceptions.DittoRuntimeException;
@@ -833,14 +834,22 @@ private void handleSignalEnforcementResponse(@Nullable final Object response,
833834

834835
if (null != throwable) {
835836
final DittoRuntimeException dre = getEnforcementExceptionAsRuntimeException(throwable, signal);
836-
log.withCorrelationId(dre)
837-
.info("Received DittoRuntimeException during enforcement or " +
838-
"forwarding to target actor, telling sender: {}", dre);
837+
if (dre.getHttpStatus().equals(HttpStatus.PRECONDITION_FAILED)) {
838+
log.withCorrelationId(dre)
839+
.debug("Precondition during enforcement or " +
840+
"forwarding to target actor, telling sender: {}", dre);
841+
} else {
842+
log.withCorrelationId(dre)
843+
.info("Received DittoRuntimeException during enforcement or " +
844+
"forwarding to target actor, telling sender: {}", dre);
845+
}
839846
sender.tell(dre, getSelf());
840847
} else if (response instanceof Status.Success success) {
841-
log.withCorrelationId(signal).debug("Ignoring Status.Success message as expected 'to be ignored' outcome: <{}>", success);
848+
log.withCorrelationId(signal)
849+
.debug("Ignoring Status.Success message as expected 'to be ignored' outcome: <{}>", success);
842850
} else if (null != response) {
843-
log.withCorrelationId(signal).debug("Sending response: <{}> back to sender: <{}>", response, sender.path());
851+
log.withCorrelationId(signal)
852+
.debug("Sending response: <{}> back to sender: <{}>", response, sender.path());
844853
sender.tell(response, getSelf());
845854
} else {
846855
log.withCorrelationId(signal)

0 commit comments

Comments
 (0)