Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions lib/appmetrics-dash.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,41 +180,51 @@ exports.monitor = function(options) {
*/
io.on('connection', function(socket) {
var env = monitoring.getEnvironment();
var result = [];
var envData = [];
var json;
for (var entry in env) {
switch (entry) {
case 'command.line':
json = {};
json['Parameter'] = 'Command Line';
json['Value'] = env[entry];
result.push(json);
envData.push(json);
break;
case 'environment.HOSTNAME':
json = {};
json['Parameter'] = 'Hostname';
json['Value'] = env[entry];
result.push(json);
envData.push(json);
break;
case 'os.arch':
json = {};
json['Parameter'] = 'OS Architecture';
json['Value'] = env[entry];
result.push(json);
envData.push(json);
break;
case 'number.of.processors':
json = {};
json['Parameter'] = 'Number of Processors';
json['Value'] = env[entry];
result.push(json);
envData.push(json);
break;
default:
break;
}
}
socket.emit('environment', JSON.stringify(result));
// Send static data ASAP but re-send below in case the client isn't ready.
socket.emit('environment', JSON.stringify(envData));
socket.emit('title', JSON.stringify({title: title, docs: docs}));
socket.emit('status', JSON.stringify({profiling_enabled: profiling_enabled}));

// When the client confirms it's connected and has listeners ready,
// re-send the static data.
socket.on('connected', () => {
socket.emit('environment', JSON.stringify(envData));
socket.emit('title', JSON.stringify({title: title, docs: docs}));
socket.emit('status', JSON.stringify({profiling_enabled: profiling_enabled}));
});

/*
* Support enabling/disabling profiling data
*/
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "appmetrics-dash",
"version": "3.3.1",
"version": "3.3.2",
"description": "Embedded monitoring dashboard for Node.js applications.",
"main": "index.js",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ <h4 class="modal-title" font-color=black>Heap Snapshot</h4>
}
</script>
<script type="text/javascript" src="graphmetrics/js/header.js"></script>
<script type="text/javascript" src="graphmetrics/js/nodeReport.js"></script>

<!--
<script type="text/javascript" src="graphmetrics/js/nodeReport.js"></script>
<script type="text/javascript" src="graphmetrics/js/envTable.js"></script>
<script type="text/javascript" src="graphmetrics/js/cpuChart.js"></script>

Expand Down