Skip to content
Snippets Groups Projects
Commit 813a5f2b authored by Markus Klose's avatar Markus Klose
Browse files

Mulitmediafile Counter added

parent a6bf93a1
No related branches found
No related tags found
No related merge requests found
...@@ -94,21 +94,33 @@ const notSuccessfullLogIns = new client.Counter({ ...@@ -94,21 +94,33 @@ const notSuccessfullLogIns = new client.Counter({
}); });
global.NOTSUCCESSFULLLOG = notSuccessfullLogIns; global.NOTSUCCESSFULLLOG = notSuccessfullLogIns;
const histogram = new client.Histogram({ const audioFileCounter = new client.Counter({
name: 'node_request_duration_seconds', name: 'node_audiofile_counter',
help: 'Own Metric: Histogram for the duration in seconds.', help: 'Counts the amount of times an audio file was sent'
buckets: [1, 2, 5, 6, 10]
}); });
const videoFileCounter = new client.Counter({
name: 'node_videofile_counter',
help: 'Counts the amount of times a video file was sent'
});
const imageFileCounter = new client.Counter({
name: 'node_imagefile_counter',
help: 'Counts the amount of times an image file was sent'
});
register.registerMetric(messageCounterIn); register.registerMetric(messageCounterIn);
register.registerMetric(messageCounterOut); register.registerMetric(messageCounterOut);
register.registerMetric(messageAll); register.registerMetric(messageAll);
register.registerMetric(messagePrivate); register.registerMetric(messagePrivate);
register.registerMetric(messageGroup); register.registerMetric(messageGroup);
register.registerMetric(histogram);
register.registerMetric(successfullLogIns); register.registerMetric(successfullLogIns);
register.registerMetric(notSuccessfullLogIns); register.registerMetric(notSuccessfullLogIns);
register.registerMetric(clientActiveUsers); register.registerMetric(clientActiveUsers);
register.registerMetric(audioFileCounter);
register.registerMetric(videoFileCounter);
register.registerMetric(imageFileCounter);
app.use(bodyParser.json()); app.use(bodyParser.json());
...@@ -389,6 +401,7 @@ io.on('connection', (socket) => { ...@@ -389,6 +401,7 @@ io.on('connection', (socket) => {
*/ */
io.on("connection", (socket) => { io.on("connection", (socket) => {
socket.on('sendImage', (file, callback) => { socket.on('sendImage', (file, callback) => {
imageFileCounter.inc(1);
io.emit('image', file); io.emit('image', file);
}); });
}); });
...@@ -405,6 +418,7 @@ io.on("connection", (socket) => { ...@@ -405,6 +418,7 @@ io.on("connection", (socket) => {
*/ */
io.on("connection", (socket) => { io.on("connection", (socket) => {
socket.on('sendVideo', (file, callback) => { socket.on('sendVideo', (file, callback) => {
videoFileCounter.inc(1);
io.emit('video', file); io.emit('video', file);
}); });
}); });
...@@ -421,6 +435,7 @@ io.on("connection", (socket) => { ...@@ -421,6 +435,7 @@ io.on("connection", (socket) => {
*/ */
io.on("connection", (socket) => { io.on("connection", (socket) => {
socket.on('sendAudio', (file, callback) => { socket.on('sendAudio', (file, callback) => {
audioFileCounter.inc(1);
io.emit('audio', file); io.emit('audio', file);
}); });
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment