diff options
Diffstat (limited to 'java/com/google/gerrit/metrics/proc/JGitMetricModule.java')
-rw-r--r-- | java/com/google/gerrit/metrics/proc/JGitMetricModule.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/java/com/google/gerrit/metrics/proc/JGitMetricModule.java b/java/com/google/gerrit/metrics/proc/JGitMetricModule.java new file mode 100644 index 0000000000..438f70e9c3 --- /dev/null +++ b/java/com/google/gerrit/metrics/proc/JGitMetricModule.java @@ -0,0 +1,39 @@ +// Copyright (C) 2015 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.metrics.proc; + +import com.google.gerrit.metrics.Description; +import com.google.gerrit.metrics.Description.Units; +import com.google.gerrit.metrics.MetricMaker; +import org.eclipse.jgit.storage.file.WindowCacheStats; + +public class JGitMetricModule extends MetricModule { + @Override + protected void configure(MetricMaker metrics) { + metrics.newCallbackMetric( + "jgit/block_cache/cache_used", + Long.class, + new Description("Bytes of memory retained in JGit block cache.") + .setGauge() + .setUnit(Units.BYTES), + WindowCacheStats::getOpenBytes); + + metrics.newCallbackMetric( + "jgit/block_cache/open_files", + Integer.class, + new Description("File handles held open by JGit block cache.").setGauge().setUnit("fds"), + WindowCacheStats::getOpenFiles); + } +} |