javascript-client-sdk's People
Forkers
yshrsmzjavascript-client-sdk's Issues
chore: add the sdkVersion in the requests
To help monitor the APIs by sdkVersion
, we need to add it to the GetEvaluations
and RegisterEvents
APIs.
Things to do
- Add the
sdkVersion
in the API request.
GetEvaluations
RegisterEvents
perf: improve the API response time
Summary
We are improving the evaluation process on the server to evaluate only the flags that have been changed.
This will improve the load on the server and the response time since it will only return the flags that have been changed.
Currently, when a flag changes on the server, it evaluates all flags again and sends the latest evaluations to the client SDK.
The SDK checks the response and does nothing if the response is empty. Otherwise, it deletes all the data in the local storage and saves the latest evaluations.
Implementation
When the SDK is initialized
1- Change the featureTag
setting to be optional in the BKTConfig
2- Save the featureTag
in the localStorage
if it is configured in the BKTConfig
3- Clear the userEvaluationsID
in the localStorage
if the featureTag
changes
When sending requests
The following new fields will be added to get_evaluations
request.
- evaluatedAt: the last time the user was evaluated. The server will return in the get_evaluations response (
UserEvaluations.CreatedAt
), and it must be saved in the client - userAttributesUpdated: when the user attributes change via the
customAttributes
interface, the userAttributesUpdated field must be set to true in the next request
When getting the response (Update conditions)
The server will return the new following fields in the response.
- forceUpdate: a boolean that tells the SDK to delete all the current data and save the latest evaluations from the response
- archivedFeatureIds: a list of feature flag ids that were archived on the admin console. All those feature flags must be deleted from the local storage.
forceUpdate is True
1- Delete all the evaluations from local storage, and save the latest evaluations from the response into the local storage
2- Save the UserEvaluations.CreatedAt
in the response as evaluatedAt
in the localStorage
forceUpdate is false
1- Check the evaluation list in the response and upsert them in the localStorage
if the list is not empty
2- Check the archivedFeatureIds
list and delete them from the localStorage
if is not empty
3- Save the UserEvaluations.CreatedAt
in the response as evaluatedAt
in the localStorage
chore: change not to save the same metrics events
When the user uses the application offline, it will keep creating new error metrics events.
We could check the network status, but to do the same checking in Android, we would need permission from the user, which is not a good practice as an SDK, and it would create an inconsistency between other client SDKs.
For metrics events, perhaps we could upsert the events in the local storage or check before saving them so that it won't create events unnecessarily.
chore: update errors metrics report
TODO
- Track the 3xx status code as "RedirectRequestException".
- add
response_code
via labels
- add
- Track the 413 status code as "PayloadTooLargeException"
- 408 errors, and we should handle it as a timeout error.
- Make iOS error handling consistent with Android SDK. Android handles more error code than iOS SDK. That is ( 405, 502, 504)
- Implement adding more information via labels for Unknown errors, so we don't spend too much time debugging.
- Add
error_message
andresponse_code
to the ErrorMetricsEvent labels
- Add
Note
the current metrics on the server are the following.
https://github.com/bucketeer-io/bucketeer/blob/main/proto/event/client/event.proto#L99-L187
chore: add the current timeout setting in the TimeoutErrorMetricsEvent
Because the developer can manually configure the timeout in the initialize interface, the server doesn't know if the request got the timeout error using the default 30 seconds or user setting. To detect it on the server, we need to pass the current setting used in the failed request.
Things to do
- Pass the current timeout setting in seconds via labels.
labels: {
tag: featureTag,
timeout: "5",
},
Action Required: Fix Renovate Configuration
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Location: renovate.json
Error type: Invalid JSON (parsing failed)
Message: Syntax error: expecting end of expression or separator near dule": ["a
Dependency Dashboard
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
Repository problems
These problems occurred while renovating this repository. View logs.
- WARN: File contents are invalid JSON but parse using JSON5. Support for this will be removed in a future release so please change to a support .json5 file name or ensure correct JSON syntax.
Awaiting Schedule
These updates are awaiting their schedule. Click on a checkbox to get an update now.
- build(deps): update all non-major dependencies (
@types/node
,benc-uk/workflow-dispatch
,happy-dom
,msw
,pnpm
,typescript
) - test(deps): update vitest (
@vitest/browser
,@vitest/utils
,vitest
,webdriverio
)
Open
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
- build(deps): update all major dependencies (major) (
@types/node
,@typescript-eslint/eslint-plugin
,@typescript-eslint/parser
,google-github-actions/release-please-action
,msw
,node
,unbuild
,vite
) - chore(deps): lock file maintenance
Detected dependencies
github-actions
.github/workflows/build.yml
actions/checkout v4
pnpm/action-setup v2
actions/setup-node v4
.github/workflows/e2e.yml
actions/checkout v4
pnpm/action-setup v2
actions/setup-node v4
.github/workflows/pr-title-validation.yml
amannn/action-semantic-pull-request v5
.github/workflows/publish-snapshot.yml
actions/checkout v4
pnpm/action-setup v2
actions/setup-node v4
.github/workflows/release-please.yml
google-github-actions/release-please-action v3.7.13
actions/checkout v4
pnpm/action-setup v2
actions/setup-node v4
.github/workflows/update-changelog-docs-page.yml
actions/checkout v4
actions/checkout v4
benc-uk/workflow-dispatch v1.2.2@798e70c97009500150087d30d9f11c5444830385
nodenv
.node-version
node 18.19.1
npm
example/package.json
vite 4.5.2
typescript 5.3.3
package.json
@types/jsdom 21.1.6
@types/node 18.19.21
@typescript-eslint/eslint-plugin 6.21.0
@typescript-eslint/parser 6.21.0
@vitest/browser 1.3.1
@vitest/utils 1.3.1
cross-fetch 4.0.0
eslint 8.57.0
eslint-config-prettier 9.1.0
eslint-plugin-import 2.29.1
eslint-plugin-prettier 5.1.3
happy-dom 13.6.2
jiti 1.21.0
msw 1.3.2
prettier 3.2.5
typescript 5.3.3
unbuild 1.2.1
vitest 1.3.1
webdriverio 8.32.4
pnpm 8.15.4
- Check this box to trigger a request for Renovate to run again on this repository
Support environment without LocalStorage
Currently, the SDK assumes that LocalStorage exists.
But environments such as ServiceWorker or Node.js does not have that API, and people might want to use the SDK in that area.
We need to make sure that;
- we don't use
window
global - check if LocalStorage API exists and fallback to in-memory storage if it doesn't
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.