Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improved logging #120

Merged
merged 2 commits into from
Oct 6, 2023
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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rtcstats-server",
"version": "2.24.1",
"version": "2.24.3",
"description": "The rtcstats-server represents the server side component of the rtcstats ecosystem, the client side being https://github.com/jitsi/rtcstats which collects and sends WebRTC related statistics.",
"main": "websocket.js",
"private": true,
Expand Down
6 changes: 4 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,6 @@ function wsConnectionHandler(client, upgradeReq) {
const demuxSink = new DemuxSink(demuxSinkOptions);

demuxSink.on('close-sink', ({ id, meta }) => {
logger.info('[App] Queue for processing id %s', id);

const { confID = '' } = meta;
const tenantInfo = extractTenantDataFromUrl(confID);

Expand All @@ -344,6 +342,10 @@ function wsConnectionHandler(client, upgradeReq) {
...tenantInfo
};

const obfuscatedDumpData = obfuscatePII(dumpData);

logger.info('[App] Processing dump id %s, metadata %o', id, obfuscatedDumpData);

// Don't process dumps generated by JVB & Jigasi, there should be a more formal process to
if (config.features.disableFeatExtraction
|| connectionInfo.clientProtocol?.includes('JVB')
Expand Down
4 changes: 2 additions & 2 deletions src/demux.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ class DemuxSink extends Writable {
* @param {string} id - UniqueId associated with the sink
* @param {WriteStream} sink - Opened file writable stream associated with the id
*/
_sinkClose({ id, sink, meta }) {
this.log.info('[Demux] close-sink %s, metadata: %o', id, meta);
_sinkClose({ id, sink }) {
this.log.info('[Demux] close-sink %s', id);

sink.end();
}
Expand Down
12 changes: 8 additions & 4 deletions src/worker-pool/WorkerPool.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { Worker } = require('worker_threads');

const logger = require('../logging');
const PromCollector = require('../metrics/PromCollector');
const { ResponseType, obfuscatePII } = require('../utils/utils');
const { ResponseType } = require('../utils/utils');

const WorkerStatus = Object.freeze({
IDLE: 'IDLE',
Expand Down Expand Up @@ -131,10 +131,14 @@ class WorkerPool extends EventEmitter {
* @param {*} task
*/
_processTask(workerMeta, task) {
const { body = {} } = task;
const obfuscatedBody = obfuscatePII(body);
const { body = {}, body: { clientId = '' } = {} } = task;

logger.info(
'[WorkerPool] Processing task with clientId %s, current queue size %d',
clientId,
this.taskQueue.length
);

logger.info('[WorkerPool] Processing task %o, current queue size %d', obfuscatedBody, this.taskQueue.length);
workerMeta.currentTaskMeta = body;
workerMeta.worker.postMessage(task);
workerMeta.status = WorkerStatus.RUNNING;
Expand Down
Loading