JGit metrics: expose total load time for block cache entries

This allows to calculate current average load time within a time
interval by dividing increase of total_load_time by increase of
load_success_count within a given time interval.

The already exposed metric avg_load_time gives the average since the
gerrit process was started.

Change-Id: I40eb61cc716b7d545aeae4eb522a439cc48bd74d
This commit is contained in:
Matthias Sohn
2020-03-05 17:43:12 +01:00
parent 462bc1b586
commit 11b517e2cc
2 changed files with 15 additions and 3 deletions

View File

@@ -139,9 +139,10 @@ topic submissions that concluded successfully.
=== JGit
* `jgit/block_cache/cache_used`: Bytes of memory retained in JGit block cache.
* `jgit/block_cache/open_files`: File handles held open by JGit block cache.
* `avg_load_time` Average time to load a cache entry for JGit block cache.
* `jgit/block_cache/cache_used` : Bytes of memory retained in JGit block cache.
* `jgit/block_cache/open_files` : File handles held open by JGit block cache.
* `avg_load_time` : Average time to load a cache entry for JGit block cache.
* `total_load_time` : Total time to load cache entries for JGit block cache.
* `eviction_count` : Cache evictions for JGit block cache.
* `eviction_ratio` : Cache eviction ratio for JGit block cache.
* `hit_count` : Cache hits for JGit block cache.

View File

@@ -65,6 +65,17 @@ public class JGitMetricModule extends MetricModule {
}
});
metrics.newCallbackMetric(
"jgit/block_cache/total_load_time",
Long.class,
new Description("Total time to load cache entries for JGit block cache.").setGauge(),
new Supplier<Long>() {
@Override
public Long get() {
return WindowCacheStats.getStats().getTotalLoadTime();
}
});
metrics.newCallbackMetric(
"jgit/block_cache/eviction_count",
Long.class,