diff --git a/packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics-latencies.ts b/packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics-latencies.ts index 56360eecbb2..bfe6b4a9e13 100644 --- a/packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +++ b/packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics-latencies.ts @@ -77,7 +77,12 @@ export default class CallDiagnosticLatencies extends WebexPlugin { } // for some events we're only interested in the first timestamp not last // as these events can happen multiple times - if (key === 'client.media.rx.start' || key === 'client.media.tx.start') { + if ( + key === 'client.media.rx.start' || + key === 'client.media.tx.start' || + key === 'internal.client.meetinginfo.request' || + key === 'internal.client.meetinginfo.response' + ) { this.saveFirstTimestampOnly(key, value); } else { this.latencyTimestamps.set(key, value); diff --git a/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts b/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts index f6f5376b5a2..928323a7799 100644 --- a/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +++ b/packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts @@ -103,6 +103,35 @@ describe('internal-plugin-metrics', () => { assert.deepEqual(cdl.getMeetingInfoReqResp(), 10); }); + it('calculates getMeetingInfoReqResp correctly when duplicate requests/responses are sent', () => { + cdl.saveTimestamp({key: 'internal.client.meetinginfo.request', value: 8}); + cdl.saveTimestamp({key: 'internal.client.meetinginfo.response', value: 18}); + cdl.saveTimestamp({key: 'internal.client.meetinginfo.request', value: 47}); + cdl.saveTimestamp({key: 'internal.client.meetinginfo.response', value: 48}); + assert.deepEqual(cdl.getMeetingInfoReqResp(), 10); + }); + + describe('saveTimestamp', () => { + + afterEach(() => { + sinon.restore(); + }); + + it('calls saveFirstTimestamp for meeting info request', () => { + const saveFirstTimestamp = sinon.stub(cdl, 'saveFirstTimestampOnly'); + cdl.saveTimestamp({key: 'internal.client.meetinginfo.request', value: 10}); + cdl.saveTimestamp({key: 'client.alert.displayed', value: 15}); + assert.deepEqual(saveFirstTimestamp.callCount, 1); + }); + + it('calls saveFirstTimestamp for meeting info response', () => { + const saveFirstTimestamp = sinon.stub(cdl, 'saveFirstTimestampOnly'); + cdl.saveTimestamp({key: 'client.alert.displayed', value: 15}); + cdl.saveTimestamp({key: 'internal.client.meetinginfo.response', value: 20}); + assert.deepEqual(saveFirstTimestamp.callCount, 1); + }); + }); + it('calculates getShowInterstitialTime correctly', () => { cdl.saveTimestamp({key: 'client.interstitial-window.start-launch', value: 10}); cdl.saveTimestamp({key: 'internal.client.interstitial-window.click.joinbutton', value: 20});