Merge branch 'stable-2.15' into stable-2.16
* stable-2.15:
Upgrade bazlets to latest stable-2.15 to build with 2.15.19 API
Upgrade bazlets to latest stable-2.14 to build with 2.14.21 API
Change-Id: Ie59d483ebc5f79b31e65c4fe731ad5d519f171c7
diff --git a/.bazelversion b/.bazelversion
index 9084fa2..fd2a018 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-1.1.0
+3.1.0
diff --git a/WORKSPACE b/WORKSPACE
index fcda4fd..6b01dc7 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -3,7 +3,7 @@
load("//:bazlets.bzl", "load_bazlets")
load_bazlets(
- commit = "9af263722b7eafe99af079d6ef7cf1de23e6f8d7",
+ commit = "fff6f20bb2eceaf872a8acf8ad51471c25a82d38",
#local_path = "/home/<user>/projects/bazlets",
)
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
index 863d1ab..72ef670 100644
--- a/external_plugin_deps.bzl
+++ b/external_plugin_deps.bzl
@@ -3,8 +3,8 @@
def external_plugin_deps():
maven_jar(
name = "javamelody-core",
- artifact = "net.bull.javamelody:javamelody-core:1.80.0",
- sha1 = "9499869f068a1e57efefa392a06b5a7635613359",
+ artifact = "net.bull.javamelody:javamelody-core:1.83.0",
+ sha1 = "850a51ed7887b6f3b8388e25ba86adf15e5da52a",
)
maven_jar(
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.
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index 65935ad..a6701a4 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -62,7 +62,7 @@
To execute the tests run:
```
- bazel test @PLUGIN@_tests
+ bazel test //...
```
This project can be imported into the Eclipse IDE:
@@ -80,37 +80,38 @@
```
cd gerrit/plugins
rm external_plugin_deps.bzl
- ln -s javamelody/external_plugin_deps.bzl .
+ ln -s @PLUGIN@/external_plugin_deps.bzl .
```
Then issue
```
- bazel build plugins/javamelody:javamelody
+ bazel build plugins/@PLUGIN@:@PLUGIN@
```
Note, that the plugin dependencies with [database interception](database-monitoring.md)
are built separately. To do that, issue this command:
```
- bazel build plugins/javamelody:javamelody-deps_deploy.jar
+ bazel build plugins/@PLUGIN@:@PLUGIN@-deps_deploy.jar
```
The output from the former target is:
```
- bazel-bin/plugins/javamelody/javamelody.jar
+ bazel-bin/plugins/@PLUGIN@/@PLUGIN@.jar
```
The output from the latter targets are:
```
- bazel-bin/plugins/javamelody/javamelody-deps_deploy.jar
+ bazel-bin/plugins/@PLUGIN@/@PLUGIN@-deps_deploy.jar
```
-To execute the tests run:
+To execute the tests run either one of:
```
+ bazel test --test_tag_filters=@PLUGIN@ //...
bazel test plugins/@PLUGIN@:@PLUGIN@_tests
```
diff --git a/tools/BUILD b/tools/BUILD
new file mode 100644
index 0000000..1fa2160
--- /dev/null
+++ b/tools/BUILD
@@ -0,0 +1 @@
+# Empty file - bazel treat directories with BUILD file as a package
\ No newline at end of file