-
Notifications
You must be signed in to change notification settings - Fork 134
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
feat(rum): report INP metric #1462
Conversation
8995717
to
88874ad
Compare
hi @v1v, it seems our test steps are failing with this error: Looking for info I found that might be related with Docker 7.0.0, link to the changelog and a link to a conversation that a few people are having: docker/docker-py#3194 Do you know what can we do to fix this? |
As far as I see Let me see if I can figure out how to solve this |
.ci/scripts/test.sh
Outdated
# As long as there are issues with the ssl lets use 6.1.3 | ||
# see https://github.com/docker/docker-py/issues/3194 | ||
pip uninstall docker | ||
pip install docker==6.1.3 |
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.
@v1v amazing, thank you for making this change so fast! for what I'm seeing it works perfectly 🎉
bf05a00
to
5c1bc11
Compare
Makes sure that a transaction ended while the page was becoming hidden | ||
it's not discarded for that very same reason. | ||
*/ | ||
endPageHidden(endTime) { |
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.
I created this function because while I was doing the last exploratory testing session I spotted a bug:
The logic where we detect if the website becomes hidden in order to end the ongoing transaction, had a race condition:
- transaction.end()
- update lastHiddenStart
unfortunately, the code where we check if a transaction should be discarded because "the page was hidden during the transaction" doesn't happen in a sync way in transaction.end(), it happens after executing a javascript Promise.
So, assuming that calling transaction.end()
in that part of the code was a synchronous process was wrong. It was updating the lastHiddenStart before doing the end transaction check (even if the end was invoked before)
Fortunately, this was not affecting the page-load transaction, I only reproduced the described behaviour with the INP transaction and with click transactions. (not all the time, it depended on who was "winning" the race)
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.
It was updating the lastHiddenStart before doing the end transaction check (even if the end was invoked before)
This seems wrong, we update the lastHiddenStart
on Queue:Add event which should happen post the transaction was ended in async way
.
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.
We discussed this offline and planned to add another event transaction:skipped
to update the last hidden start time.
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 the related commit df7423d 🚀
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.
Great job @devcorpio 🎉, Thanks a ton for adding in lots of details around the core INP calculation logic and also adding relevant links to the spec where necessary. It was really nice to see them side by side and also understanding the spec/browser reporting.
packages/rum-core/src/performance-monitoring/metrics/inp/index.js
Outdated
Show resolved
Hide resolved
packages/rum-core/src/performance-monitoring/metrics/inp/process.js
Outdated
Show resolved
Hide resolved
packages/rum-core/src/performance-monitoring/metrics/inp/process.js
Outdated
Show resolved
Hide resolved
packages/rum-core/src/performance-monitoring/metrics/inp/process.js
Outdated
Show resolved
Hide resolved
packages/rum-core/src/performance-monitoring/metrics/inp/process.js
Outdated
Show resolved
Hide resolved
packages/rum-core/src/performance-monitoring/metrics/inp/process.js
Outdated
Show resolved
Hide resolved
packages/rum-core/test/performance-monitoring/metrics/inp/report.spec.js
Show resolved
Hide resolved
665b736
to
e1be333
Compare
582edc1
to
55aca81
Compare
55aca81
to
38f3a14
Compare
9ca240d
to
92f455b
Compare
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.
LGTM 🎉 , Added small suggestions. Nothing blocking.
reportInp(transactionService) | ||
const inpTr = reportInp(transactionService) | ||
// we don't want to flush the queue for every transaction that is ended when page becomes hidden | ||
// and given the async nature of the ending process of transactions |
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.
nit: might reword it as transaction ends are scheduled async as microtasks(promise), so we are coordinating the flushing process
@@ -110,6 +110,7 @@ const TRANSACTION_END = 'transaction:end' | |||
const CONFIG_CHANGE = 'config:change' | |||
const QUEUE_FLUSH = 'queue:flush' | |||
const QUEUE_ADD_TRANSACTION = 'queue:add_transaction' | |||
const TRANSACTION_DISCARD = 'transaction:discard' |
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.
should we rename it as trasaction:ignore/skip ? mainly suggesting because ignored also aligns with our config settings.
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, it makes sense 🚀
Summary
Related to #1293
From now on, the RUM agent will start reporting the INP metric.
For further details, please see the code which is heavily documented given the experimental nature of this metric.
Screenshot where we can see the INP metric on the User Experience page: