Untangle metric names for `RepeatedUseSignedPreKeyStore` subclasses
This commit is contained in:
parent
2d154eb0cf
commit
ce4fdbfb3c
|
@ -45,20 +45,12 @@ public abstract class RepeatedUseSignedPreKeyStore<K extends SignedPreKey<?>> {
|
||||||
static final String ATTR_PUBLIC_KEY = "P";
|
static final String ATTR_PUBLIC_KEY = "P";
|
||||||
static final String ATTR_SIGNATURE = "S";
|
static final String ATTR_SIGNATURE = "S";
|
||||||
|
|
||||||
private static final Timer STORE_SINGLE_KEY_TIMER =
|
private final Timer storeSingleKeyTimer = Metrics.timer(MetricsUtil.name(getClass(), "storeSingleKey"));
|
||||||
Metrics.timer(MetricsUtil.name(RepeatedUseSignedPreKeyStore.class, "storeSingleKey"));
|
private final Timer storeKeyBatchTimer = Metrics.timer(MetricsUtil.name(getClass(), "storeKeyBatch"));
|
||||||
|
private final Timer deleteForDeviceTimer = Metrics.timer(MetricsUtil.name(getClass(), "deleteForDevice"));
|
||||||
|
private final Timer deleteForAccountTimer = Metrics.timer(MetricsUtil.name(getClass(), "deleteForAccount"));
|
||||||
|
|
||||||
private static final Timer STORE_KEY_BATCH_TIMER =
|
private final String findKeyTimerName = MetricsUtil.name(getClass(), "findKey");
|
||||||
Metrics.timer(MetricsUtil.name(RepeatedUseSignedPreKeyStore.class, "storeKeyBatch"));
|
|
||||||
|
|
||||||
private static final Timer DELETE_FOR_DEVICE_TIMER =
|
|
||||||
Metrics.timer(MetricsUtil.name(RepeatedUseSignedPreKeyStore.class, "deleteForDevice"));
|
|
||||||
|
|
||||||
private static final Timer DELETE_FOR_ACCOUNT_TIMER =
|
|
||||||
Metrics.timer(MetricsUtil.name(RepeatedUseSignedPreKeyStore.class, "deleteForAccount"));
|
|
||||||
|
|
||||||
private static final String FIND_KEY_TIMER_NAME = MetricsUtil.name(RepeatedUseSignedPreKeyStore.class, "findKey");
|
|
||||||
private static final String KEY_PRESENT_TAG_NAME = "keyPresent";
|
|
||||||
|
|
||||||
public RepeatedUseSignedPreKeyStore(final DynamoDbAsyncClient dynamoDbAsyncClient, final String tableName) {
|
public RepeatedUseSignedPreKeyStore(final DynamoDbAsyncClient dynamoDbAsyncClient, final String tableName) {
|
||||||
this.dynamoDbAsyncClient = dynamoDbAsyncClient;
|
this.dynamoDbAsyncClient = dynamoDbAsyncClient;
|
||||||
|
@ -82,7 +74,7 @@ public abstract class RepeatedUseSignedPreKeyStore<K extends SignedPreKey<?>> {
|
||||||
.tableName(tableName)
|
.tableName(tableName)
|
||||||
.item(getItemFromPreKey(identifier, deviceId, signedPreKey))
|
.item(getItemFromPreKey(identifier, deviceId, signedPreKey))
|
||||||
.build())
|
.build())
|
||||||
.thenRun(() -> sample.stop(STORE_SINGLE_KEY_TIMER));
|
.thenRun(() -> sample.stop(storeSingleKeyTimer));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -113,7 +105,7 @@ public abstract class RepeatedUseSignedPreKeyStore<K extends SignedPreKey<?>> {
|
||||||
})
|
})
|
||||||
.toList())
|
.toList())
|
||||||
.build())
|
.build())
|
||||||
.thenRun(() -> sample.stop(STORE_KEY_BATCH_TIMER));
|
.thenRun(() -> sample.stop(storeKeyBatchTimer));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -136,7 +128,8 @@ public abstract class RepeatedUseSignedPreKeyStore<K extends SignedPreKey<?>> {
|
||||||
.thenApply(response -> response.hasItem() ? Optional.of(getPreKeyFromItem(response.item())) : Optional.empty());
|
.thenApply(response -> response.hasItem() ? Optional.of(getPreKeyFromItem(response.item())) : Optional.empty());
|
||||||
|
|
||||||
findFuture.whenComplete((maybeSignedPreKey, throwable) ->
|
findFuture.whenComplete((maybeSignedPreKey, throwable) ->
|
||||||
sample.stop(Metrics.timer(FIND_KEY_TIMER_NAME, KEY_PRESENT_TAG_NAME, String.valueOf(maybeSignedPreKey != null && maybeSignedPreKey.isPresent()))));
|
sample.stop(Metrics.timer(findKeyTimerName,
|
||||||
|
"keyPresent", String.valueOf(maybeSignedPreKey != null && maybeSignedPreKey.isPresent()))));
|
||||||
|
|
||||||
return findFuture;
|
return findFuture;
|
||||||
}
|
}
|
||||||
|
@ -161,7 +154,7 @@ public abstract class RepeatedUseSignedPreKeyStore<K extends SignedPreKey<?>> {
|
||||||
// Idiom: wait for everything to finish, but discard the results
|
// Idiom: wait for everything to finish, but discard the results
|
||||||
.reduce(0, (a, b) -> 0)
|
.reduce(0, (a, b) -> 0)
|
||||||
.toFuture()
|
.toFuture()
|
||||||
.thenRun(() -> sample.stop(DELETE_FOR_ACCOUNT_TIMER));
|
.thenRun(() -> sample.stop(deleteForAccountTimer));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -179,7 +172,7 @@ public abstract class RepeatedUseSignedPreKeyStore<K extends SignedPreKey<?>> {
|
||||||
.tableName(tableName)
|
.tableName(tableName)
|
||||||
.key(getPrimaryKey(identifier, deviceId))
|
.key(getPrimaryKey(identifier, deviceId))
|
||||||
.build())
|
.build())
|
||||||
.thenRun(() -> sample.stop(DELETE_FOR_DEVICE_TIMER));
|
.thenRun(() -> sample.stop(deleteForDeviceTimer));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Flux<Long> getDeviceIdsWithKeys(final UUID identifier) {
|
public Flux<Long> getDeviceIdsWithKeys(final UUID identifier) {
|
||||||
|
|
Loading…
Reference in New Issue