clinic flame and clinic doctor not running on windows 7 and windows 10
See original GitHub issueExpected Behavior
Hi all , I am trying to analyse the express application with mongodb backend . My set up is completely on windows laptop 7 . With clinic doctor express server does not receive request and with clinic flame i get errors . With simple autocannon command i am able to call POST requests and records are getting created in database.
My command line - for clinic flame and clinic doctor
option 1 - clinic flame --on-port 'autocannon -method POST localhost:3000/redeem' -- node server.js
option 2 - clinic flame --on-port 'autocannon -m POST localhost:3000/redeem' -- node server.js
clinic doctor --on-port ‘autocannon -m POST localhost:3000/redeem’ – node server.js
Current Behavior
I get following output for option1
clinic flame helps you find synchronous bottlenecks by creating a flamegraph visualization that assists in identifying function calls that may be blocking the event loop. clinic flame only supports Linux, OS X and Solaris.
I get following error for second option 2 (node:6308) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: -m is not a recognized flag (node:6308) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Steps to Reproduce (for bugs)
- run the command as described in the paragraph above.
Code for windows
My code is simple express application with mongodb as db .
Environment
- Clinic doctor version: 2.4.1 Clinic flame version : V4.0.11 node version : 8.9.4 npm version : 5.6.0
server.js
const express = require('express');
const bodyparser = require('body-parser');
const MongoClient = require('mongodb').MongoClient;
const url = "mongodb://localhost:27017/";
const app = express();
let mongoDb = null;
app.use(bodyparser.json());
app.use(bodyparser.urlencoded({ extended: true }));
let options = { useNewUrlParser: true };
app.listen(3000, function () {
MongoClient.connect(url, options, function (err, db) {
if (err) {
throw err;
}
else {
console.log("db connected");
mongoDb = db;
}
});
console.log("app is ready on port 3000");
});
app.post('/redeem', (req, res) => {
console.log("first line on post");
let db = mongoDb.db("finacle");
console.dir(req.body, { depth: null, colors: true });
//db.collection('trans').insertOne( { 'couponCode' : 'A123', 'points' : 100});
let message = '';
try {
if (req.body) {
if (Array.isArray(req.body)) {
for (let obj of req.body) {
console.log(obj);
db.collection('trans').insertOne(obj);
}
message = 'Total ' + req.body.length + ' Objects saved';
}
else if(req.body.couponCode) {
db.collection('trans').insertOne(req.body);
console.log("saved inside a collection");
message = 'Total ' + req.body.length + ' saved';
}
else {
console.log("100 coupons generation");
let max = 100;
let obj = {};
let val = getRandomInt(max);
let couponCode = 'B';
for (let val= 0 ; val< max; val++) {
obj = Object.create(null);
couponCode = 'B' + val;
obj.couponCode = couponCode;
obj.points = getRandomInt(1000);
db.collection('trans').insertOne(obj);
}
message = 'Total objects created : '+ max;
}
}
}
catch (ex) {
console.log("exception " + ex);
}
//let allRecs = db.collection('trans').find();
let obj = { "message": message };
res.status(200).json(obj);
//mongoDb.close();
});
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
I am running win7
clinic flame
andclinic doctor
both are working fine. Note I am using simplefastify
example.windows 11 not support