Merge branch 'stable-2.16' into stable-3.0
* stable-2.16: Update recommended version of buildifier to 2.0.0 Proc metrics: add average system load for the last minute Proc metrics: add available number of cores Add more metrics about Java threads Change-Id: I6fa4e5b9c6dd46a6ae6fd7272991f17a2afb36d5
This commit is contained in:
commit
e4a98f2eb5
Documentation
java/com/google/gerrit/metrics/proc
@ -171,7 +171,7 @@ To format Java source code, Gerrit uses the
|
|||||||
link:https://github.com/google/google-java-format[`google-java-format`]
|
link:https://github.com/google/google-java-format[`google-java-format`]
|
||||||
tool (version 1.7), and to format Bazel BUILD, WORKSPACE and .bzl files the
|
tool (version 1.7), and to format Bazel BUILD, WORKSPACE and .bzl files the
|
||||||
link:https://github.com/bazelbuild/buildtools/tree/master/buildifier[`buildifier`]
|
link:https://github.com/bazelbuild/buildtools/tree/master/buildifier[`buildifier`]
|
||||||
tool (version 1.0.0). Unused dependencies are found and removed using the
|
tool (version 2.0.0). Unused dependencies are found and removed using the
|
||||||
link:https://github.com/bazelbuild/buildtools/tree/master/unused_deps[`unused_deps`]
|
link:https://github.com/bazelbuild/buildtools/tree/master/unused_deps[`unused_deps`]
|
||||||
build tool, a sibling of `buildifier`.
|
build tool, a sibling of `buildifier`.
|
||||||
|
|
||||||
|
@ -35,7 +35,9 @@ split up by update type (create+replace, autoclose, normal)
|
|||||||
|
|
||||||
* `proc/birth_timestamp`: Time at which the Gerrit process started.
|
* `proc/birth_timestamp`: Time at which the Gerrit process started.
|
||||||
* `proc/uptime`: Uptime of the Gerrit process.
|
* `proc/uptime`: Uptime of the Gerrit process.
|
||||||
|
* `proc/cpu/num_cores`: Number of processors available to the Java virtual machine.
|
||||||
* `proc/cpu/usage`: CPU time used by the Gerrit process.
|
* `proc/cpu/usage`: CPU time used by the Gerrit process.
|
||||||
|
* `proc/cpu/system_load`: System load average for the last minute.
|
||||||
* `proc/num_open_fds`: Number of open file descriptors.
|
* `proc/num_open_fds`: Number of open file descriptors.
|
||||||
* `proc/jvm/memory/heap_committed`: Amount of memory guaranteed for user objects.
|
* `proc/jvm/memory/heap_committed`: Amount of memory guaranteed for user objects.
|
||||||
* `proc/jvm/memory/heap_used`: Amount of memory holding user objects.
|
* `proc/jvm/memory/heap_used`: Amount of memory holding user objects.
|
||||||
@ -47,6 +49,9 @@ objects needing finalization.
|
|||||||
* `proc/jvm/gc/count`: Number of GCs.
|
* `proc/jvm/gc/count`: Number of GCs.
|
||||||
* `proc/jvm/gc/time`: Approximate accumulated GC elapsed time.
|
* `proc/jvm/gc/time`: Approximate accumulated GC elapsed time.
|
||||||
* `proc/jvm/thread/num_live`: Current live thread count.
|
* `proc/jvm/thread/num_live`: Current live thread count.
|
||||||
|
* `proc/jvm/thread/num_daemon_live`: Current live daemon threads count.
|
||||||
|
* `proc/jvm/thread/num_peak_live`: Peak live thread count since the Java virtual machine started or peak was reset.
|
||||||
|
* `proc/jvm/thread/num_total_started`: Total number of threads created and also started since the Java virtual machine started.
|
||||||
|
|
||||||
=== Caches
|
=== Caches
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ import java.lang.management.GarbageCollectorMXBean;
|
|||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
import java.lang.management.MemoryMXBean;
|
import java.lang.management.MemoryMXBean;
|
||||||
import java.lang.management.MemoryUsage;
|
import java.lang.management.MemoryUsage;
|
||||||
|
import java.lang.management.OperatingSystemMXBean;
|
||||||
import java.lang.management.ThreadMXBean;
|
import java.lang.management.ThreadMXBean;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ public class ProcMetricModule extends MetricModule {
|
|||||||
buildLabel(metrics);
|
buildLabel(metrics);
|
||||||
procUptime(metrics);
|
procUptime(metrics);
|
||||||
procCpuUsage(metrics);
|
procCpuUsage(metrics);
|
||||||
|
procCpuLoad(metrics);
|
||||||
procJvmGc(metrics);
|
procJvmGc(metrics);
|
||||||
procJvmMemory(metrics);
|
procJvmMemory(metrics);
|
||||||
procJvmThread(metrics);
|
procJvmThread(metrics);
|
||||||
@ -83,6 +85,23 @@ public class ProcMetricModule extends MetricModule {
|
|||||||
new Description("Number of open file descriptors").setGauge().setUnit("fds"),
|
new Description("Number of open file descriptors").setGauge().setUnit("fds"),
|
||||||
provider::getOpenFileDescriptorCount);
|
provider::getOpenFileDescriptorCount);
|
||||||
}
|
}
|
||||||
|
metrics.newCallbackMetric(
|
||||||
|
"proc/cpu/num_cores",
|
||||||
|
Integer.class,
|
||||||
|
new Description("Number of processors available to the Java virtual machine").setGauge(),
|
||||||
|
Runtime.getRuntime()::availableProcessors);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void procCpuLoad(MetricMaker metrics) {
|
||||||
|
OperatingSystemMXBean provider =
|
||||||
|
ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class);
|
||||||
|
if (provider.getSystemLoadAverage() != -1) {
|
||||||
|
metrics.newCallbackMetric(
|
||||||
|
"proc/cpu/system_load",
|
||||||
|
Double.class,
|
||||||
|
new Description("System load average for the last minute").setGauge(),
|
||||||
|
provider::getSystemLoadAverage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void procJvmMemory(MetricMaker metrics) {
|
private void procJvmMemory(MetricMaker metrics) {
|
||||||
@ -188,5 +207,26 @@ public class ProcMetricModule extends MetricModule {
|
|||||||
Integer.class,
|
Integer.class,
|
||||||
new Description("Current live thread count").setGauge().setUnit("threads"),
|
new Description("Current live thread count").setGauge().setUnit("threads"),
|
||||||
thread::getThreadCount);
|
thread::getThreadCount);
|
||||||
|
metrics.newCallbackMetric(
|
||||||
|
"proc/jvm/thread/num_daemon_live",
|
||||||
|
Integer.class,
|
||||||
|
new Description("Current live daemon threads count").setGauge().setUnit("threads"),
|
||||||
|
thread::getDaemonThreadCount);
|
||||||
|
metrics.newCallbackMetric(
|
||||||
|
"proc/jvm/thread/num_peak_live",
|
||||||
|
Integer.class,
|
||||||
|
new Description(
|
||||||
|
"Peak live thread count since the Java virtual machine started or peak was reset")
|
||||||
|
.setGauge()
|
||||||
|
.setUnit("threads"),
|
||||||
|
thread::getPeakThreadCount);
|
||||||
|
metrics.newCallbackMetric(
|
||||||
|
"proc/jvm/thread/num_total_started",
|
||||||
|
Long.class,
|
||||||
|
new Description(
|
||||||
|
"Total number of threads created and also started since the Java virtual machine started")
|
||||||
|
.setGauge()
|
||||||
|
.setUnit("threads"),
|
||||||
|
thread::getTotalStartedThreadCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user