javascript icon indicating copy to clipboard operation
javascript copied to clipboard

feat(shared): Introduce client-side caching for telemetry events

Open LauraBeatris opened this issue 9 months ago • 1 comments

Description

Currently blocking SDK-1672 (https://github.com/clerk/javascript/pull/3257)

Introduces client-side caching for telemetry events. This prevents event flooding in frequently executed code paths, such as for React hooks or components.


TODO:

  • [ ] Manual tests on running applications

Checklist

  • [X] npm test runs as expected.
  • [X] npm run build runs as expected.
  • [ ] (If applicable) JSDoc comments have been added or updated for any package exports
  • [ ] (If applicable) Documentation has been updated

Type of change

  • [ ] 🐛 Bug fix
  • [X] 🌟 New feature
  • [ ] 🔨 Breaking change
  • [ ] 📖 Refactoring / dependency upgrade / documentation
  • [ ] other:

LauraBeatris avatar Apr 25 '24 17:04 LauraBeatris

🦋 Changeset detected

Latest commit: 43d94bc373bb8fffe2ad91106eae6c724ad15c60

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@clerk/shared Patch
@clerk/backend Patch
@clerk/chrome-extension Patch
@clerk/clerk-js Patch
@clerk/clerk-expo Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
gatsby-plugin-clerk Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Apr 25 '24 17:04 changeset-bot[bot]

This PR also enables #3279 (adding telemetry to clerk-elements)

panteliselef avatar Apr 29 '24 14:04 panteliselef

Here's is how the cache is going to look like from the local storage - a map between unit event keys and their TTL in milliseconds:

CleanShot 2024-04-29 at 13 02 13

LauraBeatris avatar Apr 29 '24 16:04 LauraBeatris

Re-opening it on https://github.com/clerk/javascript/pull/3287, this branch is from a forked repo so I think this is the cause of not allowing to run integration tests.

LauraBeatris avatar Apr 29 '24 19:04 LauraBeatris