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

feat: update node to latest lts #125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.13-alpine
FROM node:20.14.0-alpine

RUN apk add --no-cache git && \
rm -rf /var/lib/apt/lists/* /var/cache/apk /usr/share/man /tmp/*
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,21 @@ test:
-p 3000:3000 \
-p 8095:8095 \
-v $(PWD):/rtcstats-server \
--env RTCSTATS_LOG_LEVEL=debug \
--entrypoint npm \
--cpus=2 \
$(REPOSITORY):$(TAG) \
run test

integration:
@docker run \
-p 3000:3000 \
-p 8095:8095 \
-v $(PWD):/rtcstats-server \
--entrypoint npm \
--cpus=2 \
$(REPOSITORY):$(TAG) \
run integration

debug-restricted:
@docker run \
-p 3000:3000 \
Expand Down
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.25.4",
"version": "2.26.0",
"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
8 changes: 4 additions & 4 deletions src/RTCStatsServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,15 @@ async function persistDumpData(sinkMeta, features = {}) {
const workerScriptPath = path.join(__dirname, './worker-pool/ExtractWorker.js');
const workerPool = new WorkerPool(workerScriptPath, getIdealWorkerCount());

workerPool.on(ResponseType.DONE, body => {
workerPool.on(ResponseType.DONE, async body => {
const { dumpMetadata = {}, features = {} } = body;
const obfuscatedDumpMeta = obfuscatePII(dumpMetadata);

try {
logger.info('[App] Handling DONE event with meta %o', obfuscatedDumpMeta);
logger.debug('[App] Handling DONE event with features %o', features);
PromCollector.processed.inc();
PromCollector.collectClientDumpSizeMetrics(dumpMetadata);
await PromCollector.collectClientDumpSizeMetrics(dumpMetadata);

if (dumpMetadata.clientType === ClientType.RTCSTATS) {
const { metrics: { dsRequestBytes = 0,
Expand Down Expand Up @@ -135,14 +135,14 @@ workerPool.on(ResponseType.DONE, body => {
persistDumpData(dumpMetadata, features);
});

workerPool.on(ResponseType.ERROR, body => {
workerPool.on(ResponseType.ERROR, async body => {
const { dumpMetadata = {}, error } = body;
const obfuscatedDumpMeta = obfuscatePII(dumpMetadata);

logger.error('[App] Handling ERROR event for: %o, error: %o', obfuscatedDumpMeta, error);

PromCollector.processErrorCount.inc();
PromCollector.collectClientDumpSizeMetrics(dumpMetadata);
await PromCollector.collectClientDumpSizeMetrics(dumpMetadata);

// If feature extraction failed at least attempt to store the dump in s3.
if (dumpMetadata.clientId) {
Expand Down
54 changes: 29 additions & 25 deletions src/metrics/PromCollector.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,30 +197,34 @@ const PromCollector = {
}),

collectClientDumpSizeMetrics: async dumpData => {
const { dumpPath, clientType } = dumpData;

const dumpStats = await fsPromises.stat(dumpPath);
const dumpSize = dumpStats.size;

switch (clientType) {
case ClientType.RTCSTATS:
PromCollector.rtcstatsDumpSizeBytes.observe(dumpSize);
break;
case ClientType.JVB:
PromCollector.jvbDumpSizeBytes.observe(dumpSize);
break;
case ClientType.JICOFO:
PromCollector.jicofoDumpSizeBytes.observe(dumpSize);
break;
case ClientType.JIBRI:
PromCollector.jibriDumpSizeBytes.observe(dumpSize);
break;
case ClientType.JIGASI:
PromCollector.jigasiDumpSizeBytes.observe(dumpSize);
break;
default:
PromCollector.unknownDumpSizeBytes.observe(dumpSize);
break;
try {
const { dumpPath, clientType } = dumpData;

const dumpStats = await fsPromises.stat(dumpPath);
const dumpSize = dumpStats.size;

switch (clientType) {
case ClientType.RTCSTATS:
PromCollector.rtcstatsDumpSizeBytes.observe(dumpSize);
break;
case ClientType.JVB:
PromCollector.jvbDumpSizeBytes.observe(dumpSize);
break;
case ClientType.JICOFO:
PromCollector.jicofoDumpSizeBytes.observe(dumpSize);
break;
case ClientType.JIBRI:
PromCollector.jibriDumpSizeBytes.observe(dumpSize);
break;
case ClientType.JIGASI:
PromCollector.jigasiDumpSizeBytes.observe(dumpSize);
break;
default:
PromCollector.unknownDumpSizeBytes.observe(dumpSize);
break;
}
} catch (error) {
logger.error('[Prom] Error collecting dump size metrics %o', error);
}
},

Expand All @@ -235,7 +239,7 @@ const PromCollector = {
setInterval(() => {
getFolderSize('temp', (err, size) => {
if (err) {
logger.debug('Could not get disk queue dir size %o', err);
logger.debug('[Prom] Could not get disk queue dir size %o', err);

return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/jest/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ describe('extractTenantDataFromUrl', () => {
});
});

describe('File operation tests', () => {
describe.skip('File operation tests', () => {
test('Create and read 10,000 files', async () => {
const tempDir = './temp-test-dir';

Expand Down
Loading