Skip to content

HBASE-25895 Implement a Cluster Metrics JSON endpoint #4177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ndimiduk
Copy link
Member

@ndimiduk ndimiduk commented Mar 7, 2022

Publishes a set of JSON endpoints following a RESTful structure, which expose a subset of the
o.a.h.h.ClusterMetrics object tree. The URI structure is as follows

/api/v1/admin/cluster_metrics
/api/v1/admin/cluster_metrics/live_servers
/api/v1/admin/cluster_metrics/dead_servers

@Apache-HBase

This comment was marked as outdated.

Copy link
Contributor

@apurtell apurtell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned on the review of your draft PR this is mostly boilerplate wiring up gson to jersey, and it looks sane to me, although I do not understand the requirements in detail.


@Override
public JsonElement serialize(byte[] src, Type typeOfSrc, JsonSerializationContext context) {
return new JsonPrimitive(Bytes.toString(src));
Copy link
Contributor

@apurtell apurtell Mar 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume nonprintable characters in the string are url escaped here downstream from this call to the JsonPrimitve constructor.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@apurtell I cannot tell you. Actually, I'm embarrassed to see that this commit doesn't include any tests. I've added some most basic coverage, including a test that shows the behavior of the configured Gson instance produced by the factory. Please advise.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@apurtell

After some research, my understanding is that Gson handles escaping characters according to the JSON RFC's definition of String values. We are free, according to the RFC, to encode more aggressively than what Gson does, but it appears to implement the minimum plus some additional characters related to html. My test demonstrates that there are some binary values that are not encoded and that do not render well (at least on this machine).

We may chose to escape a wider range of code points, or we my consider some alternative encoding for binary values, such as base64 with perhaps some prefix.

I have made every effort to declare this API as IA.Private, so we are free to evolve it as we choose, so long as we can maintain a sufficient level of backward compatibility for our guarantees. Thus I would prefer to press forward with landing this initial implementation of the feature and continue this encoding discussion as a follow-on effort.

Please advise.

https://datatracker.ietf.org/doc/html/rfc4627#section-2.5
https://github.com/google/gson/blob/gson-parent-2.8.9/gson/src/main/java/com/google/gson/stream/JsonWriter.java#L133-L163

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ndimiduk . I was mainly worried that we might break parsing.

@@ -689,9 +691,16 @@ protected MasterRpcServices createRpcServices() throws IOException {
@Override
protected void configureInfoServer(InfoServer infoServer) {
infoServer.addUnprivilegedServlet("master-status", "/master-status", MasterStatusServlet.class);
infoServer.addUnprivilegedServlet("api_v1", "/api/v1/*", buildApiV1Servlet());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is nice, something to build on

@Apache-HBase

This comment was marked as outdated.

@Apache-HBase

This comment was marked as outdated.

@ndimiduk ndimiduk force-pushed the 25895-cluster-metrics-json-endpoint branch from e50fff6 to 1c62e64 Compare March 8, 2022 20:32
@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 38s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 1s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+0 🆗 mvndep 0m 45s Maven dependency ordering for branch
+1 💚 mvninstall 2m 38s master passed
+1 💚 compile 2m 30s master passed
+1 💚 checkstyle 0m 41s master passed
+1 💚 spotbugs 1m 33s master passed
_ Patch Compile Tests _
+0 🆗 mvndep 0m 10s Maven dependency ordering for patch
+1 💚 mvninstall 2m 18s the patch passed
+1 💚 compile 2m 29s the patch passed
-0 ⚠️ javac 0m 17s hbase-http generated 1 new + 25 unchanged - 1 fixed = 26 total (was 26)
+1 💚 checkstyle 0m 43s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 11m 32s Patch does not cause any errors with Hadoop 3.1.2 3.2.2 3.3.1.
+1 💚 spotbugs 1m 43s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 15s The patch does not generate ASF License warnings.
33m 18s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #4177
Optional Tests dupname asflicense javac spotbugs hadoopcheck hbaseanti checkstyle compile
uname Linux 416391202bd8 5.4.0-1025-aws #25~18.04.1-Ubuntu SMP Fri Sep 11 12:03:04 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 1047194
Default Java AdoptOpenJDK-1.8.0_282-b08
javac https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/artifact/yetus-general-check/output/diff-compile-javac-hbase-http.txt
Max. process+thread count 60 (vs. ulimit of 30000)
modules C: hbase-http hbase-server U: .
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/console
versions git=2.17.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 8s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+0 🆗 mvndep 0m 12s Maven dependency ordering for branch
+1 💚 mvninstall 3m 2s master passed
+1 💚 compile 1m 1s master passed
+1 💚 shadedjars 3m 40s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 40s master passed
_ Patch Compile Tests _
+0 🆗 mvndep 0m 13s Maven dependency ordering for patch
+1 💚 mvninstall 2m 52s the patch passed
+1 💚 compile 1m 1s the patch passed
+1 💚 javac 1m 1s the patch passed
+1 💚 shadedjars 3m 38s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 39s the patch passed
_ Other Tests _
+1 💚 unit 0m 52s hbase-http in the patch passed.
-1 ❌ unit 330m 8s hbase-server in the patch failed.
350m 50s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #4177
Optional Tests javac javadoc unit shadedjars compile
uname Linux c952ceafe72a 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 1047194
Default Java AdoptOpenJDK-11.0.10+9
unit https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/artifact/yetus-jdk11-hadoop3-check/output/patch-unit-hbase-server.txt
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/testReport/
Max. process+thread count 2546 (vs. ulimit of 30000)
modules C: hbase-http hbase-server U: .
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 47s Docker mode activated.
-0 ⚠️ yetus 0m 4s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+0 🆗 mvndep 0m 17s Maven dependency ordering for branch
+1 💚 mvninstall 3m 19s master passed
+1 💚 compile 0m 59s master passed
+1 💚 shadedjars 4m 23s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 45s master passed
_ Patch Compile Tests _
+0 🆗 mvndep 0m 12s Maven dependency ordering for patch
+1 💚 mvninstall 2m 58s the patch passed
+1 💚 compile 0m 56s the patch passed
+1 💚 javac 0m 56s the patch passed
+1 💚 shadedjars 4m 22s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 38s the patch passed
_ Other Tests _
+1 💚 unit 0m 56s hbase-http in the patch passed.
-1 ❌ unit 344m 35s hbase-server in the patch failed.
367m 54s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #4177
Optional Tests javac javadoc unit shadedjars compile
uname Linux 7cef24b5ea49 5.4.0-1025-aws #25~18.04.1-Ubuntu SMP Fri Sep 11 12:03:04 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 1047194
Default Java AdoptOpenJDK-1.8.0_282-b08
unit https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/artifact/yetus-jdk8-hadoop3-check/output/patch-unit-hbase-server.txt
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/testReport/
Max. process+thread count 2323 (vs. ulimit of 30000)
modules C: hbase-http hbase-server U: .
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@ndimiduk
Copy link
Member Author

ndimiduk commented Mar 9, 2022

I'm not sure what to make of the test failure in precommit checks / yetus jdk11 hadoop3 checks / testResolvePortConflict. ZK resulted in a port conflict.

2022-03-09T03:28:29,071 DEBUG [Time-limited test] zookeeper.MiniZooKeeperCluster(249): Failed binding ZK Server to client port: 5556
java.net.BindException: Address already in use
	at sun.nio.ch.Net.bind0(Native Method) ~[?:?]
	at sun.nio.ch.Net.bind(Net.java:455) ~[?:?]
	at sun.nio.ch.Net.bind(Net.java:447) ~[?:?]
	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227) ~[?:?]
	at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:80) ~[?:?]
	at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:73) ~[?:?]
	at org.apache.zookeeper.server.NIOServerCnxnFactory.configure(NIOServerCnxnFactory.java:687) ~[zookeeper-3.5.7.jar:3.5.7]
	at org.apache.zookeeper.server.ServerCnxnFactory.configure(ServerCnxnFactory.java:76) ~[zookeeper-3.5.7.jar:3.5.7]
	at org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster.startup(MiniZooKeeperCluster.java:245) ~[hbase-zookeeper-3.0.0-alpha-3-SNAPSHOT.jar:3.0.0-alpha-3-SNAPSHOT]
	at org.apache.hadoop.hbase.HBaseZKTestingUtil.startMiniZKCluster(HBaseZKTestingUtil.java:131) ~[hbase-zookeeper-3.0.0-alpha-3-SNAPSHOT-tests.jar:?]
	at org.apache.hadoop.hbase.HBaseZKTestingUtil.startMiniZKCluster(HBaseZKTestingUtil.java:104) ~[hbase-zookeeper-3.0.0-alpha-3-SNAPSHOT-tests.jar:?]
	at org.apache.hadoop.hbase.TestHBaseTestingUtil.testMiniZooKeeperWithMultipleClientPorts(TestHBaseTestingUtil.java:364) ~[test-classes/:?]

