Filters some statistics from the logs. Increases the interval for logged statistics.

This commit is contained in:
Boris Grozev 2015-02-25 11:38:04 +01:00
parent 1e35ca5e4d
commit 806d4ea443
2 changed files with 82 additions and 19 deletions

View File

@ -10910,7 +10910,7 @@ function StatsCollector(peerconnection, audioLevelsInterval, statsInterval, even
/** /**
* Gather PeerConnection stats once every this many milliseconds. * Gather PeerConnection stats once every this many milliseconds.
*/ */
this.GATHER_INTERVAL = 10000; this.GATHER_INTERVAL = 15000;
/** /**
* Log stats via the focus once every this many milliseconds. * Log stats via the focus once every this many milliseconds.
@ -11075,6 +11075,38 @@ StatsCollector.prototype.start = function ()
} }
}; };
/**
* Checks whether a certain record should be included in the logged statistics.
*/
function acceptStat(reportId, reportType, statName) {
if (reportType == "googCandidatePair" && statName == "googChannelId")
return false;
if (reportType == "ssrc") {
if (statName == "googTrackId" ||
statName == "transportId" ||
statName == "ssrc")
return false;
}
return true;
}
/**
* Checks whether a certain record should be included in the logged statistics.
*/
function acceptReport(id, type) {
if (id.substring(0, 15) == "googCertificate" ||
id.substring(0, 9) == "googTrack" ||
id.substring(0, 20) == "googLibjingleSession")
return false;
if (type == "goodComponent")
return false;
return true;
}
/** /**
* Converts the stats to the format used for logging, and saves the data in * Converts the stats to the format used for logging, and saves the data in
* this.statsToBeLogged. * this.statsToBeLogged.
@ -11085,12 +11117,16 @@ StatsCollector.prototype.addStatsToBeLogged = function (reports) {
var num_records = this.statsToBeLogged.timestamps.length; var num_records = this.statsToBeLogged.timestamps.length;
this.statsToBeLogged.timestamps.push(new Date().getTime()); this.statsToBeLogged.timestamps.push(new Date().getTime());
reports.map(function (report) { reports.map(function (report) {
if (!acceptReport(report.id, report.type))
return;
var stat = self.statsToBeLogged.stats[report.id]; var stat = self.statsToBeLogged.stats[report.id];
if (!stat) { if (!stat) {
stat = self.statsToBeLogged.stats[report.id] = {}; stat = self.statsToBeLogged.stats[report.id] = {};
} }
stat.type = report.type; stat.type = report.type;
report.names().map(function (name) { report.names().map(function (name) {
if (!acceptStat(report.id, report.type, name))
return;
var values = stat[name]; var values = stat[name];
if (!values) { if (!values) {
values = stat[name] = []; values = stat[name] = [];
@ -11452,21 +11488,17 @@ StatsCollector.prototype.processAudioLevelReport = function ()
{ {
// TODO: can't find specs about what this value really is, // TODO: can't find specs about what this value really is,
// but it seems to vary between 0 and around 32k. // but it seems to vary between 0 and around 32k.
audioLevel = formatAudioLevel(audioLevel / 32767); audioLevel = audioLevel / 32767;
var oldLevel = jidStats.ssrc2AudioLevel[ssrc]; jidStats.setSsrcAudioLevel(ssrc, audioLevel);
if(jid != APP.xmpp.myJid() && (!oldLevel || oldLevel != audioLevel)) if(jid != APP.xmpp.myJid())
{
jidStats.ssrc2AudioLevel[ssrc] = audioLevel;
this.eventEmitter.emit("statistics.audioLevel", jid, audioLevel); this.eventEmitter.emit("statistics.audioLevel", jid, audioLevel);
}
} }
} }
}; };
},{"../../service/RTC/RTCBrowserType":79}],45:[function(require,module,exports){ },{"../../service/RTC/RTCBrowserType":79}],45:[function(require,module,exports){
/** /**
* Created by hristo on 8/4/14. * Created by hristo on 8/4/14.

View File

@ -151,7 +151,7 @@ function StatsCollector(peerconnection, audioLevelsInterval, statsInterval, even
/** /**
* Gather PeerConnection stats once every this many milliseconds. * Gather PeerConnection stats once every this many milliseconds.
*/ */
this.GATHER_INTERVAL = 10000; this.GATHER_INTERVAL = 15000;
/** /**
* Log stats via the focus once every this many milliseconds. * Log stats via the focus once every this many milliseconds.
@ -316,6 +316,38 @@ StatsCollector.prototype.start = function ()
} }
}; };
/**
* Checks whether a certain record should be included in the logged statistics.
*/
function acceptStat(reportId, reportType, statName) {
if (reportType == "googCandidatePair" && statName == "googChannelId")
return false;
if (reportType == "ssrc") {
if (statName == "googTrackId" ||
statName == "transportId" ||
statName == "ssrc")
return false;
}
return true;
}
/**
* Checks whether a certain record should be included in the logged statistics.
*/
function acceptReport(id, type) {
if (id.substring(0, 15) == "googCertificate" ||
id.substring(0, 9) == "googTrack" ||
id.substring(0, 20) == "googLibjingleSession")
return false;
if (type == "goodComponent")
return false;
return true;
}
/** /**
* Converts the stats to the format used for logging, and saves the data in * Converts the stats to the format used for logging, and saves the data in
* this.statsToBeLogged. * this.statsToBeLogged.
@ -326,12 +358,16 @@ StatsCollector.prototype.addStatsToBeLogged = function (reports) {
var num_records = this.statsToBeLogged.timestamps.length; var num_records = this.statsToBeLogged.timestamps.length;
this.statsToBeLogged.timestamps.push(new Date().getTime()); this.statsToBeLogged.timestamps.push(new Date().getTime());
reports.map(function (report) { reports.map(function (report) {
if (!acceptReport(report.id, report.type))
return;
var stat = self.statsToBeLogged.stats[report.id]; var stat = self.statsToBeLogged.stats[report.id];
if (!stat) { if (!stat) {
stat = self.statsToBeLogged.stats[report.id] = {}; stat = self.statsToBeLogged.stats[report.id] = {};
} }
stat.type = report.type; stat.type = report.type;
report.names().map(function (name) { report.names().map(function (name) {
if (!acceptStat(report.id, report.type, name))
return;
var values = stat[name]; var values = stat[name];
if (!values) { if (!values) {
values = stat[name] = []; values = stat[name] = [];
@ -693,18 +729,13 @@ StatsCollector.prototype.processAudioLevelReport = function ()
{ {
// TODO: can't find specs about what this value really is, // TODO: can't find specs about what this value really is,
// but it seems to vary between 0 and around 32k. // but it seems to vary between 0 and around 32k.
audioLevel = formatAudioLevel(audioLevel / 32767); audioLevel = audioLevel / 32767;
var oldLevel = jidStats.ssrc2AudioLevel[ssrc]; jidStats.setSsrcAudioLevel(ssrc, audioLevel);
if(jid != APP.xmpp.myJid() && (!oldLevel || oldLevel != audioLevel)) if(jid != APP.xmpp.myJid())
{
jidStats.ssrc2AudioLevel[ssrc] = audioLevel;
this.eventEmitter.emit("statistics.audioLevel", jid, audioLevel); this.eventEmitter.emit("statistics.audioLevel", jid, audioLevel);
}
} }
} }
}; };