aws-observability / aws-rum-web

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

feat: capture all W3C fields in ResourceEvents #489

Closed williazz closed 7 months ago

williazz commented 8 months ago

Update the ResourceEvent schema to exactly match PerformanceResourceTiming in aws-rum-web 2.0. I also cleaned up some tech debt, as highlighted in the comments.

  1. All durations are converted into start and end timestamps (excluding overall duration)
  2. No experimental fields are included
  3. Non-W3C fields such as fileType and targetUrl are dropped

In addition:

  1. PerformanceResourceTimingEvents are sampled by first N FIFO, instead of random sampling. This also removes a bug in the random sampling logic when eventLimit is large.
  2. Derive fileType from the initiatorType only, not the file extension.
williazz commented 8 months ago

Final touches:

  1. Remove version
  2. Add enum for initiatorType

Tech debt:

  1. Schema is too strict and will not accept new values that PerformanceAPI may put out in the future for the fields we are expecting. Only relevant for initiatorType. See https://github.com/aws-observability/aws-rum-web/pull/494#issuecomment-1896993094
  2. isPutRumEvents() bug, see https://github.com/aws-observability/aws-rum-web/pull/489#discussion_r1456621250