Skip to content

Commit 04e7fa4

Browse files
committed
fix(internal-plugin-metrics): log call diagsnotc milestons
1 parent e818834 commit 04e7fa4

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

packages/@webex/internal-plugin-metrics/src/call-diagnostic/call-diagnostic-metrics.util.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,11 @@ export const prepareDiagnosticMetricItem = (webex: any, item: any) => {
390390

391391
item.eventPayload.origin = Object.assign(origin, item.eventPayload.origin);
392392

393+
// Mark call milestones in logs for easier filtering and analysis
394+
if (item.eventPayload.event.name) {
395+
webex.logger.log(`Milestone,CallDiagnostic: ${item.eventPayload.event.name}`);
396+
}
397+
393398
webex.logger.log(
394399
`CallDiagnosticLatencies,prepareDiagnosticMetricItem: ${JSON.stringify({
395400
latencies: Object.fromEntries(cdl.latencyTimestamps),

packages/@webex/internal-plugin-metrics/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,33 @@ describe('internal-plugin-metrics', () => {
460460
});
461461
});
462462

463+
it('logs a Milestone entry when event name is present', () => {
464+
const logSpy = sinon.spy(webex.logger, 'log');
465+
const eventName = 'client.call.initiated';
466+
const eventPayload = {event: {name: eventName}};
467+
468+
prepareDiagnosticMetricItem(webex, {eventPayload, type: ['diagnostic-event']});
469+
470+
assert.isTrue(
471+
logSpy.calledWith('Milestone,CallDiagnostic', eventName),
472+
'expected logger.log to be called with Milestone,CallDiagnostic and the event name'
473+
);
474+
sinon.restore();
475+
});
476+
477+
it('does not log a Milestone entry when event name is absent', () => {
478+
const logSpy = sinon.spy(webex.logger, 'log');
479+
const eventPayload = {event: {}};
480+
481+
prepareDiagnosticMetricItem(webex, {eventPayload, type: ['diagnostic-event']});
482+
483+
assert.isFalse(
484+
logSpy.calledWith('Milestone,CallDiagnostic', sinon.match.any),
485+
'expected logger.log not to be called with Milestone,CallDiagnostic when event name is absent'
486+
);
487+
sinon.restore();
488+
});
489+
463490
it('sets buildType and upgradeChannel correctly', () => {
464491
const item: any = {
465492
eventPayload: {

0 commit comments

Comments
 (0)