-
Notifications
You must be signed in to change notification settings - Fork 397
Feat/webinar llm latencies 2 #5002
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
base: next
Are you sure you want to change the base?
Changes from 24 commits
ea8f007
47d0606
838cc6f
1b82b71
f15504d
3335dc8
35ba521
e8311a9
09d121a
f9875b0
a4dbd7d
dc5d4e7
b06fcd0
d151ef7
b243dec
7ceadf9
21e57ee
839c876
f34a260
a36871d
0d236ca
70c8b96
0d54758
97b7bff
c3b1a10
608910a
36a6303
528c821
a0ef7ee
4356f3d
444d4c5
051bbd7
fdddb7f
051343e
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 |
|---|---|---|
|
|
@@ -709,5 +709,57 @@ describe('plugin-llm', () => { | |
| }); | ||
| }); | ||
|
|
||
| describe('#registerAndConnect timing', () => { | ||
| it('returns timing data on successful connection', async () => { | ||
| llmService.register = sinon.stub().callsFake(async () => { | ||
| const sessionData = llmService.connections.get('llm-default-session') || {}; | ||
|
|
||
| sessionData.webSocketUrl = 'wss://example.com/socket'; | ||
| sessionData.binding = 'binding'; | ||
| llmService.connections.set('llm-default-session', sessionData); | ||
| }); | ||
|
|
||
| const result = await llmService.registerAndConnect(locusUrl, datachannelUrl, undefined); | ||
|
|
||
| assert.isDefined(result); | ||
| assert.isNumber(result.clientLLMDatachannelResponseTime); | ||
| assert.isNumber(result.clientLLMWebSocketConnectTime); | ||
| assert.isAtLeast(result.clientLLMDatachannelResponseTime, 0); | ||
|
Collaborator
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. this check is not good enough, we can control time progression with
Contributor
Author
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. done |
||
| assert.isAtLeast(result.clientLLMWebSocketConnectTime, 0); | ||
| }); | ||
|
|
||
| it('returns undefined when locusUrl is empty', async () => { | ||
| llmService.register = sinon.stub().resolves(); | ||
|
|
||
| const result = await llmService.registerAndConnect('', datachannelUrl, undefined); | ||
|
|
||
| assert.isUndefined(result); | ||
| }); | ||
| }); | ||
|
|
||
| describe('#getWebSocketUrl', () => { | ||
| it('returns the websocket URL for default session', () => { | ||
| llmService.connections.set('llm-default-session', { | ||
| webSocketUrl: 'wss://test.example.com/ws', | ||
| }); | ||
|
|
||
| assert.equal(llmService.getWebSocketUrl(), 'wss://test.example.com/ws'); | ||
| }); | ||
|
|
||
| it('returns undefined when no connection exists', () => { | ||
| llmService.connections.clear(); | ||
|
|
||
| assert.isUndefined(llmService.getWebSocketUrl()); | ||
| }); | ||
|
|
||
| it('returns the websocket URL for custom session', () => { | ||
| llmService.connections.set('custom-session', { | ||
| webSocketUrl: 'wss://custom.example.com/ws', | ||
| }); | ||
|
|
||
| assert.equal(llmService.getWebSocketUrl('custom-session'), 'wss://custom.example.com/ws'); | ||
| }); | ||
| }); | ||
|
|
||
| }); | ||
| }); | ||
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.
If the datachannel registration succeeds but the websocket
connect()rejects, this method rejects before returning the already-measuredclientLLMDatachannelResponseTime; the caller’s catch path then reports both LLM connect latencies as0. In websocket-failure scenarios this corrupts the newclient.llm.connect.responsefailure telemetry by losing the registration response time that was actually observed.Useful? React with 👍 / 👎.