summaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java/com
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@vespa.ai>2023-10-10 16:00:19 +0200
committerBjørn Christian Seime <bjorncs@vespa.ai>2023-10-10 16:00:19 +0200
commitb9780c7937e3c7f8b0872ccb8b9371955d3e97db (patch)
treebc7739bb7e258824ab1bea905b386a3b5af26739 /controller-server/src/main/java/com
parent50ff7486f25d1bb321534c57af805580fbd52cca (diff)
Add debug logging to determine why deploy warnings are not mailed
Diffstat (limited to 'controller-server/src/main/java/com')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java14
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/Notifier.java3
2 files changed, 13 insertions, 4 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
index fad70329136..287342f1290 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
@@ -18,6 +18,7 @@ import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
+import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -32,6 +33,8 @@ import static com.yahoo.vespa.hosted.controller.notification.Notification.Type;
*/
public class NotificationsDb {
+ private static final Logger log = Logger.getLogger(NotificationsDb.class.getName());
+
private final Clock clock;
private final CuratorDb curatorDb;
private final Notifier notifier;
@@ -78,7 +81,10 @@ public class NotificationsDb {
notifications.add(notification);
curatorDb.writeNotifications(source.tenant(), notifications);
}
- changed.ifPresent(notifier::dispatch);
+ changed.ifPresent(c -> {
+ log.fine(() -> "New notification %s".formatted(c));
+ notifier.dispatch(c);
+ });
}
/** Remove the notification with the given source and type */
@@ -156,9 +162,11 @@ public class NotificationsDb {
private boolean notificationExists(Notification notification, List<Notification> existing, boolean mindHigherLevel) {
// Be conservative for now, only dispatch notifications if they are from new source or with new type.
// the message content and level is ignored for now
- return existing.stream().anyMatch(e ->
- notification.source().contains(e.source()) && notification.type().equals(e.type()) &&
+ boolean exists = existing.stream()
+ .anyMatch(e -> notification.source().contains(e.source()) && notification.type().equals(e.type()) &&
(!mindHigherLevel || notification.level().ordinal() <= e.level().ordinal()));
+ log.fine(() -> "%s in %s == %b".formatted(notification, existing, exists));
+ return exists;
}
private static Optional<Notification> createFeedBlockNotification(NotificationSource source, Instant at, ClusterMetrics metric) {
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/Notifier.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/Notifier.java
index 4d8906f6fe5..afb260bf765 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/Notifier.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/Notifier.java
@@ -8,7 +8,6 @@ import com.yahoo.restapi.UriBuilder;
import com.yahoo.text.Text;
import com.yahoo.vespa.flags.FetchVector;
import com.yahoo.vespa.flags.FlagSource;
-import com.yahoo.vespa.flags.Flags;
import com.yahoo.vespa.flags.PermanentFlags;
import com.yahoo.vespa.hosted.controller.api.integration.organization.Mail;
import com.yahoo.vespa.hosted.controller.api.integration.organization.Mailer;
@@ -99,6 +98,8 @@ public class Notifier {
private void dispatch(Notification notification, Collection<TenantContacts.EmailContact> contacts) {
try {
+ log.fine(() -> "Sending notification " + notification + " to " +
+ contacts.stream().map(c -> c.email().getEmailAddress()).toList());
var content = formatter.format(notification);
mailer.send(mailOf(content, contacts.stream()
.filter(c -> c.email().isVerified())