Installation
You need the docker and rest should be automatic.
- Prepare docker containers
npm run docker:start
- Install all dependencies and make necessary migrations to newly created docker with postgresql
npm i
- Run the application
npm start
- Generate some data by opening and refreshing page couple times.
Open browser at http://localhost:3000/generate - Now get some data from db opening browser at http://localhost:3000
- Open zipkin using browser at http://localhost:9411/ and click on "Run Query"
You will see "KNEX-TEST http get" and "KNEX-TEST pg.query:select" this is wrong - it means that the traces are not connected
You can click on column "START TIME" to sort traces via date and to see the latest as first
You have 2 options to fix it
Option A
- Edit file
tracing.js - Uncomment the line 13 so that you can use
AsyncLocalStorageContextManager, save - Rerurn
npm start - Open browser at http://localhost:3000
- Open zipkin using browser at http://localhost:9411/ and click on "Run Query"
- You will see "KNEX-TEST http get" which has all traces tied together
Option B
- Undo changes in
tracing.js - Edit file
server.js - Comment lines 19-24
- Uncomment lines 27-33
- Rerurn
npm start - Open browser at http://localhost:3000
- Open zipkin using browser at http://localhost:9411/ and click on "Run Query"
- You will see "KNEX-TEST http get" which has all traces tied together even though the
AsyncLocalStorageContextManageris not used
Expected solution and fix for knex
Fix the knex to correctly handle the context when using async / await, you should probably use
https://nodejs.org/docs/latest-v14.x/api/async_hooks.html#async_hooks_resource
On this page
Languages
JavaScript100.0%
Contributors
MIT License
Created November 20, 2020
Updated November 20, 2020