Record time to load a single external ID from NoteDb
This commit adds a new timer to track loading a single external ID from NoteDb. The measurement will be used to decide on any improvements to this space. Change-Id: I86680bf1cd1a59000a39efa60667c27e753105a5
This commit is contained in:
@@ -152,6 +152,8 @@ excluding reindexing
|
|||||||
* `notedb/external_id_update_count`: Total number of external ID updates.
|
* `notedb/external_id_update_count`: Total number of external ID updates.
|
||||||
* `notedb/read_all_external_ids_latency`: Latency for reading all
|
* `notedb/read_all_external_ids_latency`: Latency for reading all
|
||||||
external ID's from NoteDb.
|
external ID's from NoteDb.
|
||||||
|
* `notedb/read_singke_external_id_latency`: Latency for reading a single
|
||||||
|
external ID from NoteDb.
|
||||||
|
|
||||||
=== Permissions
|
=== Permissions
|
||||||
|
|
||||||
|
@@ -68,6 +68,7 @@ public class ExternalIdReader {
|
|||||||
private final AllUsersName allUsersName;
|
private final AllUsersName allUsersName;
|
||||||
private boolean failOnLoad = false;
|
private boolean failOnLoad = false;
|
||||||
private final Timer0 readAllLatency;
|
private final Timer0 readAllLatency;
|
||||||
|
private final Timer0 readSingleLatency;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
ExternalIdReader(
|
ExternalIdReader(
|
||||||
@@ -80,6 +81,12 @@ public class ExternalIdReader {
|
|||||||
new Description("Latency for reading all external IDs from NoteDb.")
|
new Description("Latency for reading all external IDs from NoteDb.")
|
||||||
.setCumulative()
|
.setCumulative()
|
||||||
.setUnit(Units.MILLISECONDS));
|
.setUnit(Units.MILLISECONDS));
|
||||||
|
this.readSingleLatency =
|
||||||
|
metricMaker.newTimer(
|
||||||
|
"notedb/read_single_external_id_latency",
|
||||||
|
new Description("Latency for reading a single external ID from NoteDb.")
|
||||||
|
.setCumulative()
|
||||||
|
.setUnit(Units.MILLISECONDS));
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -126,7 +133,8 @@ public class ExternalIdReader {
|
|||||||
Optional<ExternalId> get(ExternalId.Key key) throws IOException, ConfigInvalidException {
|
Optional<ExternalId> get(ExternalId.Key key) throws IOException, ConfigInvalidException {
|
||||||
checkReadEnabled();
|
checkReadEnabled();
|
||||||
|
|
||||||
try (Repository repo = repoManager.openRepository(allUsersName)) {
|
try (Timer0.Context ctx = readSingleLatency.start();
|
||||||
|
Repository repo = repoManager.openRepository(allUsersName)) {
|
||||||
return ExternalIdNotes.loadReadOnly(allUsersName, repo).get(key);
|
return ExternalIdNotes.loadReadOnly(allUsersName, repo).get(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,7 +144,8 @@ public class ExternalIdReader {
|
|||||||
throws IOException, ConfigInvalidException {
|
throws IOException, ConfigInvalidException {
|
||||||
checkReadEnabled();
|
checkReadEnabled();
|
||||||
|
|
||||||
try (Repository repo = repoManager.openRepository(allUsersName)) {
|
try (Timer0.Context ctx = readSingleLatency.start();
|
||||||
|
Repository repo = repoManager.openRepository(allUsersName)) {
|
||||||
return ExternalIdNotes.loadReadOnly(allUsersName, repo, rev).get(key);
|
return ExternalIdNotes.loadReadOnly(allUsersName, repo, rev).get(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user