Allow blob statistics so developer can build service around it?


  • This may be a odd question but I believe it will be very helpful to both developers and Azure.

    How can we get the download counter for each blob? Just to take this as a concrete example:

    Suppose you build 100 Websites (100 your customers in this case), and want to use Azure storage blobs for all the images and videos. You plan to charge your customers (each website) by traffic, like, how many times each of his images/videos are downloaded, you need a access / download counter for each blob (each file). If Azure blob support the download counter, it will be much easier to do.

    Any comment? (-- yes, there are hacks trying to mimic this, such as use SAS key for each access, or use a pass through web service for the counting, or use a different Azure account / subscription, etc., but won't it nice if blob simply has that download counter? Did I miss anything there?)


    Monday, January 25, 2016 10:50 PM

All replies

  • @h2016

    You would most definitely want to put this behind a service and do the logic work here in your application code. It really isn't a hack, it is the proper way to do it for several reasons. With this method you control access, track and manage, can add logic to charge for the file or give gold stars/badges to uploaders for most downloaded file or milestone downloads. You could also use Storage Analytics to track usage on your account including blob requests etc..

    I know I know, in the end it is not int x = myblob.GetDownloadCount();

    Hope it helps though,


    Tuesday, January 26, 2016 1:07 AM
  • Thanks!

    Thinking from another point of view: majority of the images/videos on web are kind of "public", like the site's logo, background, icons, product images, etc.. But they still need a counter to know the traffic volume (not page view, it is more of egress traffic) will be really useful in this case (I actually think this will be a major use case, not a minor case). Having another service as you mentioned makes more sense if the images/videos are private so certain controls are needed.

    PS 1: in case if anyone wonder why page view won't work to calculate the traffic: users, including search engines, can simply point to the images or videos, without hitting the page. So page view is very different from the actual traffic.

    PS 2: Azure charges its customers by the blob's traffic, so I guess maybe each blob's traffic information is already saved somewhere ...

    PS 3: if I recall it, Storage Analytics does not track per blob, it is the total aggregation of some given timeframe for all blobs, right?

    • Edited by h2016 Tuesday, January 26, 2016 5:59 AM
    Tuesday, January 26, 2016 5:58 AM