-
Notifications
You must be signed in to change notification settings - Fork 401
fix(internal-plugin-metrics): log call diagnostic milestones #5045
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -460,6 +460,33 @@ describe('internal-plugin-metrics', () => { | |
| }); | ||
| }); | ||
|
|
||
| it('logs a Milestone entry when event name is present', () => { | ||
| const logSpy = sinon.spy(webex.logger, 'log'); | ||
| const eventName = 'client.call.initiated'; | ||
| const eventPayload = {event: {name: eventName}}; | ||
|
|
||
| prepareDiagnosticMetricItem(webex, {eventPayload, type: ['diagnostic-event']}); | ||
|
|
||
| assert.isTrue( | ||
| logSpy.calledWith('Milestone,CallDiagnostic', eventName), | ||
|
dominiccarrington marked this conversation as resolved.
|
||
| 'expected logger.log to be called with Milestone,CallDiagnostic and the event name' | ||
|
Comment on lines
+470
to
+472
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The implementation added above calls Useful? React with 👍 / 👎. |
||
| ); | ||
| sinon.restore(); | ||
| }); | ||
|
|
||
| it('does not log a Milestone entry when event name is absent', () => { | ||
| const logSpy = sinon.spy(webex.logger, 'log'); | ||
| const eventPayload = {event: {}}; | ||
|
|
||
| prepareDiagnosticMetricItem(webex, {eventPayload, type: ['diagnostic-event']}); | ||
|
|
||
| assert.isFalse( | ||
| logSpy.calledWith('Milestone,CallDiagnostic', sinon.match.any), | ||
| 'expected logger.log not to be called with Milestone,CallDiagnostic when event name is absent' | ||
| ); | ||
| sinon.restore(); | ||
| }); | ||
|
|
||
| it('sets buildType and upgradeChannel correctly', () => { | ||
| const item: any = { | ||
| eventPayload: { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a call-diagnostic metrics POST hits a transient
NetworkOrCORSError, the default metrics batcher retries by callingrerequest(), which invokes this batcher'sprepareItem()again before re-enqueueing the same item. Because the milestone log is emitted insideprepareDiagnosticMetricItem(), a single client event can produce repeatedMilestone,CallDiagnosticentries on each retry, seconds apart, making the client-log milestone timeline misleading; guard this per item or move the mark to the point where the event is originally created.Useful? React with 👍 / 👎.