Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
Upgrade javamelody-core to 1.77.0
Change-Id: Ie6ad6c6030244446a0e56a131a85e38bd7c88e9b
diff --git a/WORKSPACE b/WORKSPACE
index d7b9a27..89083aa 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,14 +3,14 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "1650318289e9981c01e9122c62679b814c7d7a48",
+ commit = "c827ba79413585ab9dfc1bbd0d7f609eedd6aa80",
#local_path = "/home/<user>/projects/bazlets",
)
# Snapshot Plugin API
#load(
-# "@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl",
-# "gerrit_api_maven_local",
+# "@com_googlesource_gerrit_bazlets//:gerrit_api_maven_local.bzl",
+# "gerrit_api_maven_local",
#)
# Load snapshot Plugin API
diff --git a/src/main/java/com/googlesource/gerrit/plugins/javamelody/CapabilityChecker.java b/src/main/java/com/googlesource/gerrit/plugins/javamelody/CapabilityChecker.java
index fc7bef2..c8bb48b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/javamelody/CapabilityChecker.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/javamelody/CapabilityChecker.java
@@ -45,7 +45,7 @@
public boolean canMonitor() {
try {
permissionBackend
- .user(userProvider)
+ .user(userProvider.get())
.checkAny(
ImmutableSet.of(
GlobalPermission.ADMINISTRATE_SERVER,
diff --git a/src/main/java/com/googlesource/gerrit/plugins/javamelody/GerritMonitoringFilter.java b/src/main/java/com/googlesource/gerrit/plugins/javamelody/GerritMonitoringFilter.java
index 488fe94..f1b188b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/javamelody/GerritMonitoringFilter.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/javamelody/GerritMonitoringFilter.java
@@ -15,6 +15,7 @@
package com.googlesource.gerrit.plugins.javamelody;
import com.google.common.base.Strings;
+import com.google.common.flogger.FluentLogger;
import com.google.gerrit.extensions.annotations.PluginData;
import com.google.gerrit.extensions.annotations.PluginName;
import com.google.gerrit.httpd.AllRequestFilter;
@@ -39,12 +40,10 @@
import net.bull.javamelody.Parameter;
import net.bull.javamelody.internal.common.HttpParameter;
import net.bull.javamelody.internal.common.Parameters;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
@Singleton
class GerritMonitoringFilter extends AllRequestFilter {
- private static final Logger log = LoggerFactory.getLogger(GerritMonitoringFilter.class);
+ private static final FluentLogger log = FluentLogger.forEnclosingClass();
private final JavamelodyFilter monitoring;
@Inject
@@ -165,8 +164,8 @@
// default to old path for javamelody storage-directory if it exists
final Path tmp = Paths.get(System.getProperty("java.io.tmpdir")).resolve(JAVAMELODY_PREFIX);
if (Files.isDirectory(tmp)) {
- log.warn(
- "Javamelody data exists in 'tmp' [{}]. Configuration (if any) will be ignored.", tmp);
+ log.atWarning().log(
+ "Javamelody data exists in 'tmp' [%s]. Configuration (if any) will be ignored.", tmp);
return tmp.toString();
}
@@ -177,7 +176,8 @@
try {
Files.createDirectories(storageDir);
} catch (IOException e) {
- log.error("Creation of javamelody data dir [{}] failed.", storageDir, e);
+ log.atSevere().withCause(e).log(
+ "Creation of javamelody data dir [%s] failed.", storageDir);
throw new RuntimeException(e);
}
}
diff --git a/src/main/resources/Documentation/about.md b/src/main/resources/Documentation/about.md
index f45afd3..725280d 100644
--- a/src/main/resources/Documentation/about.md
+++ b/src/main/resources/Documentation/about.md
@@ -8,3 +8,8 @@
or the 'Administrate Server' capability.
It adds top menu item "Monitoring" to access java melody page.
+
+Gerrit's own metrics can be accessed from within Javamelody monitoring page:
+`<gerrit_host_url>/monitoring?part=mbeans`. The pre-requisite for this is
+[JMX metrics plugin](https://gerrit.googlesource.com/plugins/metrics-reporter-jmx)
+that must be also installed.