DRILL-6364: Handle Cluster Info in WebUI when existing/new bits restart As a follow up to DRILL-6289, the following improvements have been done: 1. When loading the page for the first time, the WebUI enables the shutdown button without actually checking the state of the Drillbits. The ideal behaviour should be to disable the button till the state is verified. [Done] If a Drillbit is confirmed down (i.e. not in `/state` response), it is marked as OFFLINE and button is disabled. 2. When shutting down the current Drillbit, the WebUI no more has access to the cluster state. The ideal behaviour here should be to fetch the state from any of the other Drillbits to update the status. [Done] With the current Drillbit down, the other bits are requested for cluster state info and update accordingly. 3. When a new, previously unseen Drillbit comes up, the WebUI will never render it because the table is statically generated during the first page load. The idea behaviour should be to append to the table on discovery of a new node. [Done] The new Drillbit info is injected and a prompt appears to refresh the page to re-populate any missing info. This also works with feature (2) mentioned above.
The only Java code change was to have the state response carry the address and http-port as a tuple, instead of the user-port (which is never used).
Updates based on review
1. Added descriptive comments to functions 2. Handled possible race condition from multiple httpRequests for cluster state 3. Eliminated unused stateKey variable 4. Best practice of using local (let) instead of global (var) objects, and substituting currentRow variable instead of the jQuery search.
Additional changes based on review
1. Random selection of Drillbits to query for state when primary Drillbit is down (limited to 3; with a timeout of 3 sec) 2. Indicate when an Offline Drillbit is de-registered, versus just Offline as per Zookeeper 3. Hide shutdown column when Authentication is enabled, but the user is NOT an Admin. When the column is visible, remote bits are disabled because 4. Metrics will be shown all the time (except HTTPS), because the information is available and a non-admin user would anyway not have actionable capabilities 5. Basic clean up on unused variables
Hide shutdown buttons for HTTPS scenarios
Fixed check for 'https'
Since, `location.protocol` returns a trailing ':' as well
Handle metrics lookup on local Drillbit for HTTPS
If the webpage is accessed via IP, the certificate is tied to the IP and not the FQDN, which is what is used for fetching the metrics.
DRILL-6289: Cluster view should show more relevant information Protobuf change to carry HTTP port info Allow CORS for access to remote Drillbit metrics Cross-origin resource sharing (CORS) is required to ensure that the WebServer is able serve REST calls for status pages. Materialize relevant metrics 1. Heap memory (incl usage) 2. Heap memory (incl usage) 3. Average System Load (last 1 min) 4. Option to view from other nodes (pop out) 5. Added Glyphicons Update System Table and related tests 1. Updated System Table to show HTTP port 2. Updated unit tests Skip updating remote bit info when HTTPS (SSL) or Authentication is enabled. Default CpuGaugeSet is public; Added Gauges * CPU Utiization by Drill * Uptime Show ALL Buttons, but do HTTPS Check Reduce power button to icon Allowing CORS for /status/metrics only Accounting for situations when JVM does not report Process CPU Load i.e. returned value is negative. See https://docs.oracle.com/javase/7/docs/jre/api/management/extension/com/sun/management/OperatingSystemMXBean.html#getProcessCpuLoad() Addressed shutdown security conditions Added C++ Client Protobuf Added steps for Protobuf generation to protocol/readme.txt