wordpress-mobile / WordPress-iOS

WordPress for iOS - Official repository
http://ios.wordpress.org/
GNU General Public License v2.0
3.66k stars 1.11k forks source link

Tracks: incorrect value in bytes for "editor_photo_added" #11408

Open designsimply opened 5 years ago

designsimply commented 5 years ago

Steps to reproduce:

  1. Go to Me > Help & Support and turn on "Extra Debug".
  2. Go to any site and upload an image (either in a post or via Media).
  3. Go to Me > Help & Support > Activity Logs, find "Tracked: editor_photo_added", and note the value for bytes.
  4. On a computer, go to Media and find the same image and check it's size (you may need to download the image).

Result: the bytes value is being tracked incorrectly.

Example image: https://madefortesting426.files.wordpress.com/2019/04/img_2324.jpg

Example Tracks event noted in the app logs:

2019-04-03 12:34:40:934 <img draggable="false" class="emoji" alt="🔵" src="https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/svg/1f535.svg"> Tracked: editor_photo_added, properties: {
    "blog_id" = 61195978;
    bytes = 67417088;
    ext = jpeg;
    "media_origin" = "inline_picker";
    megapixels = 0;
    mime = "image/jpeg";
    via = "local_library";
}

67417088 bytes = 67.4 MB but the image is only 61 KB.

(internal reference: p4a5px-2mM-p2#comment-9628)

Noteworthy:

Apple gives the value in bytes. That is fine.
We store it as bytes, that is also fine.
But before sending the Tracks event, we mistakenly multiply that value by 1024. So the tracked event has the incorrect value.

h/t @etoledom and @aerych for help sorting this out—we confirmed it's not causing image upload failures due to large file sizes but also still should fix the Tracks event so it's correct.

stale[bot] commented 4 years ago

This issue has been marked as stale because:

Please comment with an update if you believe this issue is still valid or if it can be closed. This issue will also be reviewed for validity and priority (cc @designsimply).

reginabally commented 2 years ago

I encountered this when I was troubleshooting a video upload issue: 4635051-zd-woothemes

The log shows 38903182336 bytes and 246318345216 bytes for the media files, but the actual sizes are 37MB and 241MB respectively.