Is this somehow related to my conf customization in TestApiV1ClusterMetricsResource ? The configuration object it overrides is an instance variable managed in the tests's instance of HBaseTestingUtil...

Ideas @busbey ?

@ndimiduk
Copy link
Member Author

ndimiduk commented Mar 9, 2022

This failure does not reproduce locally when I run this new test and TestHBaseTestingUtil concurrently, or individually.

@ndimiduk ndimiduk force-pushed the 25895-cluster-metrics-json-endpoint branch from 1c62e64 to 5446762 Compare March 9, 2022 16:36
@Apache-HBase
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 6s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 hbaseanti 0m 0s Patch does not have any anti-patterns.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
_ master Compile Tests _
+0 🆗 mvndep 0m 12s Maven dependency ordering for branch
+1 💚 mvninstall 2m 39s master passed
+1 💚 compile 2m 36s master passed
+1 💚 checkstyle 0m 48s master passed
+1 💚 spotbugs 1m 38s master passed
_ Patch Compile Tests _
+0 🆗 mvndep 0m 11s Maven dependency ordering for patch
+1 💚 mvninstall 2m 23s the patch passed
+1 💚 compile 2m 35s the patch passed
+1 💚 javac 0m 21s hbase-http generated 0 new + 23 unchanged - 3 fixed = 23 total (was 26)
+1 💚 javac 2m 14s hbase-server in the patch passed.
+1 💚 checkstyle 0m 45s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 hadoopcheck 11m 27s Patch does not cause any errors with Hadoop 3.1.2 3.2.2 3.3.1.
+1 💚 spotbugs 1m 52s the patch passed
_ Other Tests _
+1 💚 asflicense 0m 19s The patch does not generate ASF License warnings.
33m 44s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/3/artifact/yetus-general-check/output/Dockerfile
GITHUB PR #4177
Optional Tests dupname asflicense javac spotbugs hadoopcheck hbaseanti checkstyle compile
uname Linux 45dfbfd16ee8 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 1047194
Default Java AdoptOpenJDK-1.8.0_282-b08
Max. process+thread count 60 (vs. ulimit of 30000)
modules C: hbase-http hbase-server U: .
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/3/console
versions git=2.17.1 maven=3.6.3 spotbugs=4.2.2
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 11s Docker mode activated.
-0 ⚠️ yetus 0m 2s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+0 🆗 mvndep 0m 12s Maven dependency ordering for branch
+1 💚 mvninstall 2m 49s master passed
+1 💚 compile 1m 2s master passed
+1 💚 shadedjars 3m 41s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 39s master passed
_ Patch Compile Tests _
+0 🆗 mvndep 0m 13s Maven dependency ordering for patch
+1 💚 mvninstall 2m 48s the patch passed
+1 💚 compile 1m 1s the patch passed
+1 💚 javac 1m 1s the patch passed
+1 💚 shadedjars 3m 35s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 39s the patch passed
_ Other Tests _
+1 💚 unit 0m 50s hbase-http in the patch passed.
-1 ❌ unit 328m 50s hbase-server in the patch failed.
349m 10s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/3/artifact/yetus-jdk11-hadoop3-check/output/Dockerfile
GITHUB PR #4177
Optional Tests javac javadoc unit shadedjars compile
uname Linux 2420eed69690 5.4.0-90-generic #101-Ubuntu SMP Fri Oct 15 20:00:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 1047194
Default Java AdoptOpenJDK-11.0.10+9
unit https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/3/artifact/yetus-jdk11-hadoop3-check/output/patch-unit-hbase-server.txt
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/3/testReport/
Max. process+thread count 2872 (vs. ulimit of 30000)
modules C: hbase-http hbase-server U: .
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/3/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 54s Docker mode activated.
-0 ⚠️ yetus 0m 3s Unprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+0 🆗 mvndep 0m 32s Maven dependency ordering for branch
+1 💚 mvninstall 3m 18s master passed
+1 💚 compile 1m 19s master passed
+1 💚 shadedjars 5m 21s branch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 51s master passed
_ Patch Compile Tests _
+0 🆗 mvndep 0m 15s Maven dependency ordering for patch
+1 💚 mvninstall 3m 33s the patch passed
+1 💚 compile 1m 8s the patch passed
+1 💚 javac 1m 8s the patch passed
+1 💚 shadedjars 5m 2s patch has no errors when building our shaded downstream artifacts.
+1 💚 javadoc 0m 45s the patch passed
_ Other Tests _
+1 💚 unit 1m 3s hbase-http in the patch passed.
-1 ❌ unit 361m 34s hbase-server in the patch failed.
388m 12s
Subsystem Report/Notes
Docker ClientAPI=1.41 ServerAPI=1.41 base: https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/3/artifact/yetus-jdk8-hadoop3-check/output/Dockerfile
GITHUB PR #4177
Optional Tests javac javadoc unit shadedjars compile
uname Linux 849f866b6a84 5.4.0-1025-aws #25~18.04.1-Ubuntu SMP Fri Sep 11 12:03:04 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/hbase-personality.sh
git revision master / 1047194
Default Java AdoptOpenJDK-1.8.0_282-b08
unit https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/3/artifact/yetus-jdk8-hadoop3-check/output/patch-unit-hbase-server.txt
Test Results https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/3/testReport/
Max. process+thread count 2538 (vs. ulimit of 30000)
modules C: hbase-http hbase-server U: .
Console output https://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/3/console
versions git=2.17.1 maven=3.6.3
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

Publishes a set of JSON endpoints following a RESTful structure, which expose a subset of the
`o.a.h.h.ClusterMetrics` object tree. The URI structure is as follows

    /api/v1/admin/cluster_metrics
    /api/v1/admin/cluster_metrics/live_servers
    /api/v1/admin/cluster_metrics/dead_servers

Signed-off-by: Sean Busbey <busbey@apache.org>
Signed-off-by: Andrew Purtell <apurtell@apache.org>
@ndimiduk ndimiduk force-pushed the 25895-cluster-metrics-json-endpoint branch from 5446762 to 7b50d86 Compare March 10, 2022 13:57
@ndimiduk ndimiduk merged commit be0afbf into apache:master Mar 10, 2022
@ndimiduk ndimiduk deleted the 25895-cluster-metrics-json-endpoint branch March 10, 2022 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants