Observability is a measure for how well internal states of a system can be inferred by knowledge of its external outputs.
Source: WikipediaI'm going to abuse the term a bit.
Scale is why we build realtime apps. Observability is how we keep things sane at scale.
Sometimes things get out of control.
You'll want to know what's going on.
Logging is your friend.
Yes, you can go too far.
Create a status or health endpoint.
app.get('/health', function(req, res){
res.send({
pid: process.pid,
memory: process.memoryUsage(),
uptime: process.uptime(),
connections: server.connections
})
})
var net = require('net'),
, repl = require('repl');
net.createServer(function (socket) {
repl.start({
prompt: 'repl> ',
input: socket,
output: socket
}).on('exit', function() {
socket.end();
})
}).listen('/tmp/node-repl.sock');
npm install replify
var replify = require('replify')
, io = require('socket.io').listen(8888)
, app = io
io.on('connection', function (socket) {
//...
})
replify('socket.io', app)
$ nc -U /tmp/repl/socket.io.sock
$ socat READLINE /tmp/repl/socket.io.sock
npm install -g repl-client
$ rc /tmp/repl/socket.io.sock
(* also possible with socat)
Monitor a single Redis or a cluster of Redis servers.
Now visualize what's going on on those servers.
Monitoring with Redis MONITOR is bad.
The MONITOR command is good and useful for debugging, but not monitoring.
More at: github.com/dshaw