summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuca Milanesio <luca.milanesio@gmail.com>2024-02-01 22:00:41 +0000
committerLuca Milanesio <luca.milanesio@gmail.com>2024-02-01 23:29:10 +0000
commit6b303a643c10fdbc4dc983f03f7dce702a50d440 (patch)
tree4d42fb8ba496bbb05d5cbe624dfb29fcd1331c6b
parentdb0cad716c4b176d66d45e70793c8b3d90bee96e (diff)
Add timer for git/upload-pack/phase_searching_for_*
JGit packer tracks time spent in searching for reuse and sizes associated with the phase "Finding sources". Gerrit already has an out-of-the-box capability for tracking JGit protocol-level metrics, but did not cover until now, the "Finding sources" phase, which is critical for an optimal Git/HTTP performance. Add the git/upload-pack/phase_searching_for_* so that the Gerrit admin can graph how these are performing and spot any potential issues. Release-Notes: Add timer for git/upload-pack/phase_searching_for_* phases Change-Id: I65abde2c2157de61f4ee2114609085065aa5a659
-rw-r--r--Documentation/metrics.txt6
-rw-r--r--java/com/google/gerrit/server/git/UploadPackMetricsHook.java22
2 files changed, 28 insertions, 0 deletions
diff --git a/Documentation/metrics.txt b/Documentation/metrics.txt
index 2ed2c2e23b..396715fe24 100644
--- a/Documentation/metrics.txt
+++ b/Documentation/metrics.txt
@@ -377,6 +377,12 @@ Each queue provides the following metrics:
* `git/upload-pack/phase_negotiating`: Time spent in the negotiation phase.
** `operation`:
The name of the operation (CLONE, FETCH).
+* `git/upload-pack/phase_searching_for_reuse`: Time spent in the 'Finding sources...' while searching for reuse phase.
+** `operation`:
+ The name of the operation (CLONE, FETCH).
+* `git/upload-pack/phase_searching_for_sizes`: Time spent in the 'Finding sources...' while searching for sizes phase.
+** `operation`:
+ The name of the operation (CLONE, FETCH).
* `git/upload-pack/phase_writing`: Time spent transferring bytes to client.
** `operation`:
The name of the operation (CLONE, FETCH).
diff --git a/java/com/google/gerrit/server/git/UploadPackMetricsHook.java b/java/com/google/gerrit/server/git/UploadPackMetricsHook.java
index e1403828b9..9164dd36ed 100644
--- a/java/com/google/gerrit/server/git/UploadPackMetricsHook.java
+++ b/java/com/google/gerrit/server/git/UploadPackMetricsHook.java
@@ -40,6 +40,8 @@ public class UploadPackMetricsHook implements PostUploadHook {
private final Timer1<Operation> counting;
private final Timer1<Operation> compressing;
private final Timer1<Operation> negotiating;
+ private final Timer1<Operation> searchingForReuse;
+ private final Timer1<Operation> searchingForSizes;
private final Timer1<Operation> writing;
private final Histogram1<Operation> packBytes;
@@ -81,6 +83,24 @@ public class UploadPackMetricsHook implements PostUploadHook {
.setUnit(Units.MILLISECONDS),
operationField);
+ searchingForReuse =
+ metricMaker.newTimer(
+ "git/upload-pack/phase_searching_for_reuse",
+ new Description(
+ "Time spent in the 'Finding sources...' while searching for reuse phase")
+ .setCumulative()
+ .setUnit(Units.MILLISECONDS),
+ operationField);
+
+ searchingForSizes =
+ metricMaker.newTimer(
+ "git/upload-pack/phase_searching_for_sizes",
+ new Description(
+ "Time spent in the 'Finding sources...' while searching for sizes phase")
+ .setCumulative()
+ .setUnit(Units.MILLISECONDS),
+ operationField);
+
writing =
metricMaker.newTimer(
"git/upload-pack/phase_writing",
@@ -109,6 +129,8 @@ public class UploadPackMetricsHook implements PostUploadHook {
counting.record(op, stats.getTimeCounting(), MILLISECONDS);
compressing.record(op, stats.getTimeCompressing(), MILLISECONDS);
negotiating.record(op, stats.getTimeNegotiating(), MILLISECONDS);
+ searchingForReuse.record(op, stats.getTimeSearchingForReuse(), MILLISECONDS);
+ searchingForSizes.record(op, stats.getTimeSearchingForSizes(), MILLISECONDS);
writing.record(op, stats.getTimeWriting(), MILLISECONDS);
packBytes.record(op, stats.getTotalBytes());
}