Word "parikshan" is originated from Sanskrit language meaning "examine"
Overview of My Submission
- Compiles code and wraps function calls in source with Performance hooks.
- Reports
duration
along with details likearguments
,calledAt
,returnedAt
,functionName
andlocation
in source code (optional). In case the function returns a promise then finally handler will be attached to the promise and is reported once the finally handler is invoked. - A PerformanceObserver stores the performance entries generated by
parikshan
in time series collection. - Use this project's MongoDB Charts dashboard file when creating a new dashboard by importing it and connect it to collection created by parikshan.
- You can check dashboard for analysis done on botbuilder example repository here.
- Check project's README for usage, docs and more information.
Submission Category:
Prime Time
Link to Code
⏰ Parikshan
Transpiler to measure the running time of javascript functions.
Installation • Usage • Using with MongoDB • FAQs
Converts
// index.js
greet('John')
To
// output/index.js
const {parikshan} = require("parikshan/build/src/parikshan");
parikshan(greet)('John');
// if compiled with -s flag then compiles to
parikshan(
greet,
{"start":{"line":1,"column":0},"end":{"line":1,"column":13},"filename":"index.js"}
)('John')
Installation
To install this package run:
npm i parikshan -D
or with yarn run:
yarn add parikshan -D
Usage
CLI Usage
npx parikshan@latest -h
parikshan <files..>
Compiles code to performance.measure the functions
Positional Arguments:
files One or more files or glob patterns to compile
Options:
-h, --help Show help [boolean]
-v, --version Show version number [boolean]
…Additional Resources / Info
Q: How was the example project shown in dashboard compiled ?
NOTE :- having Azure account is not required for this to run. So envs in
.env
of43.complex-dialog
can be left undefined.
# clone botbuilder samples repo
git clone https://github.com/microsoft/BotBuilder-Samples.git
# goto 43.complex-dialog example
cd BotBuilder-Samples/samples/javascript_nodejs/43.complex-dialog
# install dependencies
npm install
# install parikshan as dev dependency
npm i parikshan -D
# at the beginning of index.js, add
#
# const {initMongoPerfSubscriber} = require('parikshan')
# initMongoPerfSubscriber({
# dbConnectionString: process.env.DB_CONN_STRING,
# dbName: process.env.DB_NAME,
# collectionName: process.env.DB_COLLECTION,
# })
# compile with parikshan
npx parikshan "{,!(node_modules)/**/}*.js" -s
# run compiled code
node build/parikshan/index.js
# converse with bot using botframework emulator. Check README of 43.complex-dialog for info on this.
# performance entries will be stored in collection as users are using bot.
# create your own MongoDB charts dashboard or import dashboard of this project to get insights of your code.
# Adjust refresh time in `Auto-refresh settings` of dashboard according to your need
Dashboard for analysis done on botbuilder example
Top comments (0)