-
Notifications
You must be signed in to change notification settings - Fork 195
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
Update messaging for measuring message delay between App and Hub #2499
base: main
Are you sure you want to change the base?
Conversation
61059e3
to
fe1cd61
Compare
if (callbackInformation && message.timestamp) { | ||
handleHostToAppPerformanceMetrics({ | ||
actionName: callbackInformation.name, | ||
messageDelay: getCurrentTimestamp() - message.timestamp, |
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.
from you local testing, can you please add some data points for values recorded both for two-way and one-way messages
@@ -46,6 +48,7 @@ export interface SerializedMessageResponse { | |||
uuidAsString?: string; | |||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | |||
args?: any[]; | |||
timestamp?: number; |
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.
why wouldn't this have monotonicTimestamp?
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.
This is only for the response that the Hosts sends to Teams JS. For requests, as Teams JS was already using the timestamp
field we needed to create a new one for backwards compatibiltiy. For responses, we can use timestamp
instead as it is a completely new field...
If you find it more homogeneous, we can still call it monotonicTimestamp
for the response to comply with the field name in the request. But it wouldn't be necessary.
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.
yes, pls use the same name to minimize confusion
0ad25a2
to
114df12
Compare
With this new timestamped messaged, the host can properly compare and evaluate how much time the request got delayed to an issue on a busy event loop.
This new handler will allow any application developer to register a function for analyzing or storing performance metrics related to latencies due to a message delay sending the response back from the host to the app.
The old field will be preserved with backwards compatibility with previous versions that still consume this field.
All the telemetry related code is added to the telemetry module to avoid cluttering the communication layer with nuances about telemetry.
7b23b3f
to
2c4236f
Compare
Description
This pull request has two purposes:
For the second purpose, with this PR, an app developer can register a function that receives the message delays per function call as soon as a response is received from the host so they can log it or store it in their own telemetry. As app developers do not have information about the internal message IDs, the handler gets passed information about the callback that is resolving so they can approximately pinpoint which call had that message delay.
Note: it was decided to not expose message IDs as it is a really big architectural change in the codebase and the value of exposing them to app developers would be really small in comparison to the change.
Main changes in the PR:
Date.now()
to useperformance.now() + performance.timeOrigin
.Validation
Validation performed:
Unit Tests added:
Yes
End-to-end tests added:
No
Additional Requirements
Change file added:
Yes
Next/remaining steps:
A following PR in the host SDK will be done in order to properly measure the App to Host message delay with the changes added in this pull request.