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(plugin-meetings): numberOfCores stats #3643

Merged
merged 12 commits into from
Jul 18, 2024
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
1 change: 1 addition & 0 deletions packages/@webex/plugin-meetings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"@webex/media-helpers": "workspace:*",
"@webex/plugin-people": "workspace:*",
"@webex/plugin-rooms": "workspace:*",
"@webex/web-capabilities": "^1.3.0",
"@webex/webex-core": "workspace:*",
"ampersand-collection": "^2.0.2",
"bowser": "^2.11.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ export const emptyMqaInterval = {
intervalMetadata: {
peerReflexiveIP: '0.0.0.0',
peripherals: [],
cpuInfo: {
numberOfCores: 1, // default value from spec if CpuInfo.getNumLogicalCores cannot be determined
description: 'NA',
architecture: 'unknown',
antsukanova marked this conversation as resolved.
Show resolved Hide resolved
},
processAverageCPU: 0,
processMaximumCPU: 0,
systemAverageCPU: 0,
Expand Down
6 changes: 3 additions & 3 deletions packages/@webex/plugin-meetings/src/statsAnalyzer/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* eslint-disable prefer-destructuring */

import {cloneDeep, isEmpty} from 'lodash';
import {CpuInfo} from '@webex/web-capabilities';
import {ConnectionState} from '@webex/internal-media-core';

import EventsScope from '../common/events/events-scope';
import {
DEFAULT_GET_STATS_FILTER,
Expand Down Expand Up @@ -399,6 +397,8 @@ export class StatsAnalyzer extends EventsScope {

newMqa.intervalMetadata.peerReflexiveIP = this.statsResults.connectionType.local.ipAddress;

newMqa.intervalMetadata.cpuInfo.numberOfCores = CpuInfo.getNumLogicalCores() || 1;

// Adding peripheral information
newMqa.intervalMetadata.peripherals.push({information: _UNKNOWN_, name: MEDIA_DEVICES.SPEAKER});
if (this.statsResults['audio-send']) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import testUtils from '../../../utils/testUtils';
import {MEDIA_DEVICES, MQA_INTERVAL, _UNKNOWN_} from '@webex/plugin-meetings/src/constants';
import LoggerProxy from '../../../../src/common/logs/logger-proxy';
import LoggerConfig from '../../../../src/common/logs/logger-config';
import {CpuInfo} from '@webex/web-capabilities';

const {assert} = chai;

Expand Down Expand Up @@ -2113,6 +2114,34 @@ describe('plugin-meetings', () => {
}
});
});
});

describe('CPU Information Reporting', async () => {
let getNumLogicalCoresStub;

beforeEach(async () => {
getNumLogicalCoresStub = sinon.stub(CpuInfo, 'getNumLogicalCores');
});

afterEach(() => {
getNumLogicalCoresStub.restore();
});

it('reports 1 of logical CPU cores when not available', async () => {
getNumLogicalCoresStub.returns(undefined);
await startStatsAnalyzer({pc, statsAnalyzer, mediaStatus: {expected: {receiveVideo: true}}});

await progressTime();
assert.equal(mqeData.intervalMetadata.cpuInfo.numberOfCores, 1);
});

it('reports the number of logical CPU cores', async () => {
getNumLogicalCoresStub.returns(12);
await startStatsAnalyzer({pc, statsAnalyzer, mediaStatus: {expected: {receiveVideo: true}}});

await progressTime();
assert.equal(mqeData.intervalMetadata.cpuInfo.numberOfCores, 12);
});
});
})
});
});
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8157,6 +8157,7 @@ __metadata:
"@webex/test-helper-mock-webex": "workspace:*"
"@webex/test-helper-retry": "workspace:*"
"@webex/test-helper-test-users": "workspace:*"
"@webex/web-capabilities": ^1.3.0
"@webex/webex-core": "workspace:*"
ampersand-collection: ^2.0.2
bowser: ^2.11.0
Expand Down
Loading