diff --git a/java/com/google/gerrit/httpd/RequestMetrics.java b/java/com/google/gerrit/httpd/RequestMetrics.java index cab4a922a3..2e8e6e7f05 100644 --- a/java/com/google/gerrit/httpd/RequestMetrics.java +++ b/java/com/google/gerrit/httpd/RequestMetrics.java @@ -28,15 +28,18 @@ public class RequestMetrics { @Inject public RequestMetrics(MetricMaker metricMaker) { + Field statusCodeField = + Field.ofInteger("status").description("HTTP status code").build(); + errors = metricMaker.newCounter( "http/server/error_count", new Description("Rate of REST API error responses").setRate().setUnit("errors"), - Field.ofInteger("status", "HTTP status code")); + statusCodeField); successes = metricMaker.newCounter( "http/server/success_count", new Description("Rate of REST API success responses").setRate().setUnit("successes"), - Field.ofInteger("status", "HTTP status code")); + statusCodeField); } } diff --git a/java/com/google/gerrit/httpd/restapi/RestApiMetrics.java b/java/com/google/gerrit/httpd/restapi/RestApiMetrics.java index 562687b1d5..1c34f1db6a 100644 --- a/java/com/google/gerrit/httpd/restapi/RestApiMetrics.java +++ b/java/com/google/gerrit/httpd/restapi/RestApiMetrics.java @@ -41,19 +41,20 @@ public class RestApiMetrics { @Inject RestApiMetrics(MetricMaker metrics) { - Field view = Field.ofString("view", "view implementation class"); + Field viewField = + Field.ofString("view").description("view implementation class").build(); count = metrics.newCounter( "http/server/rest_api/count", new Description("REST API calls by view").setRate(), - view); + viewField); errorCount = metrics.newCounter( "http/server/rest_api/error_count", new Description("REST API errors by view").setRate(), - view, - Field.ofInteger("error_code", "HTTP status code")); + viewField, + Field.ofInteger("error_code").description("HTTP status code").build()); serverLatency = metrics.newTimer( @@ -61,7 +62,7 @@ public class RestApiMetrics { new Description("REST API call latency by view") .setCumulative() .setUnit(Units.MILLISECONDS), - view); + viewField); responseBytes = metrics.newHistogram( @@ -69,7 +70,7 @@ public class RestApiMetrics { new Description("Size of response on network (may be gzip compressed)") .setCumulative() .setUnit(Units.BYTES), - view); + viewField); } String view(ViewData viewData) { diff --git a/java/com/google/gerrit/index/query/QueryProcessor.java b/java/com/google/gerrit/index/query/QueryProcessor.java index 70772455f5..346a306fab 100644 --- a/java/com/google/gerrit/index/query/QueryProcessor.java +++ b/java/com/google/gerrit/index/query/QueryProcessor.java @@ -60,14 +60,13 @@ public abstract class QueryProcessor { final Timer1 executionTime; Metrics(MetricMaker metricMaker) { - Field index = Field.ofString("index", "index name"); executionTime = metricMaker.newTimer( "query/query_latency", new Description("Successful query latency, accumulated over the life of the process") .setCumulative() .setUnit(Description.Units.MILLISECONDS), - index); + Field.ofString("index").description("index name").build()); } } diff --git a/java/com/google/gerrit/metrics/BUILD b/java/com/google/gerrit/metrics/BUILD index 29b0a92205..68b29a4ea6 100644 --- a/java/com/google/gerrit/metrics/BUILD +++ b/java/com/google/gerrit/metrics/BUILD @@ -8,6 +8,8 @@ java_library( "//java/com/google/gerrit/lifecycle", "//java/com/google/gerrit/server/logging", "//lib:guava", + "//lib/auto:auto-value", + "//lib/auto:auto-value-annotations", "//lib/flogger:api", "//lib/guice", "//lib/jgit/org.eclipse.jgit:jgit", diff --git a/java/com/google/gerrit/metrics/Field.java b/java/com/google/gerrit/metrics/Field.java index b2acce7b0e..ad8eae9f99 100644 --- a/java/com/google/gerrit/metrics/Field.java +++ b/java/com/google/gerrit/metrics/Field.java @@ -16,6 +16,8 @@ package com.google.gerrit.metrics; import static com.google.common.base.Preconditions.checkArgument; +import com.google.auto.value.AutoValue; +import java.util.Optional; import java.util.function.Function; /** @@ -23,26 +25,19 @@ import java.util.function.Function; * * @param type of field */ -public class Field { +@AutoValue +public abstract class Field { /** * Break down metrics by boolean true/false. * * @param name field name - * @return boolean field + * @return builder for the boolean field */ - public static Field ofBoolean(String name) { - return ofBoolean(name, null); - } - - /** - * Break down metrics by boolean true/false. - * - * @param name field name - * @param description field description - * @return boolean field - */ - public static Field ofBoolean(String name, String description) { - return new Field<>(name, Boolean.class, description); + public static Field.Builder ofBoolean(String name) { + return new AutoValue_Field.Builder() + .valueType(Boolean.class) + .formatter(Object::toString) + .name(name); } /** @@ -50,50 +45,10 @@ public class Field { * * @param enumType type of enum * @param name field name - * @return enum field + * @return builder for the enum field */ - public static > Field ofEnum(Class enumType, String name) { - return ofEnum(enumType, name, null); - } - - /** - * Break down metrics by cases of an enum. - * - * @param enumType type of enum - * @param name field name - * @param description field description - * @return enum field - */ - public static > Field ofEnum( - Class enumType, String name, String description) { - return new Field<>(name, enumType, description); - } - - /** - * Break down metrics by string. - * - *

Each unique string will allocate a new submetric. Do not use user content as a field - * value as field values are never reclaimed. - * - * @param name field name - * @return string field - */ - public static Field ofString(String name) { - return ofString(name, null); - } - - /** - * Break down metrics by string. - * - *

Each unique string will allocate a new submetric. Do not use user content as a field - * value as field values are never reclaimed. - * - * @param name field name - * @param description field description - * @return string field - */ - public static Field ofString(String name, String description) { - return new Field<>(name, String.class, description); + public static > Field.Builder ofEnum(Class enumType, String name) { + return new AutoValue_Field.Builder().valueType(enumType).formatter(Enum::name).name(name); } /** @@ -103,66 +58,59 @@ public class Field { * value as field values are never reclaimed. * * @param name field name - * @return integer field + * @return builder for the integer field */ - public static Field ofInteger(String name) { - return ofInteger(name, null); + public static Field.Builder ofInteger(String name) { + return new AutoValue_Field.Builder() + .valueType(Integer.class) + .formatter(Object::toString) + .name(name); } /** - * Break down metrics by integer. + * Break down metrics by string. * - *

Each unique integer will allocate a new submetric. Do not use user content as a field + *

Each unique string will allocate a new submetric. Do not use user content as a field * value as field values are never reclaimed. * * @param name field name - * @param description field description - * @return integer field + * @return builder for the string field */ - public static Field ofInteger(String name, String description) { - return new Field<>(name, Integer.class, description); - } - - private final String name; - private final Class keyType; - private final Function formatter; - private final String description; - - private Field(String name, Class keyType, String description) { - checkArgument(name.matches("^[a-z_]+$"), "name must match [a-z_]"); - this.name = name; - this.keyType = keyType; - this.formatter = initFormatter(keyType); - this.description = description; + public static Field.Builder ofString(String name) { + return new AutoValue_Field.Builder() + .valueType(String.class) + .formatter(s -> s) + .name(name); } /** @return name of this field within the metric. */ - public String getName() { - return name; - } + public abstract String name(); /** @return type of value used within the field. */ - public Class getType() { - return keyType; - } + public abstract Class valueType(); /** @return description text for the field explaining its range of values. */ - public String getDescription() { - return description; - } + public abstract Optional description(); - public Function formatter() { - return formatter; - } + /** @return formatter to format field values. */ + public abstract Function formatter(); - private static Function initFormatter(Class keyType) { - if (keyType == String.class) { - return s -> (String) s; - } else if (keyType == Integer.class || keyType == Boolean.class) { - return Object::toString; - } else if (Enum.class.isAssignableFrom(keyType)) { - return in -> ((Enum) in).name(); + @AutoValue.Builder + public abstract static class Builder { + abstract Builder name(String name); + + abstract Builder valueType(Class type); + + abstract Builder formatter(Function formatter); + + public abstract Builder description(String description); + + abstract Field autoBuild(); + + public Field build() { + Field field = autoBuild(); + checkArgument(field.name().matches("^[a-z_]+$"), "name must match [a-z_]"); + return field; } - throw new IllegalStateException("unsupported type " + keyType.getName()); } } diff --git a/java/com/google/gerrit/metrics/dropwizard/MetricJson.java b/java/com/google/gerrit/metrics/dropwizard/MetricJson.java index c66e48d894..d59a1d93a1 100644 --- a/java/com/google/gerrit/metrics/dropwizard/MetricJson.java +++ b/java/com/google/gerrit/metrics/dropwizard/MetricJson.java @@ -189,10 +189,10 @@ class MetricJson { String description; FieldJson(Field field) { - this.name = field.getName(); - this.description = field.getDescription(); + this.name = field.name(); + this.description = field.description().orElse(null); this.type = - Enum.class.isAssignableFrom(field.getType()) ? field.getType().getSimpleName() : null; + Enum.class.isAssignableFrom(field.valueType()) ? field.valueType().getSimpleName() : null; } } } diff --git a/java/com/google/gerrit/metrics/proc/ProcMetricModule.java b/java/com/google/gerrit/metrics/proc/ProcMetricModule.java index 7b34f50aa3..55a9ec3226 100644 --- a/java/com/google/gerrit/metrics/proc/ProcMetricModule.java +++ b/java/com/google/gerrit/metrics/proc/ProcMetricModule.java @@ -148,12 +148,15 @@ public class ProcMetricModule extends MetricModule { } private void procJvmGc(MetricMaker metrics) { + Field gcNameField = + Field.ofString("gc_name").description("The name of the garbage collector").build(); + CallbackMetric1 gcCount = metrics.newCallbackMetric( "proc/jvm/gc/count", Long.class, new Description("Number of GCs").setCumulative(), - Field.ofString("gc_name", "The name of the garbage collector")); + gcNameField); CallbackMetric1 gcTime = metrics.newCallbackMetric( @@ -162,7 +165,7 @@ public class ProcMetricModule extends MetricModule { new Description("Approximate accumulated GC elapsed time") .setCumulative() .setUnit(Units.MILLISECONDS), - Field.ofString("gc_name", "The name of the garbage collector")); + gcNameField); metrics.newTrigger( gcCount, diff --git a/java/com/google/gerrit/server/cache/CacheMetrics.java b/java/com/google/gerrit/server/cache/CacheMetrics.java index f2dd00e82b..502dfa4e8d 100644 --- a/java/com/google/gerrit/server/cache/CacheMetrics.java +++ b/java/com/google/gerrit/server/cache/CacheMetrics.java @@ -33,7 +33,7 @@ import java.util.Set; public class CacheMetrics { @Inject public CacheMetrics(MetricMaker metrics, DynamicMap> cacheMap) { - Field F_NAME = Field.ofString("cache_name"); + Field F_NAME = Field.ofString("cache_name").build(); CallbackMetric1 memEnt = metrics.newCallbackMetric( diff --git a/java/com/google/gerrit/server/change/ChangeFinder.java b/java/com/google/gerrit/server/change/ChangeFinder.java index 0535a4e3b4..1cdb6213c0 100644 --- a/java/com/google/gerrit/server/change/ChangeFinder.java +++ b/java/com/google/gerrit/server/change/ChangeFinder.java @@ -98,7 +98,7 @@ public class ChangeFinder { new Description("Total number of API calls per identifier type.") .setRate() .setUnit("requests"), - Field.ofEnum(ChangeIdType.class, "change_id_type")); + Field.ofEnum(ChangeIdType.class, "change_id_type").build()); List configuredChangeIdTypes = ConfigUtil.getEnumList(config, "change", "api", "allowedIdentifier", ChangeIdType.ALL); // Ensure that PROJECT_NUMERIC_ID can't be removed diff --git a/java/com/google/gerrit/server/events/EventsMetrics.java b/java/com/google/gerrit/server/events/EventsMetrics.java index f73d6de081..ae70baba29 100644 --- a/java/com/google/gerrit/server/events/EventsMetrics.java +++ b/java/com/google/gerrit/server/events/EventsMetrics.java @@ -31,7 +31,7 @@ public class EventsMetrics implements EventListener { metricMaker.newCounter( "events", new Description("Triggered events").setRate().setUnit("triggered events"), - Field.ofString("type")); + Field.ofString("type").build()); } @Override diff --git a/java/com/google/gerrit/server/extensions/webui/UiActions.java b/java/com/google/gerrit/server/extensions/webui/UiActions.java index be64d54404..947bec1732 100644 --- a/java/com/google/gerrit/server/extensions/webui/UiActions.java +++ b/java/com/google/gerrit/server/extensions/webui/UiActions.java @@ -71,7 +71,7 @@ public class UiActions { new com.google.gerrit.metrics.Description("Latency for RestView#getDescription calls") .setCumulative() .setUnit(Units.MILLISECONDS), - Field.ofString("view")); + Field.ofString("view").build()); } public Iterable from( diff --git a/java/com/google/gerrit/server/git/UploadPackMetricsHook.java b/java/com/google/gerrit/server/git/UploadPackMetricsHook.java index aa02fba99a..8be68bf7dd 100644 --- a/java/com/google/gerrit/server/git/UploadPackMetricsHook.java +++ b/java/com/google/gerrit/server/git/UploadPackMetricsHook.java @@ -43,14 +43,14 @@ public class UploadPackMetricsHook implements PostUploadHook { @Inject UploadPackMetricsHook(MetricMaker metricMaker) { - Field operation = Field.ofEnum(Operation.class, "operation"); + Field operationField = Field.ofEnum(Operation.class, "operation").build(); requestCount = metricMaker.newCounter( "git/upload-pack/request_count", new Description("Total number of git-upload-pack requests") .setRate() .setUnit("requests"), - operation); + operationField); counting = metricMaker.newTimer( @@ -58,7 +58,7 @@ public class UploadPackMetricsHook implements PostUploadHook { new Description("Time spent in the 'Counting...' phase") .setCumulative() .setUnit(Units.MILLISECONDS), - operation); + operationField); compressing = metricMaker.newTimer( @@ -66,7 +66,7 @@ public class UploadPackMetricsHook implements PostUploadHook { new Description("Time spent in the 'Compressing...' phase") .setCumulative() .setUnit(Units.MILLISECONDS), - operation); + operationField); writing = metricMaker.newTimer( @@ -74,7 +74,7 @@ public class UploadPackMetricsHook implements PostUploadHook { new Description("Time spent transferring bytes to client") .setCumulative() .setUnit(Units.MILLISECONDS), - operation); + operationField); packBytes = metricMaker.newHistogram( @@ -82,7 +82,7 @@ public class UploadPackMetricsHook implements PostUploadHook { new Description("Distribution of sizes of packs sent to clients") .setCumulative() .setUnit(Units.BYTES), - operation); + operationField); } @Override diff --git a/java/com/google/gerrit/server/git/receive/AsyncReceiveCommits.java b/java/com/google/gerrit/server/git/receive/AsyncReceiveCommits.java index 19ad1320fc..64aecf5475 100644 --- a/java/com/google/gerrit/server/git/receive/AsyncReceiveCommits.java +++ b/java/com/google/gerrit/server/git/receive/AsyncReceiveCommits.java @@ -199,7 +199,14 @@ public class AsyncReceiveCommits implements PreReceiveHook { metricMaker.newHistogram( "receivecommits/changes_per_push", new Description("number of changes uploaded in a single push.").setCumulative(), - Field.ofEnum(PushType.class, "type", "type of push (create/replace, autoclose)")); + Field.ofEnum(PushType.class, "type") + .description("type of push (create/replace, autoclose)") + .build()); + + Field pushTypeField = + Field.ofEnum(PushType.class, "type") + .description("type of push (create/replace, autoclose, normal)") + .build(); latencyPerChange = metricMaker.newTimer( @@ -209,8 +216,7 @@ public class AsyncReceiveCommits implements PreReceiveHook { + "(Only includes pushes which contain changes.)") .setUnit(Units.MILLISECONDS) .setCumulative(), - Field.ofEnum( - PushType.class, "type", "type of push (create/replace, autoclose, normal)")); + pushTypeField); latencyPerPush = metricMaker.newTimer( @@ -218,8 +224,7 @@ public class AsyncReceiveCommits implements PreReceiveHook { new Description("processing delay for a processing single push") .setUnit(Units.MILLISECONDS) .setCumulative(), - Field.ofEnum( - PushType.class, "type", "type of push (create/replace, autoclose, normal)")); + pushTypeField); timeouts = metricMaker.newCounter( diff --git a/java/com/google/gerrit/server/notedb/NoteDbMetrics.java b/java/com/google/gerrit/server/notedb/NoteDbMetrics.java index 61f475f3a9..7df4c3df2c 100644 --- a/java/com/google/gerrit/server/notedb/NoteDbMetrics.java +++ b/java/com/google/gerrit/server/notedb/NoteDbMetrics.java @@ -45,7 +45,7 @@ class NoteDbMetrics { @Inject NoteDbMetrics(MetricMaker metrics) { - Field view = Field.ofEnum(NoteDbTable.class, "table"); + Field tableField = Field.ofEnum(NoteDbTable.class, "table").build(); updateLatency = metrics.newTimer( @@ -53,7 +53,7 @@ class NoteDbMetrics { new Description("NoteDb update latency by table") .setCumulative() .setUnit(Units.MILLISECONDS), - view); + tableField); stageUpdateLatency = metrics.newTimer( @@ -61,7 +61,7 @@ class NoteDbMetrics { new Description("Latency for staging updates to NoteDb by table") .setCumulative() .setUnit(Units.MICROSECONDS), - view); + tableField); readLatency = metrics.newTimer( @@ -69,7 +69,7 @@ class NoteDbMetrics { new Description("NoteDb read latency by table") .setCumulative() .setUnit(Units.MILLISECONDS), - view); + tableField); parseLatency = metrics.newTimer( @@ -77,6 +77,6 @@ class NoteDbMetrics { new Description("NoteDb parse latency by table") .setCumulative() .setUnit(Units.MICROSECONDS), - view); + tableField); } } diff --git a/java/com/google/gerrit/server/notedb/Sequences.java b/java/com/google/gerrit/server/notedb/Sequences.java index 9e8c5412cc..02cc2cd605 100644 --- a/java/com/google/gerrit/server/notedb/Sequences.java +++ b/java/com/google/gerrit/server/notedb/Sequences.java @@ -95,8 +95,8 @@ public class Sequences { new Description("Latency of requesting IDs from repo sequences") .setCumulative() .setUnit(Units.MILLISECONDS), - Field.ofEnum(SequenceType.class, "sequence"), - Field.ofBoolean("multiple")); + Field.ofEnum(SequenceType.class, "sequence").build(), + Field.ofBoolean("multiple").build()); } public int nextAccountId() { diff --git a/java/com/google/gerrit/server/plugincontext/PluginContext.java b/java/com/google/gerrit/server/plugincontext/PluginContext.java index 70b23e3b8b..a187d4c400 100644 --- a/java/com/google/gerrit/server/plugincontext/PluginContext.java +++ b/java/com/google/gerrit/server/plugincontext/PluginContext.java @@ -118,22 +118,26 @@ public class PluginContext { @Inject PluginMetrics(MetricMaker metricMaker) { + Field pluginNameField = Field.ofString("plugin_name").build(); + Field classNameField = Field.ofString("class_name").build(); + Field exportNameField = Field.ofString("export_name").build(); + this.latency = metricMaker.newTimer( "plugin/latency", new Description("Latency for plugin invocation") .setCumulative() .setUnit(Units.MILLISECONDS), - Field.ofString("plugin_name"), - Field.ofString("class_name"), - Field.ofString("export_name")); + pluginNameField, + classNameField, + exportNameField); this.errorCount = metricMaker.newCounter( "plugin/error_count", new Description("Number of plugin errors").setCumulative().setUnit("errors"), - Field.ofString("plugin_name"), - Field.ofString("class_name"), - Field.ofString("export_name")); + pluginNameField, + classNameField, + exportNameField); } Timer3.Context startLatency(Extension extension) { diff --git a/java/com/google/gerrit/server/project/ProjectState.java b/java/com/google/gerrit/server/project/ProjectState.java index 22f4227e18..f657d9be4b 100644 --- a/java/com/google/gerrit/server/project/ProjectState.java +++ b/java/com/google/gerrit/server/project/ProjectState.java @@ -135,7 +135,7 @@ public class ProjectState { new Description("Latency for access computations in ProjectState") .setCumulative() .setUnit(Units.NANOSECONDS), - Field.ofString("method")); + Field.ofString("method").build()); if (isAllProjects && !Permission.canBeOnAllProjects(AccessSection.ALL, Permission.OWNER)) { localOwners = Collections.emptySet(); diff --git a/java/com/google/gerrit/server/update/RetryHelper.java b/java/com/google/gerrit/server/update/RetryHelper.java index 3c14d25745..7a4f462f96 100644 --- a/java/com/google/gerrit/server/update/RetryHelper.java +++ b/java/com/google/gerrit/server/update/RetryHelper.java @@ -111,7 +111,7 @@ public class RetryHelper { @Inject Metrics(MetricMaker metricMaker) { - Field view = Field.ofEnum(ActionType.class, "action_type"); + Field actionTypeField = Field.ofEnum(ActionType.class, "action_type").build(); attemptCounts = metricMaker.newCounter( "action/retry_attempt_count", @@ -120,7 +120,7 @@ public class RetryHelper { + " (0 == single attempt, no retry)") .setCumulative() .setUnit("attempts"), - view); + actionTypeField); timeoutCount = metricMaker.newCounter( "action/retry_timeout_count", @@ -128,7 +128,7 @@ public class RetryHelper { "Number of action executions of RetryHelper that ultimately timed out") .setCumulative() .setUnit("timeouts"), - view); + actionTypeField); } } diff --git a/javatests/com/google/gerrit/metrics/proc/ProcMetricModuleTest.java b/javatests/com/google/gerrit/metrics/proc/ProcMetricModuleTest.java index db75cd8a63..13d04aba51 100644 --- a/javatests/com/google/gerrit/metrics/proc/ProcMetricModuleTest.java +++ b/javatests/com/google/gerrit/metrics/proc/ProcMetricModuleTest.java @@ -80,7 +80,9 @@ public class ProcMetricModuleTest { public void counter1() { Counter1 cntr = metrics.newCounter( - "test/count", new Description("simple test").setCumulative(), Field.ofString("action")); + "test/count", + new Description("simple test").setCumulative(), + Field.ofString("action").build()); Counter total = get("test/count_total", Counter.class); assertThat(total.getCount()).isEqualTo(0); @@ -105,7 +107,7 @@ public class ProcMetricModuleTest { new Description("simple test") .setCumulative() .setFieldOrdering(FieldOrdering.PREFIX_FIELDS_BASENAME), - Field.ofString("action")); + Field.ofString("action").build()); Counter total = get("test/count_total", Counter.class); assertThat(total.getCount()).isEqualTo(0); diff --git a/javatests/com/google/gerrit/server/logging/PerformanceLogContextTest.java b/javatests/com/google/gerrit/server/logging/PerformanceLogContextTest.java index a8eae736c4..e6797db921 100644 --- a/javatests/com/google/gerrit/server/logging/PerformanceLogContextTest.java +++ b/javatests/com/google/gerrit/server/logging/PerformanceLogContextTest.java @@ -230,24 +230,24 @@ public class PerformanceLogContextTest { metricMaker.newTimer( "test2/latency", new Description("Latency metric for testing"), - Field.ofString("foo")); + Field.ofString("foo").build()); timer1.start("value1").close(); Timer2 timer2 = metricMaker.newTimer( "test3/latency", new Description("Latency metric for testing"), - Field.ofString("foo"), - Field.ofString("bar")); + Field.ofString("foo").build(), + Field.ofString("bar").build()); timer2.start("value1", "value2").close(); Timer3 timer3 = metricMaker.newTimer( "test4/latency", new Description("Latency metric for testing"), - Field.ofString("foo"), - Field.ofString("bar"), - Field.ofString("baz")); + Field.ofString("foo").build(), + Field.ofString("bar").build(), + Field.ofString("baz").build()); timer3.start("value1", "value2", "value3").close(); assertThat(LoggingContext.getInstance().getPerformanceLogRecords()).hasSize(4); @@ -289,24 +289,24 @@ public class PerformanceLogContextTest { metricMaker.newTimer( "test1/latency", new Description("Latency metric for testing"), - Field.ofString("foo")); + Field.ofString("foo").build()); timer1.start(null).close(); Timer2 timer2 = metricMaker.newTimer( "test2/latency", new Description("Latency metric for testing"), - Field.ofString("foo"), - Field.ofString("bar")); + Field.ofString("foo").build(), + Field.ofString("bar").build()); timer2.start(null, null).close(); Timer3 timer3 = metricMaker.newTimer( "test3/latency", new Description("Latency metric for testing"), - Field.ofString("foo"), - Field.ofString("bar"), - Field.ofString("baz")); + Field.ofString("foo").build(), + Field.ofString("bar").build(), + Field.ofString("baz").build()); timer3.start(null, null, null).close(); assertThat(LoggingContext.getInstance().getPerformanceLogRecords()).hasSize(3); @@ -345,24 +345,26 @@ public class PerformanceLogContextTest { Timer1 timer1 = metricMaker.newTimer( - "test2/latency", new Description("Latency metric for testing"), Field.ofString("foo")); + "test2/latency", + new Description("Latency metric for testing"), + Field.ofString("foo").build()); timer1.start("value1").close(); Timer2 timer2 = metricMaker.newTimer( "test3/latency", new Description("Latency metric for testing"), - Field.ofString("foo"), - Field.ofString("bar")); + Field.ofString("foo").build(), + Field.ofString("bar").build()); timer2.start("value1", "value2").close(); Timer3 timer3 = metricMaker.newTimer( "test4/latency", new Description("Latency metric for testing"), - Field.ofString("foo"), - Field.ofString("bar"), - Field.ofString("baz")); + Field.ofString("foo").build(), + Field.ofString("bar").build(), + Field.ofString("baz").build()); timer3.start("value1", "value2", "value3").close(); assertThat(LoggingContext.getInstance().isPerformanceLogging()).isFalse(); @@ -391,24 +393,24 @@ public class PerformanceLogContextTest { metricMaker.newTimer( "test2/latency", new Description("Latency metric for testing"), - Field.ofString("foo")); + Field.ofString("foo").build()); timer1.start("value1").close(); Timer2 timer2 = metricMaker.newTimer( "test3/latency", new Description("Latency metric for testing"), - Field.ofString("foo"), - Field.ofString("bar")); + Field.ofString("foo").build(), + Field.ofString("bar").build()); timer2.start("value1", "value2").close(); Timer3 timer3 = metricMaker.newTimer( "test4/latency", new Description("Latency metric for testing"), - Field.ofString("foo"), - Field.ofString("bar"), - Field.ofString("baz")); + Field.ofString("foo").build(), + Field.ofString("bar").build(), + Field.ofString("baz").build()); timer3.start("value1", "value2", "value3").close(); assertThat(LoggingContext.getInstance().getPerformanceLogRecords()).isEmpty(); diff --git a/plugins/hooks b/plugins/hooks index 12447394c9..8c6baf54bc 160000 --- a/plugins/hooks +++ b/plugins/hooks @@ -1 +1 @@ -Subproject commit 12447394c90141595ab630129e24ab66d2f39a17 +Subproject commit 8c6baf54bc9b889a8999815ef4281bc99efeed5e diff --git a/plugins/replication b/plugins/replication index 1e7930decf..88c979d99a 160000 --- a/plugins/replication +++ b/plugins/replication @@ -1 +1 @@ -Subproject commit 1e7930decf1b87cca3c4ed746d683957802fb728 +Subproject commit 88c979d99aa7e839a79644e4491dd7a256d679f7