Description
Is your feature request related to a problem? Please describe.
I am using the BlockBlobClient.uploadData()
call to upload several files from our users' browser to blob storage. I'm having a difficult time correlating onProgress
events with the browser native PerformanceResourceTiming
entries exposed by the browser Performance API. I want to use this information to:
- Display real-time throughput to the user.
- Display a progress bar for completion percentage.
- Record high precision traces/logs for individual block uploads in our observability platform (Datadog, but I don't think that matters).
The problems I'm encountering are:
- The browser native
PerformanceResourceTiming
API has the timing data (start time and duration), but not the block size due to the default browser security and privacy policies. - The
onProgress
event has the block size but not the timing data (start time and duration).
Describe the solution you'd like
I can think of 2 possible ways to fix this:
- Implement support for the Timing-Allow-Origin HTTP header within the Azure blob backend service itself. This tells the browser to un-hide the detailed performance metrics.
- Add the blockid to the
TransferProgressEvent
. This will allow me to matchPerformanceResourceTiming
entries withonProgress
events.
Personally I think option 1 is far superior since it enables much more detailed performance information. And I believe that most frontend observability platforms ingest this data already.
Describe alternatives you've considered
I've considered implementing a proxy, but really that doesn't make sense. It's complex, costs a lot, and increases the maintenance burden. For us developers, adding the magic "Timing-Allow-Origin" header to the storage account unlocks a ton of observability with what seems to me an appropriate amount of cost and work.
Additional context
Security limitations of the browser PerformanceResourceTiming
API
Unlock more detailed performance metrics with Timing-Allow-Origin
HTTP header
Similar header for CORS that Azure Storage Accounts already natively support