sitespeedio / sitespeed.io

sitespeed.io is an open-source tool for comprehensive web performance analysis, enabling you to test, monitor, and optimize your website’s speed using real browsers in various environments.
https://www.sitespeed.io/
MIT License
4.73k stars 601 forks source link

Option to have multiple group names when testing different pages #2958

Open shanep2300 opened 4 years ago

shanep2300 commented 4 years ago

The group will always use the domain of the url, for example in the SpeedIndex measurement.

http\://www.google.com http\://www.google.com/test1 http\://www.google.com/test2/foo

Group value for all three will be www_gartner_com

I would like an option to separate the group name if testing multiple pages from the same domain and not want the metrics lumped in one domain. Above urls will now be named as:

www_gartner_com www_gartner_com2 www_gartner_com3

or add the path and convert each / as _?

www_gartner_com www_gartner_com_test1 www_gartner_com_test2_foo

Maybe this is already possible and I misread the configurations...

soulgalore commented 4 years ago

Hi @shanep2300 no its not possible today. We have prepared for it at the beginning, but not implemented everything so not sure about the status right now (like how much work would be to implement). I think (if everything is correct in the code) the hardest part is to come up with a way of setting the group. Today we can set a alias with --urlAlias, we could probably do something similar.

Another way could be to just set the group per time you run sitspeed.io so instead of picking up the group per URL, its set for all the URLs you test in one run. That would surely be the easiest way to implement it. Would that work for you?

shanep2300 commented 4 years ago

Hi @soulgalore I think adding a --groupAlias or --domainAlias flag would be awesome in terms of control. Here's our current scenario if it'll help make a better decision for you.

We're testing 8 different URLs and comparing them against each other; 2 of which are from the same domain. The thing with the 2 domains that are the same is that they are both different "applications", hence why we don't want them grouped together.

soulgalore commented 4 years ago

I see, and you need the grouping for Graphite/InfluxDB or how do you use it?

shanep2300 commented 4 years ago

If possible, for both. Graphite the priority. We’re playing around with the 2 databases.

soulgalore commented 4 years ago

Yep I will fix it for both. So simplest for me is to add support to set it per test, that means you need to split your testing into a couple of tests, would that work for your use case?

shanep2300 commented 4 years ago

We're doing continuous run. This is what you mean by separate tests correct? Each location and URL is ran one by one.

# Locations Config
# Dulles_Thinkpad
LOC[0]="--webpagetest.location \"Dulles_Thinkpad:Chrome\" --webpagetest.connectivity \"cable\""

# Dulles Android Mobile
LOC[1]="--webpagetest.location \"Dulles_MotoG4:Moto G4 - Chrome\" --webpagetest.connectivity \"LTE\" --mobile --browsertime.connectivity.profile \"3g\""

# Singapore Desktop
LOC[2]="--webpagetest.location \"ec2-ap-southeast-1:Chrome\" --webpagetest.connectivity \"cable\""

#Example URLS to be tested
URLS[0]="\".bloomberg.com\" https://www.bloomberg.com"
URLS[1]="\".bcg.com\" https://www.bcg.com"
URLS[2]="\".apple.com\" https://www.apple.com"

for url in "${URLS[@]}"
do
  for location in "${LOC[@]}"
  do
    echo $location
    str="docker-compose run sitespeed.io $PLUGINS $WPT_CONFIG $location $GRAPHITE_CONFIG $BROWSERTIME_CONFIG $INFLUX_CONFIG --firstParty $url --plugins.list --summary-detail"
    echo $str
    output=$(eval "$str")
    echo "$output"
  done
done
soulgalore commented 4 years ago

I meant running it once per group. So start sitespeed.io three times, and group the URLs per group, and that looks like it gonna work for you.

shanep2300 commented 4 years ago

@soulgalore Thank you so much for the quick response to this! Seems to me that alias is working. I did run into some issues though with graphite.

aliasByNode($base.$path.pageSummary.*.*.webpagetest.$location.$connectivity.data.median.$view.SpeedIndex, 3, 11)
aliasSub(aliasByNode($base.$path.pageSummary.*.*.webpagetest.$location.$connectivity.data.median.$view.loadTime, 3, 11), 'loadTime', 'DomComplete')
aliasSub(aliasByNode($base.$path.pageSummary.*.*.webpagetest.$location.$connectivity.data.median.$view.fullyLoaded, 3, 11),'fullyLoaded','Webpage Response')
aliasByNode($base.$path.pageSummary.*.*.webpagetest.$location.$connectivity.data.median.$view.TTFB, 3, 11)
aliasByNode($base.$path.pageSummary.*.*.webpagetest.$location.$connectivity.data.median.$view.visualComplete90, 3, 11)

These are the queries I'm using to compare the 8 or so urls with each other. Fortunately, SpeedIndex works. Unfortunately, loadTime, fullyLoaded, and TTFB have duplicate key errors in Grafana.

I'm VERY new to graphite so I'm not sure if it's a graphite thing or something with the groupAlias. If I look in my whisper folder, the separate group was created. Does it still have to do with the domain being the same somewhere along Sitespeeds code or is the query incorrect?