aws-observability / aws-rum-web

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

chore: migrate EventCache.canRecord to SessionManager.shouldSample #504

Open williazz opened 4 months ago

williazz commented 4 months ago

Purpose

Makes the session event counting logic more extensible for #505

Problem

SessionManager should decide if the sessionEventCount is under the sessionEventLimit, not EventCache. This PR gives that responsibility to SessionManager by removing EventCache.canRecord and implementing SessionManager.shouldSample, making it extensible to check for sessionEventLimitOverride(s) (#480).


Engineering plan for #480 summarized here https://github.com/aws-observability/aws-rum-web/issues/480#issuecomment-1933212088


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