mirror of https://github.com/calzoneman/sync.git
Add prometheus counter for changeMedia
This commit is contained in:
parent
dac2e41488
commit
0b560f15a9
|
@ -2,7 +2,7 @@
|
||||||
"author": "Calvin Montgomery",
|
"author": "Calvin Montgomery",
|
||||||
"name": "CyTube",
|
"name": "CyTube",
|
||||||
"description": "Online media synchronizer and chat",
|
"description": "Online media synchronizer and chat",
|
||||||
"version": "3.44.2",
|
"version": "3.44.3",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "http://github.com/calzoneman/sync"
|
"url": "http://github.com/calzoneman/sync"
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,6 +9,7 @@ var db = require("../database");
|
||||||
var CustomEmbedFilter = require("../customembed").filter;
|
var CustomEmbedFilter = require("../customembed").filter;
|
||||||
var XSS = require("../xss");
|
var XSS = require("../xss");
|
||||||
import counters from '../counters';
|
import counters from '../counters';
|
||||||
|
import { Counter } from 'prom-client';
|
||||||
|
|
||||||
const LOGGER = require('@calzoneman/jsli')('playlist');
|
const LOGGER = require('@calzoneman/jsli')('playlist');
|
||||||
|
|
||||||
|
@ -281,6 +282,11 @@ PlaylistModule.prototype.sendPlaylist = function (users) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const changeMediaCounter = new Counter({
|
||||||
|
name: 'cytube_playlist_played_count',
|
||||||
|
help: 'Counter for number of playlist items played',
|
||||||
|
labelNames: ['shortCode']
|
||||||
|
});
|
||||||
PlaylistModule.prototype.sendChangeMedia = function (users) {
|
PlaylistModule.prototype.sendChangeMedia = function (users) {
|
||||||
if (!this.current || !this.current.media || this._refreshing) {
|
if (!this.current || !this.current.media || this._refreshing) {
|
||||||
return;
|
return;
|
||||||
|
@ -295,6 +301,7 @@ PlaylistModule.prototype.sendChangeMedia = function (users) {
|
||||||
var m = this.current.media;
|
var m = this.current.media;
|
||||||
this.channel.logger.log("[playlist] Now playing: " + m.title +
|
this.channel.logger.log("[playlist] Now playing: " + m.title +
|
||||||
" (" + m.type + ":" + m.id + ")");
|
" (" + m.type + ":" + m.id + ")");
|
||||||
|
changeMediaCounter.labels(m.type).inc();
|
||||||
} else {
|
} else {
|
||||||
users.forEach(function (u) {
|
users.forEach(function (u) {
|
||||||
u.socket.emit("setCurrent", uid);
|
u.socket.emit("setCurrent", uid);
|
||||||
|
|
Loading…
Reference in New Issue