A simple NodeJS app to test LaunchDarkly's Flag Delivery Network performance.
This test measures the time it takes for a flag change in LaunchDarkly SaaS to reach client code.
Test logic:
- Toggle the flag with the given
flagKey
in LaunchDarkly (via Flags PATCH API call) - Get the flag's
lastModified
timestamp value from the API call response - Get a current timestamp when the LDClient's
on('update:flagKey')
handler fires - Compare the the two timestamps
npm i
Update the following values in your .env
file (or pass them in via command line args)
LD_SDK_KEY=<your SDK key>
LD_API_TOKEN=<your API token>
LD_PROJECT=<your LD project key>
LD_ENVIRONMENT=<your LD environment key>
LD_FLAG_KEY=<the LD flag key of the flag to be toggled during testing>
LD_CONTEXT=<your LD context object, must be valid JSON string>
Example LD_Context
value: '{ "kind": "user", "key": "fdntest" }'
If using parameters in a .env
file:
node app.mjs
If passing values via args:
node app.mjs --sdkKey abc123 --apiToken asdf etc etc
To see the full list of available parameters:
node app.mjs --help