Skip to content

HBASE-25895 Implement a Cluster Metrics JSON endpoint - #4177

Merged
ndimiduk merged 1 commit into
apache:masterfrom
ndimiduk:25895-cluster-metrics-json-endpoint
Mar 10, 2022
Merged

HBASE-25895 Implement a Cluster Metrics JSON endpoint#4177
ndimiduk merged 1 commit into
apache:masterfrom
ndimiduk:25895-cluster-metrics-json-endpoint

Conversation

@ndimiduk

Copy link
Copy Markdown
Member

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.

@apurtellapurtell left a comment

Copy link
Copy Markdown
Contributor

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));

@apurtellapurtellMar 7, 2022

Copy link
Copy Markdown
Contributor

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
Copy Markdown
MemberAuthor

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
Copy Markdown
MemberAuthor

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
Copy Markdown
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.

@Override
protected void configureInfoServer(InfoServer infoServer) {
infoServer.addUnprivilegedServlet("master-status", "/master-status", MasterStatusServlet.class);
infoServer.addUnprivilegedServlet("api_v1", "/api/v1/*", buildApiV1Servlet());

Copy link
Copy Markdown
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
ndimidukforce-pushed the 25895-cluster-metrics-json-endpoint branch from e50fff6 to 1c62e64CompareMarch 8, 2022 20:32
@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 38sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 1sNo case conflicting files found.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
+1 💚@author0m 0sThe patch does not contain any @author tags.
_ master Compile Tests _
+0 🆗mvndep0m 45sMaven dependency ordering for branch
+1 💚mvninstall2m 38smaster passed
+1 💚compile2m 30smaster passed
+1 💚checkstyle0m 41smaster passed
+1 💚spotbugs1m 33smaster passed
_ Patch Compile Tests _
+0 🆗mvndep0m 10sMaven dependency ordering for patch
+1 💚mvninstall2m 18sthe patch passed
+1 💚compile2m 29sthe patch passed
-0 ⚠️javac0m 17shbase-http generated 1 new + 25 unchanged - 1 fixed = 26 total (was 26)
+1 💚checkstyle0m 43sthe patch passed
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck11m 32sPatch does not cause any errors with Hadoop 3.1.2 3.2.2 3.3.1.
+1 💚spotbugs1m 43sthe patch passed
_ Other Tests _
+1 💚asflicense0m 15sThe patch does not generate ASF License warnings.
33m 18s
SubsystemReport/Notes
DockerClientAPI=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 Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti checkstyle compile
unameLinux 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 1047194
Default JavaAdoptOpenJDK-1.8.0_282-b08
javachttps://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 count60 (vs. ulimit of 30000)
modulesC: hbase-http hbase-server U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/console
versionsgit=2.17.1 maven=3.6.3 spotbugs=4.2.2
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 8sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+0 🆗mvndep0m 12sMaven dependency ordering for branch
+1 💚mvninstall3m 2smaster passed
+1 💚compile1m 1smaster passed
+1 💚shadedjars3m 40sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 40smaster passed
_ Patch Compile Tests _
+0 🆗mvndep0m 13sMaven dependency ordering for patch
+1 💚mvninstall2m 52sthe patch passed
+1 💚compile1m 1sthe patch passed
+1 💚javac1m 1sthe patch passed
+1 💚shadedjars3m 38spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 39sthe patch passed
_ Other Tests _
+1 💚unit0m 52shbase-http in the patch passed.
-1 ❌unit330m 8shbase-server in the patch failed.
350m 50s
SubsystemReport/Notes
DockerClientAPI=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 Testsjavac javadoc unit shadedjars compile
unameLinux 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 1047194
Default JavaAdoptOpenJDK-11.0.10+9
unithttps://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 Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/testReport/
Max. process+thread count2546 (vs. ulimit of 30000)
modulesC: hbase-http hbase-server U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 47sDocker mode activated.
-0 ⚠️yetus0m 4sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+0 🆗mvndep0m 17sMaven dependency ordering for branch
+1 💚mvninstall3m 19smaster passed
+1 💚compile0m 59smaster passed
+1 💚shadedjars4m 23sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 45smaster passed
_ Patch Compile Tests _
+0 🆗mvndep0m 12sMaven dependency ordering for patch
+1 💚mvninstall2m 58sthe patch passed
+1 💚compile0m 56sthe patch passed
+1 💚javac0m 56sthe patch passed
+1 💚shadedjars4m 22spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 38sthe patch passed
_ Other Tests _
+1 💚unit0m 56shbase-http in the patch passed.
-1 ❌unit344m 35shbase-server in the patch failed.
367m 54s
SubsystemReport/Notes
DockerClientAPI=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 Testsjavac javadoc unit shadedjars compile
unameLinux 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 1047194
Default JavaAdoptOpenJDK-1.8.0_282-b08
unithttps://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 Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/testReport/
Max. process+thread count2323 (vs. ulimit of 30000)
modulesC: hbase-http hbase-server U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/2/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@ndimiduk

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown
MemberAuthor

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

@ndimiduk
ndimidukforce-pushed the 25895-cluster-metrics-json-endpoint branch from 1c62e64 to 5446762CompareMarch 9, 2022 16:36
@Apache-HBase

Copy link
Copy Markdown

🎊 +1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 6sDocker mode activated.
_ Prechecks _
+1 💚dupname0m 0sNo case conflicting files found.
+1 💚hbaseanti0m 0sPatch does not have any anti-patterns.
+1 💚@author0m 0sThe patch does not contain any @author tags.
_ master Compile Tests _
+0 🆗mvndep0m 12sMaven dependency ordering for branch
+1 💚mvninstall2m 39smaster passed
+1 💚compile2m 36smaster passed
+1 💚checkstyle0m 48smaster passed
+1 💚spotbugs1m 38smaster passed
_ Patch Compile Tests _
+0 🆗mvndep0m 11sMaven dependency ordering for patch
+1 💚mvninstall2m 23sthe patch passed
+1 💚compile2m 35sthe patch passed
+1 💚javac0m 21shbase-http generated 0 new + 23 unchanged - 3 fixed = 23 total (was 26)
+1 💚javac2m 14shbase-server in the patch passed.
+1 💚checkstyle0m 45sthe patch passed
+1 💚whitespace0m 0sThe patch has no whitespace issues.
+1 💚hadoopcheck11m 27sPatch does not cause any errors with Hadoop 3.1.2 3.2.2 3.3.1.
+1 💚spotbugs1m 52sthe patch passed
_ Other Tests _
+1 💚asflicense0m 19sThe patch does not generate ASF License warnings.
33m 44s
SubsystemReport/Notes
DockerClientAPI=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 Testsdupname asflicense javac spotbugs hadoopcheck hbaseanti checkstyle compile
unameLinux 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 1047194
Default JavaAdoptOpenJDK-1.8.0_282-b08
Max. process+thread count60 (vs. ulimit of 30000)
modulesC: hbase-http hbase-server U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/3/console
versionsgit=2.17.1 maven=3.6.3 spotbugs=4.2.2
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec1m 11sDocker mode activated.
-0 ⚠️yetus0m 2sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+0 🆗mvndep0m 12sMaven dependency ordering for branch
+1 💚mvninstall2m 49smaster passed
+1 💚compile1m 2smaster passed
+1 💚shadedjars3m 41sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 39smaster passed
_ Patch Compile Tests _
+0 🆗mvndep0m 13sMaven dependency ordering for patch
+1 💚mvninstall2m 48sthe patch passed
+1 💚compile1m 1sthe patch passed
+1 💚javac1m 1sthe patch passed
+1 💚shadedjars3m 35spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 39sthe patch passed
_ Other Tests _
+1 💚unit0m 50shbase-http in the patch passed.
-1 ❌unit328m 50shbase-server in the patch failed.
349m 10s
SubsystemReport/Notes
DockerClientAPI=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 Testsjavac javadoc unit shadedjars compile
unameLinux 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 1047194
Default JavaAdoptOpenJDK-11.0.10+9
unithttps://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 Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/3/testReport/
Max. process+thread count2872 (vs. ulimit of 30000)
modulesC: hbase-http hbase-server U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/3/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@Apache-HBase

Copy link
Copy Markdown

💔 -1 overall

VoteSubsystemRuntimeComment
+0 🆗reexec0m 54sDocker mode activated.
-0 ⚠️yetus0m 3sUnprocessed flag(s): --brief-report-file --spotbugs-strict-precheck --whitespace-eol-ignore-list --whitespace-tabs-ignore-list --quick-hadoopcheck
_ Prechecks _
_ master Compile Tests _
+0 🆗mvndep0m 32sMaven dependency ordering for branch
+1 💚mvninstall3m 18smaster passed
+1 💚compile1m 19smaster passed
+1 💚shadedjars5m 21sbranch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 51smaster passed
_ Patch Compile Tests _
+0 🆗mvndep0m 15sMaven dependency ordering for patch
+1 💚mvninstall3m 33sthe patch passed
+1 💚compile1m 8sthe patch passed
+1 💚javac1m 8sthe patch passed
+1 💚shadedjars5m 2spatch has no errors when building our shaded downstream artifacts.
+1 💚javadoc0m 45sthe patch passed
_ Other Tests _
+1 💚unit1m 3shbase-http in the patch passed.
-1 ❌unit361m 34shbase-server in the patch failed.
388m 12s
SubsystemReport/Notes
DockerClientAPI=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 Testsjavac javadoc unit shadedjars compile
unameLinux 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 toolmaven
Personalitydev-support/hbase-personality.sh
git revisionmaster / 1047194
Default JavaAdoptOpenJDK-1.8.0_282-b08
unithttps://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 Resultshttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/3/testReport/
Max. process+thread count2538 (vs. ulimit of 30000)
modulesC: hbase-http hbase-server U: .
Console outputhttps://ci-hbase.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-4177/3/console
versionsgit=2.17.1 maven=3.6.3
Powered byApache 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
ndimidukforce-pushed the 25895-cluster-metrics-json-endpoint branch from 5446762 to 7b50d86CompareMarch 10, 2022 13:57
@ndimiduk
ndimiduk merged commit be0afbf into apache:masterMar 10, 2022
@ndimiduk
ndimiduk deleted the 25895-cluster-metrics-json-endpoint branch March 10, 2022 13:58
Sign up for freeto 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

@ndimiduk@Apache-HBase@busbey@apurtell