This simple Node.JS app comes with built-in "feature" behaviors - meaning - if you launch the app and tell it to run as feature 1, 2, 3 to show slightly different behavior. The web UI will change colors based on the enabled feature.
Feature | Behavior | Color |
---|---|---|
1 | Everything good | Green |
2 | 50% Failure Rate of /api/invoke | Red |
3 | Higher response times all requests | Yellow |
The demo app will put into the response a header called FeatureNumber
. With this, a Dynatrace request attribute
Shown below is the setup for Dynatrace request attributes.
Dynatrace request attributes then allow the Custom multidimensional analysis.
The application uses a default image of img/banner.png
. This can be overwritten by setting the BANNER_IMAGE
environment variable to a file in the img
folder or using a URL.
-
You must have node installed locally.
-
Once you clone the repo, you need to run
npm install
to download the required modules. I used npm: '8.x', node: '16.x'# set environment variables, for example export BANNER_IMAGE=img/banner.png # only set if using LaunchDarkly export FEATURE_FLAG_PROVIDER=launchdarkly export FEATURE_FLAG_SDK_KEY=[your key] # update packages npm update # start app npm start
Access the application @ http://localhost:8080/
-
You must have Docker and Docker compose installed
-
Edit the environment variables values in the
docker-compose.yaml
file -
If using feature flags, then export the SDK Key read by the
docker-compose.yaml
fileexport FEATURE_FLAG_SDK_KEY=[your sdk key]
-
Build and run Docker image manually. Run the
buildrun.sh
andbuildpush.sh
scripts.
To use LaunchDarkly, then the following are required: