WebPagetest Forums
Test ID in UA? - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: WebPagetest (/forumdisplay.php?fid=7)
+--- Forum: Feature Suggestions (/forumdisplay.php?fid=9)
+--- Thread: Test ID in UA? (/showthread.php?tid=14152)



Test ID in UA? - rviscomi - 01-07-2016 07:26 AM

So I know that test agents append PTST to the UA, which is useful for identifying WPT in server logs. I wonder if it's feasible to do something along those lines to give servers a backlink to the test results. What I had in mind was if the test agents knew the ID and run number of the test, that data could be included in the UA as well. A link to the corresponding test results page could be reconstructed from the server logs.

My use case is a monitoring service that schedules tests automatically using the API. Instead of getting the ID from the API and querying for the results, I'd like to use my existing RUM pipeline to log the perf metrics. So if the UA of the test machine was logged by the RUM service, conceivably I'd be able to get back to the WPT test results page for any particular test run.

There are actually three pieces of information needed to reconstruct the test results URL: test ID, run number, and first/repeat view.

So for example we could append the following to a UA string: "PTST/160106_ZT_13T3-r:3-c:0" which would correspond with these results: http://www.webpagetest.org/result/160106_ZT_13T3/3/details/

This could either be added by default just like PTST or enabled in the custom UA setting as a template value, like "PTST/{{test_id}}-r:{{run_number}}-c:{{repeat_view}}". The test agent would substitute the placeholders accordingly. I think it'd be easier to do by default, but the template option adds more versatility.

WDYT?

Filed https://github.com/WPO-Foundation/webpagetest/issues/548


RE: Test ID in UA? - pmeenan - 01-08-2016 02:26 AM

Done. It is api-only and you specify how you want the string formatted.

i.e. something like keepua=1&appendua=PTST/%TESTID%-r:%RUN%-c:%CACHED% would give you the UA string above (properly urlencoded when submitting). The keepua=1 would be needed if you want to modify the PTST string. If you just want to append something else you can leave that there.


RE: Test ID in UA? - rviscomi - 01-08-2016 06:28 AM

Thanks for the quick fix! I sent https://github.com/WPO-Foundation/webpagetest/pull/549 to add support for these params on the home page.