Feat/231 sdk feature usage analytics collector#344
Merged
Kingsman-99 merged 2 commits intoJun 26, 2026
Merged
Conversation
|
@adefemiesther1-debug Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #231
Overview
This PR introduces an opt-in, privacy-preserving client interface analytics telemetry framework inside src/usageAnalytics.ts. This subsystem provides product development insight by counting which SDK interface methods are actively leveraged by integrating platforms. It functions completely independently of network-level RPC tracing, using memory-efficient runtime proxies to capture call statistics with zero argument exposure.
Changes
Branch Infrastructure: Created and isolated tracking workspace within feat/231-sdk-feature-usage-analytics-collector.
New Analytics Engine (src/usageAnalytics.ts):
Implemented a Proxy-driven decorator pattern that wraps standard client modules to catch functional access logs seamlessly.
Added configuration validation layers enforcing a strict disabled-by-default execution boundary (config.usageAnalytics = true).
Structured an internal integer-only ledger map tracking method names while explicitly avoiding parameter interception or PII storage.
Batching Lifecycle Control:
Developed an asynchronous flush() dispatcher that unloads local maps over a configurable POST destination before clearing memory buffers.
Configured automated heartbeat loops to regularly purge accumulated data points on user-defined time frequencies.
Automated Unit Testing Suite Added (src/tests/usageAnalytics.test.ts):
Verified opt-in compliance, counting precision, multi-method aggregation safety, and immediate state evacuation following flush completion.
Performance & Privacy Guarantees
Privacy Isolation: The proxy layer possesses no reference hooks tracking function arguments. It records the string literal method name exclusively, protecting user data at the edge.
Low-Overhead Traps: Leverages standard object reference interceptors that evaluate instantly in-memory, avoiding blocking bottlenecks or execution lag on hot client transaction paths.
Verification & Testing Checklist
[x] Type Safety Verification: Confirmed full workspace configurations compile smoothly with zero TypeScript compilation faults.
[x] Linter Compliance: Cleared code styling checks via npm run lint to fulfill repository formatting criteria.
[x] Conventional Commit Integrity: Grouped file updates into an atomic conventional commit framework and pushed directly to origin.