-
Notifications
You must be signed in to change notification settings - Fork 21
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
Fix performance custom metrics #134
Conversation
Thanks @tunetheweb Do you know why some metrics are wrapped into JSON.stringify and others not? |
Some of the custom metrics call Mostly it doesn't matter, and Web Page Test will handle both and However, one place it CAN matter is if some results aren't included in Probably we should standardise this and update all the custom metrics to |
Updated PR to add the comment to explain why. |
Custom metrics for https://almanac.httparchive.org/en/2022/WPT test run results: http://webpagetest.httparchive.org/results.php?test=240619_7D_4 {} Custom metrics for https://example.com/WPT test run results: http://webpagetest.httparchive.org/results.php?test=240619_17_5 {} Custom metrics for https://exploreti.com/WPT test run results: http://webpagetest.httparchive.org/results.php?test=240619_09_6 {} |
@tunetheweb so maybe we rather wrap performance CM (and other metrics that have the same issue) in |
Yeah we probably should. But I think we'd still want to keep this change in anyway incase a future metric was added without it, or some of the non-JSON custom metrics can also return "invalid JSON" (and converting those to JSON is a bigger job with bigger implications). Plus it's more efficient (calls So not super urgent IMHO once we merge this. |
I think this PR makes these tests more similar to the events processing logic. |
Not sure what you mean? And if you are saying that was a good thing or a bad thing 😀 |
It's good. Here is actual pipeline code which is similar to your update. |
Oh very similar! Nice find. OK merging this. |
Noticed performance custom metrics were not getting logged in our CI tests.
This was because the current logic was as follows:
That says only log metrics we're interested in if
JSON.parse
succeeds.However, many metrics are returned as Objects rather than JSON and so
JSON.parse
fails (as it doesn't need to be parsed as it'a already an object!), and others aren't valid JSON as just plain strings. In both cases theif (metrics_to_log.includes(metric_name)) {
part isn't called and they are excluded from the output.This PR refactors to move code out of the
try
to log in both cases.Test websites: