Start with a sample project with Docker Compose

1. Clone our sample repository

Clone our repository and open it in a new VS Code window

git clone

Install the project with the following:

# You Can also use NPM if not using yarn.
yarn install

2. Make code changes

Let's apply some code changes to the repository code to understand better how sprkl works.

Sprkl is built on the idea of analyzing code changes and integrating instrumentation of the scanned changes into the runtime. Once we apply the following code changes, we will get an insightful view of how these code changes play in our application.

2.1. Make the 1st code change

In the file, metrics/metrics.js uncomment the following code block (starting at line 41).

Note that this code has some inefficiencies that will show up in the Sprkl dashboard

2.2. Make the 2nd code change

Add the following code to file orders/index.js line 35:

3. Run sprkl

Let's deploy the microservices with docker-compose using the following command:

sprkl --recipe=uncommitted -- docker compose up --build -d --force-recreate

Now that the deployment was successful let's run our end-2-end testing:

# If you'll look at the "test:e2e:run" script is running Jest.
sprkl --recipe=uncommitted -- yarn test

For more information about the recipe flag, read Analysis.

4. See your code change analysis in the Sprkl dashboard

Open the Sprkl dashboard by clicking on the Sprkl icon from the main menu.

Check the “insights” section to see the inefficiencies the code contains.

Last updated