HDFS-8388. Time and Date format need to be in sync in NameNode UI page. Contributed by Surendra Singh Lilhore.

This commit is contained in:
Akira Ajisaka 2015-09-02 14:28:38 +09:00
parent 00804e2457
commit 65ccf2b125
9 changed files with 30 additions and 8 deletions

View File

@ -192,6 +192,8 @@ Each metrics record contains tags such as ProcessName, SessionId, and Hostname a
| `PutImageNumOps` | Total number of fsimage uploads to SecondaryNameNode | | `PutImageNumOps` | Total number of fsimage uploads to SecondaryNameNode |
| `PutImageAvgTime` | Average fsimage upload time in milliseconds | | `PutImageAvgTime` | Average fsimage upload time in milliseconds |
| `TotalFileOps`| Total number of file operations performed | | `TotalFileOps`| Total number of file operations performed |
| `NNStarted`| NameNode start time |
| `NNStartedTimeInMillis`| NameNode start time in milliseconds |
FSNamesystem FSNamesystem
------------ ------------

View File

@ -1270,6 +1270,9 @@ Release 2.8.0 - UNRELEASED
HDFS-8950. NameNode refresh doesn't remove DataNodes that are no longer in HDFS-8950. NameNode refresh doesn't remove DataNodes that are no longer in
the allowed list (Daniel Templeton) the allowed list (Daniel Templeton)
HDFS-8388. Time and Date format need to be in sync in NameNode UI page.
(Surendra Singh Lilhore via aajisaka)
Release 2.7.2 - UNRELEASED Release 2.7.2 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -6131,6 +6131,11 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
return getStartTime().toString(); return getStartTime().toString();
} }
@Override // NameNodeMXBean
public long getNNStartedTimeInMillis() {
return startTime;
}
@Override // NameNodeMXBean @Override // NameNodeMXBean
public String getCompileInfo() { public String getCompileInfo() {
return VersionInfo.getDate() + " by " + VersionInfo.getUser() + return VersionInfo.getDate() + " by " + VersionInfo.getUser() +

View File

@ -238,6 +238,12 @@ public interface NameNodeMXBean {
*/ */
public String getNNStarted(); public String getNNStarted();
/**
* Gets the NN start time in milliseconds.
* @return the NN start time in msec
*/
long getNNStartedTimeInMillis();
/** /**
* Get the compilation information which contains date, user and branch * Get the compilation information which contains date, user and branch
* *

View File

@ -130,9 +130,9 @@
<tr><th>Namenode ID:</th><td>{NamenodeID}</td></tr> <tr><th>Namenode ID:</th><td>{NamenodeID}</td></tr>
{/HAInfo} {/HAInfo}
{#nn} {#nn}
<tr><th>Started:</th><td>{NNStarted}</td></tr> <tr><th>Started:</th><td>{NNStartedTimeInMillis|date_tostring}</td></tr>
<tr><th>Version:</th><td>{Version}</td></tr> <tr><th>Version:</th><td>{Version}</td></tr>
<tr><th>Compiled:</th><td>{CompileInfo}</td></tr> <tr><th>Compiled:</th><td>{CompileInfo|format_compile_info}</td></tr>
<tr><th>Cluster ID:</th><td>{ClusterId}</td></tr> <tr><th>Cluster ID:</th><td>{ClusterId}</td></tr>
<tr><th>Block Pool ID:</th><td>{BlockPoolId}</td></tr> <tr><th>Block Pool ID:</th><td>{BlockPoolId}</td></tr>
{/nn} {/nn}
@ -423,7 +423,6 @@ There are no reported volume failures.
</script><script type="text/javascript" src="/static/bootstrap-3.0.2/js/bootstrap.min.js"> </script><script type="text/javascript" src="/static/bootstrap-3.0.2/js/bootstrap.min.js">
</script><script type="text/javascript" src="/static/dataTables.bootstrap.js"> </script><script type="text/javascript" src="/static/dataTables.bootstrap.js">
</script><script type="text/javascript" src="/static/moment.min.js"> </script><script type="text/javascript" src="/static/moment.min.js">
</script><script type="text/javascript" src="/static/moment.min.js">
</script><script type="text/javascript" src="/static/dust-full-2.0.0.min.js"> </script><script type="text/javascript" src="/static/dust-full-2.0.0.min.js">
</script><script type="text/javascript" src="/static/dust-helpers-1.1.1.min.js"> </script><script type="text/javascript" src="/static/dust-helpers-1.1.1.min.js">
</script><script type="text/javascript" src="/static/dfs-dust.js"> </script><script type="text/javascript" src="/static/dfs-dust.js">

View File

@ -57,7 +57,7 @@
'helper_date_tostring' : function (chunk, ctx, bodies, params) { 'helper_date_tostring' : function (chunk, ctx, bodies, params) {
var value = dust.helpers.tap(params.value, chunk, ctx); var value = dust.helpers.tap(params.value, chunk, ctx);
return chunk.write('' + new Date(Number(value)).toLocaleString()); return chunk.write('' + moment(Number(value)).format('ddd MMM DD HH:mm:ss ZZ YYYY'));
} }
}; };
@ -175,7 +175,7 @@
var HELPERS = { var HELPERS = {
'helper_relative_time' : function (chunk, ctx, bodies, params) { 'helper_relative_time' : function (chunk, ctx, bodies, params) {
var value = dust.helpers.tap(params.value, chunk, ctx); var value = dust.helpers.tap(params.value, chunk, ctx);
return chunk.write(moment().subtract(Number(value), 'seconds').format('YYYY-MM-DD HH:mm:ss')); return chunk.write(moment().subtract(Number(value), 'seconds').format('ddd MMM DD HH:mm:ss ZZ YYYY'));
}, },
'helper_usage_bar' : function (chunk, ctx, bodies, params) { 'helper_usage_bar' : function (chunk, ctx, bodies, params) {
var value = dust.helpers.tap(params.value, chunk, ctx); var value = dust.helpers.tap(params.value, chunk, ctx);
@ -262,7 +262,7 @@
var HELPERS = { var HELPERS = {
'helper_date_tostring' : function (chunk, ctx, bodies, params) { 'helper_date_tostring' : function (chunk, ctx, bodies, params) {
var value = dust.helpers.tap(params.value, chunk, ctx); var value = dust.helpers.tap(params.value, chunk, ctx);
return chunk.write('' + new Date(Number(value)).toLocaleString()); return chunk.write('' + moment(Number(value)).format('ddd MMM DD HH:mm:ss ZZ YYYY'));
} }
}; };

View File

@ -199,6 +199,7 @@
</script><script type="text/javascript" src="/static/dust-helpers-1.1.1.min.js"> </script><script type="text/javascript" src="/static/dust-helpers-1.1.1.min.js">
</script><script type="text/javascript" src="/static/dfs-dust.js"> </script><script type="text/javascript" src="/static/dfs-dust.js">
</script><script type="text/javascript" src="explorer.js"> </script><script type="text/javascript" src="explorer.js">
</script><script type="text/javascript" src="/static/moment.min.js">
</script> </script>
</body> </body>
</html> </html>

View File

@ -146,7 +146,7 @@
var HELPERS = { var HELPERS = {
'helper_date_tostring' : function (chunk, ctx, bodies, params) { 'helper_date_tostring' : function (chunk, ctx, bodies, params) {
var value = dust.helpers.tap(params.value, chunk, ctx); var value = dust.helpers.tap(params.value, chunk, ctx);
return chunk.write('' + new Date(Number(value)).toLocaleString()); return chunk.write('' + moment(Number(value)).format('ddd MMM DD HH:mm:ss ZZ YYYY'));
} }
}; };
var url = '/webhdfs/v1' + encode_path(dir) + '?op=LISTSTATUS'; var url = '/webhdfs/v1' + encode_path(dir) + '?op=LISTSTATUS';

View File

@ -58,7 +58,13 @@
}, },
'date_tostring' : function (v) { 'date_tostring' : function (v) {
return new Date(Number(v)).toLocaleString(); return moment(Number(v)).format('ddd MMM DD HH:mm:ss ZZ YYYY');
},
'format_compile_info' : function (v) {
var info = v.split(" by ")
var date = moment(info[0]).format('ddd MMM DD HH:mm:ss ZZ YYYY');
return date.concat(" by ").concat(info[1]);
}, },
'helper_to_permission': function (v) { 'helper_to_permission': function (v) {