From c7b734093d377da84d90f7e4f1099a0c601b8785 Mon Sep 17 00:00:00 2001 From: "Riabokon Stanislav(EPAM)[GCP]" <stanislav_riabokon@epam.com> Date: Sun, 25 Sep 2022 10:47:38 +0000 Subject: [PATCH] Optimize infrastructure cost (GONRG-5736) --- .../gcp/pubsub/OqmSubscriberManager.java | 38 +++++++++---------- .../gcp/pubsub/di/OqmNotificationHandler.java | 2 +- .../GoogleServiceAccountValidatorImpl.java | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/OqmSubscriberManager.java b/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/OqmSubscriberManager.java index 1e1986573..71fcf8706 100644 --- a/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/OqmSubscriberManager.java +++ b/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/OqmSubscriberManager.java @@ -77,28 +77,28 @@ public class OqmSubscriberManager { @PostConstruct void postConstruct() { - log.info("OqmSubscriberManager bean constructed. Provisioning STARTED"); + log.debug("OqmSubscriberManager bean constructed. Provisioning STARTED."); provisionSubscribersOnAllInterestedTopicsSubscriptionsForAllTenantsBrokers(); provisionControlTopicsWithSubscriptionsAndSubscribersForAllTenantsBrokers(); - log.info("OqmSubscriberManager bean constructed. Provisioning COMPLETED"); + log.debug("OqmSubscriberManager bean constructed. Provisioning COMPLETED."); } @PreDestroy void onPreDestroy() { - log.info("OqmSubscriberManager bean on pre-destroy: STARTED"); + log.debug("OqmSubscriberManager bean on pre-destroy: STARTED."); unprovisionControlTopicsSubscriptionsFromAllTenantsBrokers(); - log.info("OqmSubscriberManager bean on pre-destroy: COMPLETED"); + log.debug("OqmSubscriberManager bean on pre-destroy: COMPLETED."); } void unprovisionControlTopicsSubscriptionsFromAllTenantsBrokers() { for (TenantInfo tenant : tenantInfoFactory.listTenantInfo()) { String tenantId = tenant.getDataPartitionId(); - log.info("* OqmSubscriberManager on pre-destroy for tenant {}:", tenantId); + log.debug("* OqmSubscriberManager on pre-destroy for tenant {}:", tenantId); OqmSubscription subscriberControlTopicSubscriptionForTenant = driver.getSubscription(subscriberControlTopicSubscriptionName, getDestination(tenant)).orElse(null); if (subscriberControlTopicSubscriptionForTenant != null) { - log.info("* * OqmSubscriberManager on delete '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscription DELETED.", + log.debug("* * OqmSubscriberManager on delete '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscription DELETED.", properties.getRegisterSubscriberControlTopicName(), subscriberControlTopicSubscriptionName, tenantId); driver.deleteSubscription(subscriberControlTopicSubscriptionName, getDestination(tenant)); } @@ -107,17 +107,17 @@ public class OqmSubscriberManager { void provisionSubscribersOnAllInterestedTopicsSubscriptionsForAllTenantsBrokers() { for (TenantInfo tenantInfo : tenantInfoFactory.listTenantInfo()) { - log.info("* OqmSubscriberManager on provisioning tenant {}:", tenantInfo.getDataPartitionId()); + log.debug("* OqmSubscriberManager on provisioning tenant {}:", tenantInfo.getDataPartitionId()); //For every Tenant Destination get "subscriberable" Subscriptions for (OqmSubscription subscription : getSubscriberableSubscriptions(tenantInfo)) { - log.info("* * OqmSubscriberManager on provisioning for tenant {}, subscription {}:", tenantInfo.getDataPartitionId(), subscription.getName()); + log.debug("* * OqmSubscriberManager on provisioning for tenant {}, subscription {}:", tenantInfo.getDataPartitionId(), subscription.getName()); //Register a Subscriber on every subscription registerSubscriber(tenantInfo, subscription); - log.info("* * OqmSubscriberManager on provisioning for tenant {}, subscription {}: Subscriber REGISTERED.", tenantInfo.getDataPartitionId(), subscription.getName()); + log.debug("* * OqmSubscriberManager on provisioning for tenant {}, subscription {}: Subscriber REGISTERED.", tenantInfo.getDataPartitionId(), subscription.getName()); } - log.info("* OqmSubscriberManager on provisioning tenant {}: COMPLETED.", tenantInfo.getDataPartitionId()); + log.debug("* OqmSubscriberManager on provisioning tenant {}: COMPLETED.", tenantInfo.getDataPartitionId()); } } @@ -127,19 +127,19 @@ public class OqmSubscriberManager { String tenantId = tenant.getDataPartitionId(); - log.info("* OqmSubscriberManager on check '{}' subscriber control topic existence at tenant's '{}' message broker", controlTopicName, tenantId); + log.debug("* OqmSubscriberManager on check '{}' subscriber control topic existence at tenant's '{}' message broker.", controlTopicName, tenantId); OqmTopic subscriberControlTopic = driver.getTopic(controlTopicName, getDestination(tenant)).orElse(null); boolean controlTopicForTenantJustCreated; if (subscriberControlTopic != null) { - log.info("* * OqmSubscriberManager: '{}' subscriber control topic exists at tenant's '{}' message broker", controlTopicName, tenantId); + log.debug("* * OqmSubscriberManager: '{}' subscriber control topic exists at tenant's '{}' message broker.", controlTopicName, tenantId); controlTopicForTenantJustCreated = false; } else { - log.info("* * OqmSubscriberManager: '{}' subscriber control topic doesn't exist at tenant's '{}' message broker. Trying to create it:", controlTopicName, tenantId); + log.debug("* * OqmSubscriberManager: '{}' subscriber control topic doesn't exist at tenant's '{}' message broker. Trying to create it:", controlTopicName, tenantId); driver.createAndGetTopic(controlTopicName, getDestination(tenant)); controlTopicForTenantJustCreated = true; } - log.info("* * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker", + log.debug("* * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker.", controlTopicName, subscriberControlTopicSubscriptionName, tenantId); OqmSubscription subscriberControlTopicSubscriptionForTenant = null; @@ -151,15 +151,15 @@ public class OqmSubscriberManager { } if (subscriberControlTopicSubscriptionForTenant != null) { - log.info("* * * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscription CREATED.", + log.debug("* * * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscription CREATED.", controlTopicName, subscriberControlTopicSubscriptionName, tenantId); } else { subscriberControlTopicSubscriptionForTenant = driver.createAndGetSubscription(subscriptionRequest, getDestination(tenant)); - log.info("* * * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscription already EXISTS.", + log.debug("* * * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscription already EXISTS.", controlTopicName, subscriberControlTopicSubscriptionName, tenantId); registerControlTopicSubscriber(tenant, subscriberControlTopicSubscriptionForTenant); - log.info("* * * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscriber REGISTERED.", + log.debug("* * * OqmSubscriberManager on registering '{}' subscriber control topic subscription with name '{}' at tenant's '{}' message broker: Subscriber REGISTERED.", controlTopicName, subscriberControlTopicSubscriptionName, tenantId); } @@ -199,7 +199,7 @@ public class OqmSubscriberManager { OqmSubscriber subscriber = OqmSubscriber.builder().subscription(subscription).messageReceiver(receiver).build(); driver.subscribe(subscriber, destination); - log.info("Just subscribed at topic {} subscription {} for tenant {}", + log.debug("Just subscribed at topic {} subscription {} for tenant {}.", subscription.getTopics().get(0), subscription.getName(), tenantInfo.getDataPartitionId()); } @@ -228,7 +228,7 @@ public class OqmSubscriberManager { OqmDestination destination = getDestination(tenantInfo); driver.subscribe(subscriber, destination); - log.info("Just subscribed at topic {} subscription {} for tenant {}", + log.debug("Just subscribed at topic {} subscription {} for tenant {}.", controlTopicSubscription.getTopics().get(0), controlTopicSubscription.getName(), tenantInfo.getDataPartitionId()); } diff --git a/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/di/OqmNotificationHandler.java b/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/di/OqmNotificationHandler.java index 8bcf81db0..4478ef8bf 100644 --- a/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/di/OqmNotificationHandler.java +++ b/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/pubsub/di/OqmNotificationHandler.java @@ -71,7 +71,7 @@ public class OqmNotificationHandler { .connectionTimeout(oqmConfigurationProperties.getWaitingTime()) .build(); HttpResponse response = httpClient.send(request); - log.debug("Sending out notification to endpoint: " + endpoint); + log.debug("Sending out notification to endpoint: {}.", endpoint); return response; } } \ No newline at end of file diff --git a/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/util/GoogleServiceAccountValidatorImpl.java b/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/util/GoogleServiceAccountValidatorImpl.java index ffeacb562..05a7475a1 100644 --- a/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/util/GoogleServiceAccountValidatorImpl.java +++ b/provider/notification-gcp/src/main/java/org/opengroup/osdu/notification/provider/gcp/util/GoogleServiceAccountValidatorImpl.java @@ -60,7 +60,7 @@ public class GoogleServiceAccountValidatorImpl implements IServiceAccountValidat return false; } } catch (Exception e) { - this.log.error("Error when validating google id token", e); + log.error("Error when validating google id token.", e); return false; } } -- GitLab