Manager info on Monitor rest/manager -> rest-v2/manager#5894
Manager info on Monitor rest/manager -> rest-v2/manager#5894kevinrr888 merged 6 commits intoapache:mainfrom
rest/manager -> rest-v2/manager#5894Conversation
Manager info on the Monitor (displayed on homepage (`/`) and Manager page (`/manager`)) now obtains and displays info from the existing (but unused) `rest-v2/manager` endpoint. * Updated the homepage to display table data corresponding to the `rest-v2/manager` endpoint. * Updated the manager page to display table data corresponding to the `rest-v2/manager` endpoint. * Created new endpoint `rest-v2/manager/metrics` which returns the Manager metrics as json. This is linked in the Manager table in both the homepage and the manager page. * Server navigation bar now only considers the Manager status (as obtained from `rest/status`) (ERROR, WARN, OK). Previously took into account the manager state (e.g., if the state or goal state was SAFE_MODE or CLEAN_STOP), but this info was only included in the `rest/manager` endpoint. * Deleted the `rest/manager` endpoint and associated code used to gather data for this endpoint. * Deleted `systemAlert.js` and `systemAlert.ftl` as this alert was entirely based on Manager info included in `rest/manager` (manager state being SAFE_MODE or CLEAN_STOP). No longer applicable with `rest-v2/manager`.
| getManager().then(function () { | ||
| const managerData = JSON.parse(sessionStorage.manager); | ||
| const managerState = managerData.managerState; | ||
| const managerGoalState = managerData.managerGoalState; | ||
|
|
||
| const isStateGoalSame = managerState === managerGoalState; | ||
|
|
||
| // if the manager state is normal and the goal state is the same as the current state, | ||
| // or of the manager is not running, hide the state banner and return early | ||
| if ((managerState === 'NORMAL' && isStateGoalSame) || managerState === null) { | ||
| $('#managerStateBanner').hide(); | ||
| return; | ||
| } | ||
|
|
||
| // update the manager state banner message and show it | ||
| let bannerMessage = 'Manager state: ' + managerState; | ||
| if (!isStateGoalSame) { | ||
| // only show the goal state if it differs from the manager's current state | ||
| bannerMessage += '. Manager goal state: ' + managerGoalState; | ||
| } | ||
| $('#manager-banner-message').text(bannerMessage); | ||
| $('#managerStateBanner').show(); | ||
| }); |
There was a problem hiding this comment.
no longer applicable as the rest-v2/manager does not contain state of the manager.
There was a problem hiding this comment.
Should we add Metrics for the Manager.ManagerState enum?
|
Ran locally. The manager pages worked but I could never get metric information to display at |
|
Enabled auto-refresh and did get an error message |
| getManager().then(function () { | ||
| const managerData = JSON.parse(sessionStorage.manager); | ||
| const managerState = managerData.managerState; | ||
| const managerGoalState = managerData.managerGoalState; | ||
|
|
||
| const isStateGoalSame = managerState === managerGoalState; | ||
|
|
||
| // if the manager state is normal and the goal state is the same as the current state, | ||
| // or of the manager is not running, hide the state banner and return early | ||
| if ((managerState === 'NORMAL' && isStateGoalSame) || managerState === null) { | ||
| $('#managerStateBanner').hide(); | ||
| return; | ||
| } | ||
|
|
||
| // update the manager state banner message and show it | ||
| let bannerMessage = 'Manager state: ' + managerState; | ||
| if (!isStateGoalSame) { | ||
| // only show the goal state if it differs from the manager's current state | ||
| bannerMessage += '. Manager goal state: ' + managerGoalState; | ||
| } | ||
| $('#manager-banner-message').text(bannerMessage); | ||
| $('#managerStateBanner').show(); | ||
| }); |
There was a problem hiding this comment.
Should we add Metrics for the Manager.ManagerState enum?
| }); | ||
|
|
||
| // Generates the recovery table | ||
| recoveryListTable = $('#recoveryList').DataTable({ |
There was a problem hiding this comment.
Do we need to add metrics for recovery?
There was a problem hiding this comment.
I'm not sure. I just made the front-end adhere to what is in the v2 endpoint. I don't know the history of why some things were removed from v1 to v2, but I assumed they were intentional.
Did you make this comment under the assumption I removed this code? This looks like a weird GitHub bug... This comment is showing that I deleted this code, but this has always been present in my commits. Very strange never seen something like this
- Fix error on using auto-refresh - Move REST_V2_PREFIX to top of script
Metrics aren't configured to emit by default. Can view the pictures I posted above for an idea, or configure accumulo to gather metrics. |
Did not properly auto-refresh "/manager" and "/" pages when the manager was killed after the page was already loaded
Handles a couple edge cases for /manager endpoint: - If manager is dead on first loading the page (in this case, no manager table is created), but later comes online and we are using the auto-refresh feature, previously would never create the manager table. auto-refresh will now create the table if it does not yet exist. - There was a case where /manager could result in a DataTables alert/error. If the manager was up but the endpoint used to get the table data was not yet available (small window where this could occur), a DataTables alert would occur. Handle this instead as a console log and populate the table with no data.
| "ajax": function (data, callback, settings) { | ||
| $.ajax({ | ||
| url: contextPath + 'rest-v2/manager', | ||
| method: 'GET' | ||
| }).done(function (json) { | ||
| callback({ | ||
| "data": [json] | ||
| }); | ||
| }).fail(function (jqXHR, textStatus, errorThrown) { | ||
| // This is needed if the url is not yet available, but the manager is up. E.g., Short | ||
| // window where a 404 could occur, which would lead to DataTables error/alert w/out fail() | ||
| console.error("DataTables Ajax error :", errorThrown); | ||
| callback({ | ||
| "data": [] | ||
| }); | ||
| }); | ||
| }, |
There was a problem hiding this comment.
Differs from original impl to handle edge case described in #5894 (comment)
DomGarguilo
left a comment
There was a problem hiding this comment.
LGTM. I'll create some follow on tickets to re-enable the manager goal state and recovery features.
|
@dlmarion do you have any more comments/concerns? Otherwise, I'll merge this in |
No issue with you merging this. @DomGarguilo captured the follow-ons. |











Manager info on the Monitor (displayed on homepage (
/) and Manager page (/manager)) now obtains and displays info from the existing (but unused)rest-v2/managerendpoint.rest-v2/managerendpoint.rest-v2/managerendpoint.rest-v2/manager/metricswhich returns the Manager metrics as json. This is linked in the Manager table in both the homepage and the manager page.rest/status) (ERROR, WARN, OK). Previously took into account the manager state (e.g., if the state or goal state was SAFE_MODE or CLEAN_STOP), but this info was only included in therest/managerendpoint.rest/managerendpoint and associated code used to gather data for this endpoint.systemAlert.jsandsystemAlert.ftlas this alert was entirely based on Manager info included inrest/manager(manager state being SAFE_MODE or CLEAN_STOP). No longer applicable withrest-v2/manager./tserverspage.closes #5882