mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Cleanup minor things in whitebox metrics code
Specifically: - remove @RequestScope from EppMetric since it's only for components - fix to call the better overload of toBigqueryTimestamp - use the same UUID provider for BigQueryMetricsEnqueuer that already exists for the VerifyEntityIntegrityStreamer - minor cleanup in VerifyEntityIntegrityStreamer (inject projectId vs whole env) ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=132721794
This commit is contained in:
parent
2537e95de5
commit
9dffd64dc7
6 changed files with 25 additions and 38 deletions
|
@ -20,11 +20,11 @@ import static com.google.appengine.api.taskqueue.TaskOptions.Builder.withUrl;
|
|||
import com.google.appengine.api.modules.ModulesService;
|
||||
import com.google.appengine.api.taskqueue.TaskOptions;
|
||||
import com.google.appengine.api.taskqueue.TransientFailureException;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.Supplier;
|
||||
import google.registry.util.FormattingLogger;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
/**
|
||||
* A collector of metric information. Enqueues collected metrics to a task queue to be written to
|
||||
|
@ -39,18 +39,17 @@ public class BigQueryMetricsEnqueuer {
|
|||
public static final String QUEUE = "bigquery-streaming-metrics";
|
||||
|
||||
@Inject ModulesService modulesService;
|
||||
@Inject @Named("insertIdGenerator") Supplier<String> idGenerator;
|
||||
|
||||
@Inject
|
||||
BigQueryMetricsEnqueuer() {}
|
||||
@Inject BigQueryMetricsEnqueuer() {}
|
||||
|
||||
@VisibleForTesting
|
||||
void export(BigQueryMetric metric, String insertId) {
|
||||
public void export(BigQueryMetric metric) {
|
||||
try {
|
||||
String hostname = modulesService.getVersionHostname("backend", null);
|
||||
TaskOptions opts =
|
||||
withUrl(MetricsExportAction.PATH)
|
||||
.header("Host", hostname)
|
||||
.param("insertId", insertId);
|
||||
.param("insertId", idGenerator.get());
|
||||
for (Entry<String, String> entry : metric.getBigQueryRowEncoding().entrySet()) {
|
||||
opts.param(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
@ -61,9 +60,4 @@ public class BigQueryMetricsEnqueuer {
|
|||
logger.info(e, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/** Enqueue a metric to be exported to BigQuery. */
|
||||
public void export(BigQueryMetric metric) {
|
||||
export(metric, UUID.randomUUID().toString());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue