@webex/plugin-meetings 3.12.0-llmrefactor.2 → 3.12.0-llmrefactor.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -900,6 +900,63 @@ describe('plugin-meetings', () => {
900
900
  }
901
901
  );
902
902
 
903
+ forEach(
904
+ [
905
+ {
906
+ meetingId: 'meeting-id',
907
+ sendCAevents: true,
908
+ correlationId: 'correlation-id',
909
+ shouldSendCorrelationId: true,
910
+ condition: 'when CA events are enabled for the meeting',
911
+ },
912
+ {
913
+ sendCAevents: true,
914
+ correlationId: 'correlation-id',
915
+ shouldSendCorrelationId: false,
916
+ condition: 'without a meetingId',
917
+ },
918
+ {
919
+ meetingId: 'meeting-id',
920
+ sendCAevents: false,
921
+ correlationId: 'correlation-id',
922
+ shouldSendCorrelationId: false,
923
+ condition: 'when CA events are disabled',
924
+ },
925
+ {
926
+ meetingId: 'meeting-id',
927
+ sendCAevents: true,
928
+ shouldSendCorrelationId: false,
929
+ condition: 'without a correlationId',
930
+ },
931
+ ],
932
+ ({meetingId, sendCAevents, correlationId, shouldSendCorrelationId, condition}) => {
933
+ it(`should ${
934
+ shouldSendCorrelationId ? '' : 'not '
935
+ }send the correlationId header ${condition}`, async () => {
936
+ webex.request.resolves({statusCode: 200, body: {meetingKey: '1234323'}});
937
+
938
+ await meetingInfo.fetchMeetingInfo(
939
+ '1234323',
940
+ DESTINATION_TYPE.MEETING_ID,
941
+ null,
942
+ null,
943
+ null,
944
+ null,
945
+ undefined,
946
+ {meetingId, sendCAevents, correlationId}
947
+ );
948
+
949
+ const requestOptions = webex.request.firstCall.args[0];
950
+
951
+ if (shouldSendCorrelationId) {
952
+ assert.deepEqual(requestOptions.headers, {correlationId});
953
+ } else {
954
+ assert.notProperty(requestOptions, 'headers');
955
+ }
956
+ });
957
+ }
958
+ );
959
+
903
960
  it('should send CA metric if meetingId is provided and send CA events is authorized', async () => {
904
961
  const requestResponse = {
905
962
  statusCode: 200,
@@ -1879,12 +1879,27 @@ describe('plugin-meetings', () => {
1879
1879
  });
1880
1880
 
1881
1881
  describe('wasm runtime performance telemetry', () => {
1882
+ const correlationId = 'wasm-corr-id';
1883
+ const benchmarkMeasurements = {
1884
+ divRatio: 1.888,
1885
+ sqrtRatio: 3.474,
1886
+ addNsPerOp: 2.006,
1887
+ addMedianMs: 32.1,
1888
+ divMedianMs: 60.6,
1889
+ sqrtMedianMs: 111.5,
1890
+ };
1882
1891
  const probeResult = {
1883
1892
  status: 'slow',
1884
1893
  capability: 'not capable',
1885
- ratio: 0.25,
1886
- wasmMs: 25,
1887
- jsMs: 100,
1894
+ reason: null,
1895
+ measurements: benchmarkMeasurements,
1896
+ };
1897
+ const expectedMetricFields = {
1898
+ status: probeResult.status,
1899
+ capability: probeResult.capability,
1900
+ reason: probeResult.reason,
1901
+ ...benchmarkMeasurements,
1902
+ correlation_id: correlationId,
1888
1903
  };
1889
1904
  let metricsSpy;
1890
1905
  let probeCheckStub;
@@ -1893,7 +1908,7 @@ describe('plugin-meetings', () => {
1893
1908
  webex.meetings.meetingInfo.fetchInfoOptions = sinon.stub().resolves({});
1894
1909
  webex.meetings.createMeeting = sinon
1895
1910
  .stub()
1896
- .returns(Promise.resolve({on: () => true, correlationId: 'wasm-corr-id'}));
1911
+ .returns(Promise.resolve({on: () => true, correlationId}));
1897
1912
  probeCheckStub = sinon.stub(WasmRuntimeProbe, 'check').resolves(probeResult);
1898
1913
  metricsSpy = sinon.stub(Metrics, 'sendBehavioralMetric');
1899
1914
  });
@@ -1908,13 +1923,11 @@ describe('plugin-meetings', () => {
1908
1923
  await testUtils.flushPromises();
1909
1924
 
1910
1925
  assert.calledOnceWithExactly(probeCheckStub);
1911
- assert.calledOnceWithExactly(metricsSpy, 'js_sdk_wasm_runtime_performance', {
1912
- status: 'slow',
1913
- ratio: 0.25,
1914
- wasmMs: 25,
1915
- jsMs: 100,
1916
- correlation_id: 'wasm-corr-id',
1917
- });
1926
+ assert.calledOnceWithExactly(
1927
+ metricsSpy,
1928
+ 'js_sdk_wasm_runtime_performance',
1929
+ expectedMetricFields
1930
+ );
1918
1931
  });
1919
1932
 
1920
1933
  it('logs the WASM runtime status after a meeting is created', async () => {
@@ -1939,12 +1952,35 @@ describe('plugin-meetings', () => {
1939
1952
  await testUtils.flushPromises();
1940
1953
 
1941
1954
  assert.calledOnceWithExactly(probeCheckStub);
1955
+ assert.calledOnceWithExactly(
1956
+ metricsSpy,
1957
+ 'js_sdk_wasm_runtime_performance',
1958
+ expectedMetricFields
1959
+ );
1960
+ });
1961
+
1962
+ it('emits the reason with null measurement fields when no measurements are available', async () => {
1963
+ probeCheckStub.resolves({
1964
+ status: 'unknown',
1965
+ capability: 'unknown',
1966
+ reason: 'worker_timeout',
1967
+ measurements: null,
1968
+ });
1969
+
1970
+ await webex.meetings.create(test1, test2);
1971
+ await testUtils.flushPromises();
1972
+
1942
1973
  assert.calledOnceWithExactly(metricsSpy, 'js_sdk_wasm_runtime_performance', {
1943
- status: 'slow',
1944
- ratio: 0.25,
1945
- wasmMs: 25,
1946
- jsMs: 100,
1947
- correlation_id: 'wasm-corr-id',
1974
+ status: 'unknown',
1975
+ capability: 'unknown',
1976
+ reason: 'worker_timeout',
1977
+ divRatio: null,
1978
+ sqrtRatio: null,
1979
+ addNsPerOp: null,
1980
+ addMedianMs: null,
1981
+ divMedianMs: null,
1982
+ sqrtMedianMs: null,
1983
+ correlation_id: correlationId,
1948
1984
  });
1949
1985
  });
1950
1986
 
@@ -1955,8 +1991,7 @@ describe('plugin-meetings', () => {
1955
1991
  const created = await webex.meetings.create(test1, test2);
1956
1992
  await testUtils.flushPromises();
1957
1993
 
1958
- // create() resolved normally with the meeting, i.e. the failed probe did not break it.
1959
- assert.equal(created.correlationId, 'wasm-corr-id');
1994
+ assert.equal(created.correlationId, correlationId);
1960
1995
  assert.notCalled(metricsSpy);
1961
1996
  assert.calledOnceWithExactly(
1962
1997
  loggerErrorStub,
@@ -2680,7 +2715,11 @@ describe('plugin-meetings', () => {
2680
2715
  undefined,
2681
2716
  undefined,
2682
2717
  extraParams,
2683
- {meetingId: meeting.id, sendCAevents}
2718
+ {
2719
+ meetingId: meeting.id,
2720
+ sendCAevents,
2721
+ correlationId: meeting.correlationId,
2722
+ }
2684
2723
  );
2685
2724
  }
2686
2725