HTTPArchive / legacy.httparchive.org

<<THIS REPOSITORY IS DEPRECATED>> The HTTP Archive provides information about website performance such as # of HTTP requests, use of gzip, and amount of JavaScript. This information is recorded over time revealing trends in how the Internet is performing. Built using Open Source software, the code and data are available to everyone allowing researchers large and small to work from a common base.
https://legacy.httparchive.org
Other
328 stars 84 forks source link

Custom metrics for Media #170

Closed smatei closed 4 years ago

smatei commented 4 years ago

@rviscomi, here is another custom metric for the 2020 media chapter.

source/img with sizes attribute expensive sql with regexp

I combined both conditions in the same metric, just as in the original sql. They could also be split metrics. Also we could add an empty attribute condition - img[sizes]:not([sizes=""]). Please advise.

As for the tests:

img sizes

source sizes

no img/source sizes

Tiggerito commented 4 years ago

I'm in the SEO chapter and will be adding the gathering of img tag info. So far I'm checking alt, loading, width and height attributes. My plan is to place all the info in an 'image' property for the response. It could be worth combining this image based effort?

tunetheweb commented 4 years ago

aria-label and aria-labelledby attributes might also be interesting as alternatives to alt attributes.

smatei commented 4 years ago

I'm in the SEO chapter and will be adding the gathering of img tag info. So far I'm checking alt, loading, width and height attributes. My plan is to place all the info in an 'image' property for the response. It could be worth combining this image based effort?

@Tiggerito Yes, we could group them together under "image". But, I am new here, it is not my call. I will wait for further instructions from the code reviewers.

Tiggerito commented 4 years ago

@Tiggerito Yes, we could group them together under "image". But, I am new here, it is not my call. I will wait for further instructions from the code reviewers.

Don't worry, I'm also learning on the fly. Lets just keep in contact about what we need, and try to pull things together when we can.

You can see my images code here

https://github.com/Tiggerito/legacy.httparchive.org/blob/patch-1/custom_metrics/almanac.js

You used the term image not images for the property. You are probably right.

smatei commented 4 years ago

I have changed both custom metrics to return length, renamed them with num_ and updated tests for all combinations:

"num_picture_img":0,"num_image_sizes":0

"num_picture_img":0,"num_image_sizes":1

"num_picture_img":1,"num_image_sizes":0

"num_picture_img":1,"num_image_sizes":2

Tiggerito commented 4 years ago

I've added a pull request from the SEO team for our image property. I think it may be tricky to consolidate things at this point, and we are on a tight schedule.

Maybe once my code is merged you can consider folding your data into the image property. That way you know if your own property has moved and can adjust your SQL to match. I'd say not urgent, as it's just about neatness.

I've also noticed quite a mix of property naming conventions, and am not sure which one is best. It's always confusing when we are coding in multiple languages that follow different rules. Again, not important with this tight schedule. Most important is that we get the data needed.

smatei commented 4 years ago

I am taking my chance with

Video player attributes

Tests:

"video-nodes-attributes":["controls","width"]

"video-nodes-attributes":[]

smatei commented 4 years ago

We need srcset w/wo sizes for Media.

I have added some metrics:

"num_srcset_all":6,"num_srcset_sizes":0

"num_srcset_all":1,"num_srcset_sizes":1

"num_srcset_all":0,"num_srcset_sizes":0

smatei commented 4 years ago

We need srcset with x/w descriptors custom metrics in Media

Tests:

"num_srcset_descriptor_x":2,"num_srcset_descriptor_w":2

num_srcset_descriptor_x":0,"num_srcset_descriptor_w":0

smatei commented 4 years ago

We need the number of scrset candidates for Media

Tests:

"num_srcset_candidates":2

"num_srcset_candidates":0

smatei commented 4 years ago

We need picture format switching for Media

Tests

"picture_formats":["image/webp"]

"picture_formats":[]

smatei commented 4 years ago

We need to count the picture tags that use min-resolution in Media

Tests:

"num_picture_using_min_resolution":52

"num_picture_using_min_resolution":0

smatei commented 4 years ago

I have added a metric for counting pictures with device orientation for Media

Tests:

I could not find a live url for which that metric would return non 0 values, please help.

For 0 value - "num_picture_using_orientation":0

smatei commented 4 years ago

I have added a custom metric for counting video nodes in Media

Tests:

"num_video_nodes":2

"num_video_nodes":0

rviscomi commented 4 years ago

@smatei thanks for your changes. Reassign back to me when it's ready for review. 👍

smatei commented 4 years ago

added one more metric for count srcset candidate list size in img only cases (i.e. that are NOT in picture )

Tests:

"num_img_not_in_picture_srcset_candidates":2

"num_img_not_in_picture_srcset_candidates":0