Convert class for metric field to AutoValue

This reduces the number of static methods for creating fields and allows
us to extend the Field class in future.

Change-Id: Ieaaacddd03b1e04e4e91f000eff950ecb292ec25
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2019-06-26 11:12:14 +02:00
parent 9ded2760b0
commit 441ac9783d
22 changed files with 144 additions and 175 deletions

View File

@@ -45,7 +45,7 @@ class NoteDbMetrics {
@Inject
NoteDbMetrics(MetricMaker metrics) {
Field<NoteDbTable> view = Field.ofEnum(NoteDbTable.class, "table");
Field<NoteDbTable> 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);
}
}

View File

@@ -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() {