Skip to content
Snippets Groups Projects
Commit ab3b3d3c authored by Riabokon Stanislav(EPAM)[GCP]'s avatar Riabokon Stanislav(EPAM)[GCP]
Browse files

Merge branch 'gcp-level-logs' into 'master'

Optimize infrastructure cost (GONRG-5736)

See merge request !264
parents ce12f7d4 c7b73409
No related branches found
No related tags found
1 merge request!264Optimize infrastructure cost (GONRG-5736)
Pipeline #137376 failed
...@@ -77,28 +77,28 @@ public class OqmSubscriberManager { ...@@ -77,28 +77,28 @@ public class OqmSubscriberManager {
@PostConstruct @PostConstruct
void postConstruct() { void postConstruct() {
log.info("OqmSubscriberManager bean constructed. Provisioning STARTED"); log.debug("OqmSubscriberManager bean constructed. Provisioning STARTED.");
provisionSubscribersOnAllInterestedTopicsSubscriptionsForAllTenantsBrokers(); provisionSubscribersOnAllInterestedTopicsSubscriptionsForAllTenantsBrokers();
provisionControlTopicsWithSubscriptionsAndSubscribersForAllTenantsBrokers(); provisionControlTopicsWithSubscriptionsAndSubscribersForAllTenantsBrokers();
log.info("OqmSubscriberManager bean constructed. Provisioning COMPLETED"); log.debug("OqmSubscriberManager bean constructed. Provisioning COMPLETED.");
} }
@PreDestroy @PreDestroy
void onPreDestroy() { void onPreDestroy() {
log.info("OqmSubscriberManager bean on pre-destroy: STARTED"); log.debug("OqmSubscriberManager bean on pre-destroy: STARTED.");
unprovisionControlTopicsSubscriptionsFromAllTenantsBrokers(); unprovisionControlTopicsSubscriptionsFromAllTenantsBrokers();
log.info("OqmSubscriberManager bean on pre-destroy: COMPLETED"); log.debug("OqmSubscriberManager bean on pre-destroy: COMPLETED.");
} }
void unprovisionControlTopicsSubscriptionsFromAllTenantsBrokers() { void unprovisionControlTopicsSubscriptionsFromAllTenantsBrokers() {
for (TenantInfo tenant : tenantInfoFactory.listTenantInfo()) { for (TenantInfo tenant : tenantInfoFactory.listTenantInfo()) {
String tenantId = tenant.getDataPartitionId(); 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); OqmSubscription subscriberControlTopicSubscriptionForTenant = driver.getSubscription(subscriberControlTopicSubscriptionName, getDestination(tenant)).orElse(null);
if (subscriberControlTopicSubscriptionForTenant != 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); properties.getRegisterSubscriberControlTopicName(), subscriberControlTopicSubscriptionName, tenantId);
driver.deleteSubscription(subscriberControlTopicSubscriptionName, getDestination(tenant)); driver.deleteSubscription(subscriberControlTopicSubscriptionName, getDestination(tenant));
} }
...@@ -107,17 +107,17 @@ public class OqmSubscriberManager { ...@@ -107,17 +107,17 @@ public class OqmSubscriberManager {
void provisionSubscribersOnAllInterestedTopicsSubscriptionsForAllTenantsBrokers() { void provisionSubscribersOnAllInterestedTopicsSubscriptionsForAllTenantsBrokers() {
for (TenantInfo tenantInfo : tenantInfoFactory.listTenantInfo()) { 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 every Tenant Destination get "subscriberable" Subscriptions
for (OqmSubscription subscription : getSubscriberableSubscriptions(tenantInfo)) { 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 //Register a Subscriber on every subscription
registerSubscriber(tenantInfo, 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 { ...@@ -127,19 +127,19 @@ public class OqmSubscriberManager {
String tenantId = tenant.getDataPartitionId(); 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); OqmTopic subscriberControlTopic = driver.getTopic(controlTopicName, getDestination(tenant)).orElse(null);
boolean controlTopicForTenantJustCreated; boolean controlTopicForTenantJustCreated;
if (subscriberControlTopic != null) { 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; controlTopicForTenantJustCreated = false;
} else { } 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)); driver.createAndGetTopic(controlTopicName, getDestination(tenant));
controlTopicForTenantJustCreated = true; 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); controlTopicName, subscriberControlTopicSubscriptionName, tenantId);
OqmSubscription subscriberControlTopicSubscriptionForTenant = null; OqmSubscription subscriberControlTopicSubscriptionForTenant = null;
...@@ -151,15 +151,15 @@ public class OqmSubscriberManager { ...@@ -151,15 +151,15 @@ public class OqmSubscriberManager {
} }
if (subscriberControlTopicSubscriptionForTenant != null) { 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); controlTopicName, subscriberControlTopicSubscriptionName, tenantId);
} else { } else {
subscriberControlTopicSubscriptionForTenant = driver.createAndGetSubscription(subscriptionRequest, getDestination(tenant)); 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); controlTopicName, subscriberControlTopicSubscriptionName, tenantId);
registerControlTopicSubscriber(tenant, subscriberControlTopicSubscriptionForTenant); 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); controlTopicName, subscriberControlTopicSubscriptionName, tenantId);
} }
...@@ -199,7 +199,7 @@ public class OqmSubscriberManager { ...@@ -199,7 +199,7 @@ public class OqmSubscriberManager {
OqmSubscriber subscriber = OqmSubscriber.builder().subscription(subscription).messageReceiver(receiver).build(); OqmSubscriber subscriber = OqmSubscriber.builder().subscription(subscription).messageReceiver(receiver).build();
driver.subscribe(subscriber, destination); 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()); subscription.getTopics().get(0), subscription.getName(), tenantInfo.getDataPartitionId());
} }
...@@ -228,7 +228,7 @@ public class OqmSubscriberManager { ...@@ -228,7 +228,7 @@ public class OqmSubscriberManager {
OqmDestination destination = getDestination(tenantInfo); OqmDestination destination = getDestination(tenantInfo);
driver.subscribe(subscriber, destination); 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()); controlTopicSubscription.getTopics().get(0), controlTopicSubscription.getName(), tenantInfo.getDataPartitionId());
} }
......
...@@ -71,7 +71,7 @@ public class OqmNotificationHandler { ...@@ -71,7 +71,7 @@ public class OqmNotificationHandler {
.connectionTimeout(oqmConfigurationProperties.getWaitingTime()) .connectionTimeout(oqmConfigurationProperties.getWaitingTime())
.build(); .build();
HttpResponse response = httpClient.send(request); HttpResponse response = httpClient.send(request);
log.debug("Sending out notification to endpoint: " + endpoint); log.debug("Sending out notification to endpoint: {}.", endpoint);
return response; return response;
} }
} }
\ No newline at end of file
...@@ -60,7 +60,7 @@ public class GoogleServiceAccountValidatorImpl implements IServiceAccountValidat ...@@ -60,7 +60,7 @@ public class GoogleServiceAccountValidatorImpl implements IServiceAccountValidat
return false; return false;
} }
} catch (Exception e) { } catch (Exception e) {
this.log.error("Error when validating google id token", e); log.error("Error when validating google id token.", e);
return false; return false;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment