Rename fields in EppMetrics and EntityIntegrityAlertsSchema

This is one of a series of CLs which will refactor EppMetrics into a value type
and Metrics into a stateless class which will have an export(EppMetrics requestDetails)
method to export EPP metrics in a stateless way. Once EppMetrics is a value
type, I will create a new StackdriverEppMetrics that will also accept the value
type via an incrementRequests(EppMetrics requestDetails), allowing us to
monitor EPP via BigQuery and Stackdriver with minimum code duplication.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=131711810
This commit is contained in:
shikhman 2016-08-30 08:20:26 -07:00 committed by Ben McIlwain
parent 59ac00478e
commit c309560892
3 changed files with 12 additions and 14 deletions

View file

@ -30,7 +30,7 @@ final class EntityIntegrityAlertsSchema {
static final String FIELD_TARGET = "target";
static final String FIELD_MESSAGE = "message";
static final ImmutableList<TableFieldSchema> ENTITY_INTEGRITY_ALERTS_SCHEMA_FIELDS =
static final ImmutableList<TableFieldSchema> SCHEMA_FIELDS =
ImmutableList.of(
new TableFieldSchema().setName(FIELD_SCANTIME).setType(TIMESTAMP.name()),
new TableFieldSchema().setName(FIELD_SOURCE).setType(STRING.name()),

View file

@ -29,9 +29,9 @@ public class EppMetrics extends Metrics {
private static final String REQUEST_LOG_ID = "com.google.appengine.runtime.request_log_id";
static final String EPPMETRICS_TABLE_ID = "eppMetrics";
static final String TABLE_ID = "eppMetrics";
static final ImmutableList<TableFieldSchema> EPPMETRICS_SCHEMA_FIELDS =
static final ImmutableList<TableFieldSchema> SCHEMA_FIELDS =
ImmutableList.of(
new TableFieldSchema().setName("requestId").setType(FieldType.STRING.name()),
new TableFieldSchema().setName("startTime").setType(FieldType.TIMESTAMP.name()),
@ -45,7 +45,7 @@ public class EppMetrics extends Metrics {
@Inject
public EppMetrics() {
setTableId(EPPMETRICS_TABLE_ID);
setTableId(TABLE_ID);
fields.put("attempts", 0);
fields.put("requestId", getCurrentEnvironment().getAttributes().get(REQUEST_LOG_ID).toString());
}

View file

@ -14,10 +14,6 @@
package google.registry.monitoring.whitebox;
import static google.registry.monitoring.whitebox.EntityIntegrityAlertsSchema.ENTITY_INTEGRITY_ALERTS_SCHEMA_FIELDS;
import static google.registry.monitoring.whitebox.EntityIntegrityAlertsSchema.TABLE_ID;
import static google.registry.monitoring.whitebox.EppMetrics.EPPMETRICS_SCHEMA_FIELDS;
import static google.registry.monitoring.whitebox.EppMetrics.EPPMETRICS_TABLE_ID;
import static google.registry.request.RequestParameters.extractRequiredParameter;
import com.google.api.services.bigquery.model.TableFieldSchema;
@ -37,16 +33,18 @@ import javax.servlet.http.HttpServletRequest;
@Module
public class WhiteboxModule {
@Provides @IntoMap
@StringKey(EPPMETRICS_TABLE_ID)
@Provides
@IntoMap
@StringKey(EppMetrics.TABLE_ID)
static ImmutableList<TableFieldSchema> provideEppMetricsSchema() {
return EPPMETRICS_SCHEMA_FIELDS;
return EppMetrics.SCHEMA_FIELDS;
}
@Provides @IntoMap
@StringKey(TABLE_ID)
@Provides
@IntoMap
@StringKey(EntityIntegrityAlertsSchema.TABLE_ID)
static ImmutableList<TableFieldSchema> provideEntityIntegrityAlertsSchema() {
return ENTITY_INTEGRITY_ALERTS_SCHEMA_FIELDS;
return EntityIntegrityAlertsSchema.SCHEMA_FIELDS;
}
@Provides