aws-observability / aws-rum-web

Amazon CloudWatch RUM Web Client
Apache License 2.0
114 stars 65 forks source link

fix: Record 0 for headerSize if transferSize is 0 #496

Closed limhjgrace closed 5 months ago

limhjgrace commented 5 months ago

The navigation event schema validates that the transferSize field is non-negative. The transferSize field is currently calculated by: headerSize - encodedBodySize. However, headerSize is 0 if it the resource was instantaneously retrieved from a cache. This results in a negative headerSize and thus, an invalid event that is dropped by CWR DP.

This PR adds a check to ensure transferSize is greater than 0 when calculating the headerSize.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.