Skip to content

Commit

Permalink
Categorize ssh tunnel exceptions
Browse files Browse the repository at this point in the history
Signed-off-by: Yannic Klem <yannic.klem@bosch.io>
  • Loading branch information
Yannic92 committed Aug 5, 2021
1 parent 9f3e06a commit 251c34f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.eclipse.ditto.connectivity.service.config.DittoConnectivityConfig;
import org.eclipse.ditto.connectivity.service.config.MonitoringConfig;
import org.eclipse.ditto.connectivity.service.messaging.ConnectivityStatusResolver;
import org.eclipse.ditto.connectivity.service.messaging.internal.ConnectionFailure;
import org.eclipse.ditto.connectivity.service.messaging.internal.RetrieveAddressStatus;
import org.eclipse.ditto.connectivity.service.messaging.monitoring.logs.ConnectionLogger;
import org.eclipse.ditto.connectivity.service.messaging.monitoring.logs.ConnectionLoggerRegistry;
Expand Down Expand Up @@ -290,7 +291,7 @@ private ResourceStatus getResourceStatus() {
statusDetail = "ssh tunnel established.";
} else if (error != null) {
status = connectivityStatusResolver.resolve(error);
statusDetail = String.format("ssh tunnel failed (reason: %s).", error.getMessage());
statusDetail = ConnectionFailure.determineFailureDescription(Instant.now(), error, "SSH tunnel failed");
} else {
status = ConnectivityStatus.CLOSED;
statusDetail = "ssh tunnel closed.";
Expand Down
5 changes: 5 additions & 0 deletions connectivity/service/src/main/resources/connectivity.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ ditto {
{exceptionName: "com.rabbitmq.client.AuthenticationFailureException", messagePattern: ".*"}
{exceptionName: "com.rabbitmq.client.ShutdownSignalException", messagePattern: ".*"}
{exceptionName: "javax.net.ssl.SSLException", messagePattern: ".*"}
# SSH Tunnel
{exceptionName: "java.nio.channels.UnresolvedAddressException", messagePattern: ".*"}
{exceptionName: "org.apache.sshd.common.SshException", messagePattern: ".*authentication.*"}
{exceptionName: "java.net.ConnectException: Connection refused", messagePattern: ".*"}
{exceptionName: "java.lang.RuntimeException", messagePattern: ".*load key from.*"} //thrown when private key could not be loaded
]

user-indicated-errors-extended = []
Expand Down

0 comments on commit 251c34f

Please sign in to comment.