You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/05/06 17:00:04 UTC

[GitHub] [accumulo] ctubbsii commented on a diff in pull request #2679: Add front-end console logging in Monitor

ctubbsii commented on code in PR #2679:
URL: https://github.com/apache/accumulo/pull/2679#discussion_r867010362


##########
server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/functions.js:
##########
@@ -426,25 +473,34 @@ function getTraceOfType(type, minutes) {
  */
 function getTraceShow(id) {
   var call = '/rest/trace/show/' + id;
+  console.info("Call to " + call);
   return $.getJSON(call, function(data) {
-    sessionStorage.traceShow = JSON.stringify(data);
+    var jsonDataStr = JSON.stringify(data);
+    sessionStorage.traceShow = jsonDataStr;
+    console.info("REST call to " + call + " stored in sessionStorage.traceShow = " + jsonDataStr);
   });
 }
 
 /**
  * REST GET call for the logs, stores it on a sessionStorage variable
  */
 function getLogs() {
-  return $.getJSON('/rest/logs', function(data) {
-    sessionStorage.logs = JSON.stringify(data);
+  var call = '/rest/logs';
+  console.info("Call to " + call);
+  return $.getJSON(call, function(data) {
+    var jsonDataStr = JSON.stringify(data);
+    sessionStorage.logs = jsonDataStr;
+    console.info("REST call to " + call + " stored in sessionStorage.logs = " + jsonDataStr);
   });

Review Comment:
   A lot of these do the same thing. You can probably simplify these by placing them in a new function that takes a parameter for the session storage variable. In this case, it would be "logs". I found https://stackoverflow.com/a/2132814/196405 , which suggests sessionStorage.logs is equivalent to: sessionStorage["logs"], so you could pass "logs" as a parameter.
   
   Also, I'm thinking these console messages should probably use `console.debug`, at least for the second one.
   The "Call to " one could probably stay console.info. It might also be better worded as: "Retrieving " or "Loading data from " instead of "Call to ".



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org