mirror of
https://github.com/google/nomulus.git
synced 2025-07-01 08:43:34 +02:00
Migrate to Flogger (green)
This is a 'green' Flogger migration CL. Green CLs are intended to be as safe as possible and should be easy to review and submit. No changes should be necessary to the code itself prior to submission, but small changes to BUILD files may be required. Changes within files are completely independent of each other, so this CL can be safely split up for review using tools such as Rosie. For more information, see [] Base CL: 197826149 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=198560170
This commit is contained in:
parent
0d2fb3a8f0
commit
70b13596e4
178 changed files with 984 additions and 988 deletions
|
@ -20,7 +20,6 @@ java_library(
|
|||
),
|
||||
deps = [
|
||||
":constants",
|
||||
"//java/com/google/common/logging:formatting_logger",
|
||||
"//java/google/registry/config",
|
||||
"//java/google/registry/dns/writer",
|
||||
"//java/google/registry/model",
|
||||
|
@ -33,6 +32,8 @@ java_library(
|
|||
"@com_google_auto_value",
|
||||
"@com_google_code_findbugs_jsr305",
|
||||
"@com_google_dagger",
|
||||
"@com_google_flogger",
|
||||
"@com_google_flogger_system_backend",
|
||||
"@com_google_guava",
|
||||
"@com_google_monitoring_client_metrics",
|
||||
"@javax_servlet_api",
|
||||
|
|
|
@ -34,7 +34,7 @@ import com.google.appengine.api.taskqueue.TransientFailureException;
|
|||
import com.google.apphosting.api.DeadlineExceededException;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.logging.FormattingLogger;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import com.google.common.util.concurrent.RateLimiter;
|
||||
import google.registry.dns.DnsConstants.TargetType;
|
||||
|
@ -65,7 +65,7 @@ import org.joda.time.Duration;
|
|||
*/
|
||||
public class DnsQueue {
|
||||
|
||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
private final Queue queue;
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class DnsQueue {
|
|||
* Enqueues the given task type with the given target name to the DNS queue.
|
||||
*/
|
||||
private TaskHandle addToQueue(TargetType targetType, String targetName, String tld) {
|
||||
logger.infofmt(
|
||||
logger.atInfo().log(
|
||||
"Adding task type=%s, target=%s, tld=%s to pull queue %s (%d tasks currently on queue)",
|
||||
targetType, targetName, tld, DNS_PULL_QUEUE_NAME, queue.fetchStatistics().getNumTasks());
|
||||
return queue.add(
|
||||
|
@ -159,14 +159,11 @@ public class DnsQueue {
|
|||
try {
|
||||
rateLimiter.acquire();
|
||||
int numTasks = queue.fetchStatistics().getNumTasks();
|
||||
logger.logfmt(
|
||||
(numTasks >= leaseTasksBatchSize) ? Level.WARNING : Level.INFO,
|
||||
"There are %d tasks in the DNS queue '%s'.",
|
||||
numTasks,
|
||||
DNS_PULL_QUEUE_NAME);
|
||||
logger.at((numTasks >= leaseTasksBatchSize) ? Level.WARNING : Level.INFO).log(
|
||||
"There are %d tasks in the DNS queue '%s'.", numTasks, DNS_PULL_QUEUE_NAME);
|
||||
return queue.leaseTasks(leaseDuration.getMillis(), MILLISECONDS, leaseTasksBatchSize);
|
||||
} catch (TransientFailureException | DeadlineExceededException e) {
|
||||
logger.severe(e, "Failed leasing tasks too fast");
|
||||
logger.atSevere().withCause(e).log("Failed leasing tasks too fast");
|
||||
return ImmutableList.of();
|
||||
}
|
||||
}
|
||||
|
@ -176,7 +173,7 @@ public class DnsQueue {
|
|||
try {
|
||||
queue.deleteTask(tasks);
|
||||
} catch (TransientFailureException | DeadlineExceededException e) {
|
||||
logger.severe(e, "Failed deleting tasks too fast");
|
||||
logger.atSevere().withCause(e).log("Failed deleting tasks too fast");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,10 +15,9 @@
|
|||
package google.registry.dns;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.logging.FormattingLogger.getLoggerForCallerClass;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.logging.FormattingLogger;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import google.registry.dns.writer.DnsWriter;
|
||||
import google.registry.model.registry.Registry;
|
||||
import java.util.Map;
|
||||
|
@ -27,7 +26,7 @@ import javax.inject.Inject;
|
|||
/** Proxy for retrieving {@link DnsWriter} implementations. */
|
||||
public final class DnsWriterProxy {
|
||||
|
||||
private static final FormattingLogger logger = getLoggerForCallerClass();
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
private final ImmutableMap<String, DnsWriter> dnsWriters;
|
||||
|
||||
|
@ -43,9 +42,8 @@ public final class DnsWriterProxy {
|
|||
*/
|
||||
public DnsWriter getByClassNameForTld(String className, String tld) {
|
||||
if (!Registry.get(tld).getDnsWriters().contains(className)) {
|
||||
logger.warningfmt(
|
||||
"Loaded potentially stale DNS writer %s which is not active on TLD %s.",
|
||||
className, tld);
|
||||
logger.atWarning().log(
|
||||
"Loaded potentially stale DNS writer %s which is not active on TLD %s.", className, tld);
|
||||
return null;
|
||||
}
|
||||
DnsWriter dnsWriter = dnsWriters.get(className);
|
||||
|
|
|
@ -18,7 +18,7 @@ import static google.registry.request.Action.Method.POST;
|
|||
import static google.registry.request.RequestParameters.PARAM_TLD;
|
||||
import static google.registry.util.CollectionUtils.nullToEmpty;
|
||||
|
||||
import com.google.common.logging.FormattingLogger;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.dns.DnsMetrics.ActionStatus;
|
||||
|
@ -58,7 +58,7 @@ public final class PublishDnsUpdatesAction implements Runnable, Callable<Void> {
|
|||
public static final String PARAM_REFRESH_REQUEST_CREATED = "itemsCreated";
|
||||
public static final String LOCK_NAME = "DNS updates";
|
||||
|
||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
@Inject DnsQueue dnsQueue;
|
||||
@Inject DnsWriterProxy dnsWriterProxy;
|
||||
|
@ -101,9 +101,9 @@ public final class PublishDnsUpdatesAction implements Runnable, Callable<Void> {
|
|||
nullToEmpty(domains).size() + nullToEmpty(hosts).size(),
|
||||
new Duration(itemsCreateTime, now),
|
||||
new Duration(enqueuedTime, now));
|
||||
logger.infofmt(
|
||||
logger.atInfo().log(
|
||||
"publishDnsWriter latency statistics: TLD: %s, dnsWriter: %s, actionStatus: %s, "
|
||||
+ "numItems: %s, timeSinceCreation: %s, timeInQueue: %s",
|
||||
+ "numItems: %d, timeSinceCreation: %s, timeInQueue: %s",
|
||||
tld,
|
||||
dnsWriter,
|
||||
status,
|
||||
|
@ -143,7 +143,7 @@ public final class PublishDnsUpdatesAction implements Runnable, Callable<Void> {
|
|||
|
||||
/** Adds all the domains and hosts in the batch back to the queue to be processed later. */
|
||||
private void requeueBatch() {
|
||||
logger.infofmt("Requeueing batch for retry");
|
||||
logger.atInfo().log("Requeueing batch for retry");
|
||||
for (String domain : nullToEmpty(domains)) {
|
||||
dnsQueue.addDomainRefreshTask(domain);
|
||||
}
|
||||
|
@ -156,14 +156,14 @@ public final class PublishDnsUpdatesAction implements Runnable, Callable<Void> {
|
|||
private boolean validLockParams() {
|
||||
// LockIndex should always be within [1, numPublishLocks]
|
||||
if (lockIndex > numPublishLocks || lockIndex <= 0) {
|
||||
logger.severefmt(
|
||||
logger.atSevere().log(
|
||||
"Lock index should be within [1,%d], got %d instead", numPublishLocks, lockIndex);
|
||||
return false;
|
||||
}
|
||||
// Check if the Registry object's num locks has changed since this task was batched
|
||||
int registryNumPublishLocks = Registry.get(tld).getNumDnsPublishLocks();
|
||||
if (registryNumPublishLocks != numPublishLocks) {
|
||||
logger.warningfmt(
|
||||
logger.atWarning().log(
|
||||
"Registry numDnsPublishLocks %d out of sync with parameter %d",
|
||||
registryNumPublishLocks, numPublishLocks);
|
||||
return false;
|
||||
|
@ -178,7 +178,7 @@ public final class PublishDnsUpdatesAction implements Runnable, Callable<Void> {
|
|||
DnsWriter writer = dnsWriterProxy.getByClassNameForTld(dnsWriter, tld);
|
||||
|
||||
if (writer == null) {
|
||||
logger.warningfmt("Couldn't get writer %s for TLD %s", dnsWriter, tld);
|
||||
logger.atWarning().log("Couldn't get writer %s for TLD %s", dnsWriter, tld);
|
||||
recordActionResult(ActionStatus.BAD_WRITER);
|
||||
requeueBatch();
|
||||
return;
|
||||
|
@ -189,11 +189,11 @@ public final class PublishDnsUpdatesAction implements Runnable, Callable<Void> {
|
|||
for (String domain : nullToEmpty(domains)) {
|
||||
if (!DomainNameUtils.isUnder(
|
||||
InternetDomainName.from(domain), InternetDomainName.from(tld))) {
|
||||
logger.severefmt("%s: skipping domain %s not under tld", tld, domain);
|
||||
logger.atSevere().log("%s: skipping domain %s not under tld", tld, domain);
|
||||
domainsRejected += 1;
|
||||
} else {
|
||||
writer.publishDomain(domain);
|
||||
logger.infofmt("%s: published domain %s", tld, domain);
|
||||
logger.atInfo().log("%s: published domain %s", tld, domain);
|
||||
domainsPublished += 1;
|
||||
}
|
||||
}
|
||||
|
@ -205,11 +205,11 @@ public final class PublishDnsUpdatesAction implements Runnable, Callable<Void> {
|
|||
for (String host : nullToEmpty(hosts)) {
|
||||
if (!DomainNameUtils.isUnder(
|
||||
InternetDomainName.from(host), InternetDomainName.from(tld))) {
|
||||
logger.severefmt("%s: skipping host %s not under tld", tld, host);
|
||||
logger.atSevere().log("%s: skipping host %s not under tld", tld, host);
|
||||
hostsRejected += 1;
|
||||
} else {
|
||||
writer.publishHost(host);
|
||||
logger.infofmt("%s: published host %s", tld, host);
|
||||
logger.atInfo().log("%s: published host %s", tld, host);
|
||||
hostsPublished += 1;
|
||||
}
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ public final class PublishDnsUpdatesAction implements Runnable, Callable<Void> {
|
|||
duration,
|
||||
domainsPublished,
|
||||
hostsPublished);
|
||||
logger.infofmt(
|
||||
logger.atInfo().log(
|
||||
"writer.commit() statistics: TLD: %s, dnsWriter: %s, commitStatus: %s, duration: %s, "
|
||||
+ "domainsPublished: %d, domainsRejected: %d, hostsPublished: %d, hostsRejected: %d",
|
||||
tld,
|
||||
|
|
|
@ -35,9 +35,9 @@ import com.google.common.collect.ImmutableSet;
|
|||
import com.google.common.collect.ImmutableSetMultimap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Ordering;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.common.hash.HashFunction;
|
||||
import com.google.common.hash.Hashing;
|
||||
import com.google.common.logging.FormattingLogger;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.dns.DnsConstants.TargetType;
|
||||
import google.registry.model.registry.Registries;
|
||||
|
@ -78,7 +78,7 @@ public final class ReadDnsQueueAction implements Runnable {
|
|||
|
||||
private static final String PARAM_JITTER_SECONDS = "jitterSeconds";
|
||||
private static final Random random = new Random();
|
||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
/**
|
||||
* Buffer time since the end of this action until retriable tasks are available again.
|
||||
|
@ -134,7 +134,7 @@ public final class ReadDnsQueueAction implements Runnable {
|
|||
ImmutableSet<String> tlds = Registries.getTlds();
|
||||
while (requestedEndTime.isAfterNow()) {
|
||||
List<TaskHandle> tasks = dnsQueue.leaseTasks(requestedMaximumDuration.plus(LEASE_PADDING));
|
||||
logger.infofmt("Leased %d DNS update tasks.", tasks.size());
|
||||
logger.atInfo().log("Leased %d DNS update tasks.", tasks.size());
|
||||
if (!tasks.isEmpty()) {
|
||||
dispatchTasks(ImmutableSet.copyOf(tasks), tlds);
|
||||
}
|
||||
|
@ -220,15 +220,16 @@ public final class ReadDnsQueueAction implements Runnable {
|
|||
private void dispatchTasks(ImmutableSet<TaskHandle> tasks, ImmutableSet<String> tlds) {
|
||||
ClassifiedTasks classifiedTasks = classifyTasks(tasks, tlds);
|
||||
if (!classifiedTasks.pausedTlds().isEmpty()) {
|
||||
logger.infofmt("The dns-pull queue is paused for TLDs: %s.", classifiedTasks.pausedTlds());
|
||||
logger.atInfo().log(
|
||||
"The dns-pull queue is paused for TLDs: %s.", classifiedTasks.pausedTlds());
|
||||
}
|
||||
if (!classifiedTasks.unknownTlds().isEmpty()) {
|
||||
logger.warningfmt(
|
||||
logger.atWarning().log(
|
||||
"The dns-pull queue has unknown TLDs: %s.", classifiedTasks.unknownTlds());
|
||||
}
|
||||
bucketRefreshItems(classifiedTasks.refreshItemsByTld());
|
||||
if (!classifiedTasks.tasksToKeep().isEmpty()) {
|
||||
logger.warningfmt(
|
||||
logger.atWarning().log(
|
||||
"Keeping %d DNS update tasks in the queue.", classifiedTasks.tasksToKeep().size());
|
||||
}
|
||||
// Delete the tasks we don't want to see again from the queue.
|
||||
|
@ -243,9 +244,9 @@ public final class ReadDnsQueueAction implements Runnable {
|
|||
// tasks again.
|
||||
ImmutableSet<TaskHandle> tasksToDelete =
|
||||
difference(tasks, classifiedTasks.tasksToKeep()).immutableCopy();
|
||||
logger.infofmt("Removing %d DNS update tasks from the queue.", tasksToDelete.size());
|
||||
logger.atInfo().log("Removing %d DNS update tasks from the queue.", tasksToDelete.size());
|
||||
dnsQueue.deleteTasks(tasksToDelete.asList());
|
||||
logger.infofmt("Done processing DNS tasks.");
|
||||
logger.atInfo().log("Done processing DNS tasks.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -266,7 +267,8 @@ public final class ReadDnsQueueAction implements Runnable {
|
|||
DateTime creationTime = DateTime.parse(params.get(DNS_TARGET_CREATE_TIME_PARAM));
|
||||
String tld = params.get(RequestParameters.PARAM_TLD);
|
||||
if (tld == null) {
|
||||
logger.severefmt("Discarding invalid DNS refresh request %s; no TLD specified.", task);
|
||||
logger.atSevere().log(
|
||||
"Discarding invalid DNS refresh request %s; no TLD specified.", task);
|
||||
} else if (!tlds.contains(tld)) {
|
||||
classifiedTasksBuilder.tasksToKeepBuilder().add(task);
|
||||
classifiedTasksBuilder.unknownTldsBuilder().add(tld);
|
||||
|
@ -285,12 +287,13 @@ public final class ReadDnsQueueAction implements Runnable {
|
|||
.put(tld, RefreshItem.create(type, name, creationTime));
|
||||
break;
|
||||
default:
|
||||
logger.severefmt("Discarding DNS refresh request %s of type %s.", task, typeString);
|
||||
logger.atSevere().log(
|
||||
"Discarding DNS refresh request %s of type %s.", task, typeString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (RuntimeException | UnsupportedEncodingException e) {
|
||||
logger.severefmt(e, "Discarding invalid DNS refresh request %s.", task);
|
||||
logger.atSevere().withCause(e).log("Discarding invalid DNS refresh request %s.", task);
|
||||
}
|
||||
}
|
||||
return classifiedTasksBuilder.build();
|
||||
|
|
|
@ -8,8 +8,9 @@ java_library(
|
|||
name = "writer",
|
||||
srcs = glob(["*.java"]),
|
||||
deps = [
|
||||
"//java/com/google/common/logging:formatting_logger",
|
||||
"@com_google_dagger",
|
||||
"@com_google_flogger",
|
||||
"@com_google_flogger_system_backend",
|
||||
"@com_google_guava",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
package google.registry.dns.writer;
|
||||
|
||||
import com.google.common.logging.FormattingLogger;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
|
@ -32,7 +32,7 @@ public final class VoidDnsWriter extends BaseDnsWriter {
|
|||
*/
|
||||
public static final String NAME = "VoidDnsWriter";
|
||||
|
||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
private final Set<String> names = new HashSet<>();
|
||||
|
||||
|
@ -51,7 +51,7 @@ public final class VoidDnsWriter extends BaseDnsWriter {
|
|||
|
||||
@Override
|
||||
protected void commitUnchecked() {
|
||||
logger.warningfmt(
|
||||
logger.atWarning().log(
|
||||
"No DnsWriterFactory implementation specified; ignoring names to commit: %s", names);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ java_library(
|
|||
name = "clouddns",
|
||||
srcs = glob(["*.java"]),
|
||||
deps = [
|
||||
"//java/com/google/common/logging:formatting_logger",
|
||||
"//java/google/registry/config",
|
||||
"//java/google/registry/dns/writer",
|
||||
"//java/google/registry/model",
|
||||
|
@ -16,6 +15,8 @@ java_library(
|
|||
"@com_google_api_client",
|
||||
"@com_google_apis_google_api_services_dns",
|
||||
"@com_google_dagger",
|
||||
"@com_google_flogger",
|
||||
"@com_google_flogger_system_backend",
|
||||
"@com_google_guava",
|
||||
"@com_google_http_client",
|
||||
"@joda_time",
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.logging.FormattingLogger;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import com.google.common.util.concurrent.RateLimiter;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
|
@ -72,7 +72,7 @@ public class CloudDnsWriter extends BaseDnsWriter {
|
|||
*/
|
||||
public static final String NAME = "CloudDnsWriter";
|
||||
|
||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
private static final ImmutableSet<String> RETRYABLE_EXCEPTION_REASONS =
|
||||
ImmutableSet.of("preconditionFailed", "notFound", "alreadyExists");
|
||||
|
||||
|
@ -179,12 +179,12 @@ public class CloudDnsWriter extends BaseDnsWriter {
|
|||
}
|
||||
|
||||
desiredRecords.put(absoluteDomainName, domainRecords.build());
|
||||
logger.finefmt(
|
||||
"Will write %s records for domain %s", domainRecords.build().size(), absoluteDomainName);
|
||||
logger.atFine().log(
|
||||
"Will write %d records for domain %s", domainRecords.build().size(), absoluteDomainName);
|
||||
}
|
||||
|
||||
private void publishSubordinateHost(String hostName) {
|
||||
logger.infofmt("Publishing glue records for %s", hostName);
|
||||
logger.atInfo().log("Publishing glue records for %s", hostName);
|
||||
// Canonicalize name
|
||||
String absoluteHostName = getAbsoluteHostName(hostName);
|
||||
|
||||
|
@ -251,7 +251,7 @@ public class CloudDnsWriter extends BaseDnsWriter {
|
|||
|
||||
// Host not managed by our registry, no need to update DNS.
|
||||
if (!tld.isPresent()) {
|
||||
logger.severefmt("publishHost called for invalid host %s", hostName);
|
||||
logger.atSevere().log("publishHost called for invalid host %s", hostName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ public class CloudDnsWriter extends BaseDnsWriter {
|
|||
ImmutableMap<String, ImmutableSet<ResourceRecordSet>> desiredRecordsCopy =
|
||||
ImmutableMap.copyOf(desiredRecords);
|
||||
retrier.callWithRetry(() -> mutateZone(desiredRecordsCopy), ZoneStateException.class);
|
||||
logger.info("Wrote to Cloud DNS");
|
||||
logger.atInfo().log("Wrote to Cloud DNS");
|
||||
}
|
||||
|
||||
/** Returns the glue records for in-bailiwick nameservers for the given domain+records. */
|
||||
|
@ -324,7 +324,7 @@ public class CloudDnsWriter extends BaseDnsWriter {
|
|||
*/
|
||||
private Map<String, List<ResourceRecordSet>> getResourceRecordsForDomains(
|
||||
Set<String> domainNames) {
|
||||
logger.finefmt("Fetching records for %s", domainNames);
|
||||
logger.atFine().log("Fetching records for %s", domainNames);
|
||||
// As per Concurrent.transform() - if numThreads or domainNames.size() < 2, it will not use
|
||||
// threading.
|
||||
return ImmutableMap.copyOf(
|
||||
|
@ -373,12 +373,12 @@ public class CloudDnsWriter extends BaseDnsWriter {
|
|||
// the result.
|
||||
ImmutableSet<ResourceRecordSet> intersection =
|
||||
Sets.intersection(additions, deletions).immutableCopy();
|
||||
logger.infofmt(
|
||||
"There are %s common items out of the %s items in 'additions' and %s items in 'deletions'",
|
||||
logger.atInfo().log(
|
||||
"There are %d common items out of the %d items in 'additions' and %d items in 'deletions'",
|
||||
intersection.size(), additions.size(), deletions.size());
|
||||
// Exit early if we have nothing to update - dnsConnection doesn't work on empty changes
|
||||
if (additions.equals(deletions)) {
|
||||
logger.infofmt("Returning early because additions is the same as deletions");
|
||||
logger.atInfo().log("Returning early because additions is the same as deletions");
|
||||
return;
|
||||
}
|
||||
Change change =
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.google.common.collect.ImmutableList;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.logging.FormattingLogger;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.google.common.net.InternetDomainName;
|
||||
import com.google.common.util.concurrent.RateLimiter;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
|
@ -91,7 +91,7 @@ public class MultiplyingCloudDnsWriter extends BaseDnsWriter {
|
|||
*/
|
||||
public static final String NAME = "MultiplyingCloudDnsWriter";
|
||||
|
||||
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
private static final ImmutableSet<String> RETRYABLE_EXCEPTION_REASONS =
|
||||
ImmutableSet.of("preconditionFailed", "notFound", "alreadyExists");
|
||||
|
||||
|
@ -199,13 +199,13 @@ public class MultiplyingCloudDnsWriter extends BaseDnsWriter {
|
|||
}
|
||||
|
||||
desiredRecords.put(absoluteDomainName, domainRecords.build());
|
||||
logger.finefmt(
|
||||
"Will write %s records for domain %s", domainRecords.build().size(), absoluteDomainName);
|
||||
logger.atFine().log(
|
||||
"Will write %d records for domain %s", domainRecords.build().size(), absoluteDomainName);
|
||||
}
|
||||
}
|
||||
|
||||
private void publishSubordinateHost(String hostName) {
|
||||
logger.infofmt("Publishing glue records for %s", hostName);
|
||||
logger.atInfo().log("Publishing glue records for %s", hostName);
|
||||
// Canonicalize name
|
||||
String absoluteHostName = getAbsoluteHostName(hostName);
|
||||
|
||||
|
@ -272,7 +272,7 @@ public class MultiplyingCloudDnsWriter extends BaseDnsWriter {
|
|||
|
||||
// Host not managed by our registry, no need to update DNS.
|
||||
if (!tld.isPresent()) {
|
||||
logger.severefmt("publishHost called for invalid host %s", hostName);
|
||||
logger.atSevere().log("publishHost called for invalid host %s", hostName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ public class MultiplyingCloudDnsWriter extends BaseDnsWriter {
|
|||
ImmutableMap<String, ImmutableSet<ResourceRecordSet>> desiredRecordsCopy =
|
||||
ImmutableMap.copyOf(desiredRecords);
|
||||
retrier.callWithRetry(() -> mutateZone(desiredRecordsCopy), ZoneStateException.class);
|
||||
logger.info("Wrote to Cloud DNS");
|
||||
logger.atInfo().log("Wrote to Cloud DNS");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -357,7 +357,7 @@ public class MultiplyingCloudDnsWriter extends BaseDnsWriter {
|
|||
*/
|
||||
private Map<String, List<ResourceRecordSet>> getResourceRecordsForDomains(
|
||||
Set<String> domainNames) {
|
||||
logger.finefmt("Fetching records for %s", domainNames);
|
||||
logger.atFine().log("Fetching records for %s", domainNames);
|
||||
// As per Concurrent.transform() - if numThreads or domainNames.size() < 2, it will not use
|
||||
// threading.
|
||||
return ImmutableMap.copyOf(
|
||||
|
@ -406,12 +406,12 @@ public class MultiplyingCloudDnsWriter extends BaseDnsWriter {
|
|||
// the result.
|
||||
ImmutableSet<ResourceRecordSet> intersection =
|
||||
Sets.intersection(additions, deletions).immutableCopy();
|
||||
logger.infofmt(
|
||||
"There are %s common items out of the %s items in 'additions' and %s items in 'deletions'",
|
||||
logger.atInfo().log(
|
||||
"There are %d common items out of the %d items in 'additions' and %d items in 'deletions'",
|
||||
intersection.size(), additions.size(), deletions.size());
|
||||
// Exit early if we have nothing to update - dnsConnection doesn't work on empty changes
|
||||
if (additions.equals(deletions)) {
|
||||
logger.infofmt("Returning early because additions is the same as deletions");
|
||||
logger.atInfo().log("Returning early because additions is the same as deletions");
|
||||
return;
|
||||
}
|
||||
Change change =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue