swagger-stats
Advanced tools
Comparing version 0.90.3 to 0.91.0
@@ -114,2 +114,3 @@ 'use strict'; | ||
timelineBucketDuration: tlBucket, | ||
uriPath: '/swagger-stats', | ||
swaggerSpec:swaggerSpec | ||
@@ -116,0 +117,0 @@ })); |
@@ -80,3 +80,3 @@ 'use strict'; | ||
proxies: { | ||
'/swagger-stats/stats': 'http://localhost:3030/swagger-stats/stats', | ||
'/stats': 'http://localhost:3030/swagger-stats/stats', | ||
'/dist': 'http://localhost:3030/swagger-stats/dist' | ||
@@ -83,0 +83,0 @@ }, |
@@ -23,2 +23,3 @@ /** | ||
swaggerSpec: null, | ||
uriPath: '/swagger-stats', | ||
durationBuckets: [5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000], | ||
@@ -31,2 +32,7 @@ requestSizeBuckets: [5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000], | ||
var pathUI = swsOptions.uriPath+'/ui'; | ||
var pathDist = swsOptions.uriPath+'/dist'; | ||
var pathStats = swsOptions.uriPath+'/stats'; | ||
var pathMetrics = swsOptions.uriPath+'/metrics'; | ||
// Request hanlder | ||
@@ -65,2 +71,8 @@ function handleRequest(req, res){ | ||
} | ||
// update standard path | ||
pathUI = swsOptions.uriPath+'/ui'; | ||
pathDist = swsOptions.uriPath+'/dist'; | ||
pathStats = swsOptions.uriPath+'/stats'; | ||
pathMetrics = swsOptions.uriPath+'/metrics'; | ||
} | ||
@@ -85,23 +97,4 @@ | ||
if(req.query.test) { | ||
var dummyStream = { | ||
write: function (text) { | ||
} | ||
}; | ||
res.write('testing\n'); | ||
processor.writeMetrics(req.query, res); | ||
debug('Start Test'); | ||
var startts = new Date(); | ||
for (var i = 0; i < 10000; i++) { | ||
processor.writeMetrics(req.query, dummyStream); | ||
} | ||
var endts = new Date(); | ||
debug('End Test: ' + (endts - startts)); | ||
res.write('done: '+(endts - startts) + ' ms\n'); | ||
}else{ | ||
processor.writeMetrics(req.query, res); | ||
} | ||
res.end(); | ||
@@ -125,13 +118,13 @@ } | ||
// swagger-stats requests will not be counted in statistics | ||
if(req.url.startsWith('/swagger-stats/stats')) { | ||
if(req.url.startsWith(pathStats)) { | ||
processGetStats(req, res); | ||
return; | ||
}else if(req.url.startsWith('/swagger-stats/metrics')){ | ||
}else if(req.url.startsWith(pathMetrics)){ | ||
processGetMetrics(req,res); | ||
return; | ||
}else if(req.url =='/swagger-stats/ui'){ | ||
}else if(req.url == pathUI ){ | ||
res.status(200).send(uiMarkup); | ||
return; | ||
}else if(req.url.startsWith('/swagger-stats/dist')) { | ||
var fileName = req.url.replace('/swagger-stats/dist/',''); | ||
}else if(req.url.startsWith(pathDist)) { | ||
var fileName = req.url.replace(pathDist+'/',''); | ||
var qidx = fileName.indexOf('?'); | ||
@@ -138,0 +131,0 @@ if(qidx!=-1) fileName = fileName.substring(0,qidx); |
@@ -28,2 +28,8 @@ /* | ||
// Base path for swagger-stats internal APIs. | ||
// If specified, will be used to serve UI, stats and metrics like this: | ||
// /<uriPath>/ui, /<uriPath>/stats, /<uriPath>/metrics | ||
// overriding default /swagger-stats/ui | ||
uriPath : "uriPath", | ||
// Duration of timeline bucket in milliseconds, 60000 by default | ||
@@ -30,0 +36,0 @@ timelineBucketDuration : "timelineBucketDuration", |
{ | ||
"name": "swagger-stats", | ||
"version": "0.90.3", | ||
"version": "0.91.0", | ||
"description": "Telemetry for your APIs. Trace API calls and Monitor API performance, health and usage statistics in Node.js Microservices, based on express routes and Swagger (Open API) specification", | ||
@@ -40,3 +40,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"debug": "^3.0.0", | ||
"debug": "^3.1.0", | ||
"moment": "^2.18.1", | ||
@@ -46,20 +46,20 @@ "path-to-regexp": "^2.0.0" | ||
"devDependencies": { | ||
"artillery": "^1.6.0-2", | ||
"body-parser": "^1.15.0", | ||
"artillery": "^1.6.0-9", | ||
"body-parser": "^1.18.2", | ||
"bootstrap": "^3.3.7", | ||
"chai": "^4.0.2", | ||
"chart.js": "^2.6.0", | ||
"chai": "^4.1.2", | ||
"chart.js": "^2.7.0", | ||
"chokidar": "^1.6.1", | ||
"chosen-js": "^1.7.0", | ||
"coveralls": "^2.13.1", | ||
"css-loader": "^0.28.5", | ||
"chosen-js": "^1.8.2", | ||
"coveralls": "^2.13.3", | ||
"css-loader": "^0.28.7", | ||
"cuid": "^1.3.8", | ||
"d3": "^4.9.1", | ||
"d3": "^4.10.2", | ||
"d3-horizon-chart": "0.0.6", | ||
"datatables": "^1.10.13", | ||
"express": "^4.14.1", | ||
"express": "^4.16.0", | ||
"file-loader": "^0.11.1", | ||
"font-awesome": "^4.7.0", | ||
"gulp": "^3.9.1", | ||
"gulp-clean-css": "^3.0.4", | ||
"gulp-clean-css": "^3.9.0", | ||
"gulp-concat": "^2.6.1", | ||
@@ -76,3 +76,3 @@ "gulp-concat-css": "^2.3.0", | ||
"jshint": "^2.9.4", | ||
"karma": "^1.7.0", | ||
"karma": "^1.7.1", | ||
"karma-chai": "^0.1.0", | ||
@@ -86,14 +86,14 @@ "karma-chrome-launcher": "^2.1.1", | ||
"karma-mocha": "^1.3.0", | ||
"karma-mocha-reporter": "^2.2.3", | ||
"karma-mocha-reporter": "^2.2.4", | ||
"karma-phantomjs-launcher": "^1.0.4", | ||
"karma-should": "^1.0.0", | ||
"mocha": "^3.4.2", | ||
"mocha": "^3.5.3", | ||
"mocha-jscs": "^5.0.0", | ||
"mocha-jshint": "^2.3.1", | ||
"nyc": "^11.0.3", | ||
"nyc": "^11.2.1", | ||
"phantomjs-prebuilt": "^2.1.14", | ||
"postcss-loader": "^2.0.5", | ||
"q": "^1.5.0", | ||
"serve-favicon": "^2.3.0", | ||
"serve-static": "^1.11.0", | ||
"serve-favicon": "^2.4.5", | ||
"serve-static": "^1.13.0", | ||
"should": "^11.2.1", | ||
@@ -100,0 +100,0 @@ "style-loader": "^0.18.1", |
@@ -46,3 +46,3 @@ <p align="center"> | ||
![swagger-stats Built-In Monitoring](screenshots/uiscreens.gif?raw=true) | ||
![swagger-stats Built-In Monitoring](screenshots/ui0910.gif?raw=true) | ||
@@ -187,2 +187,16 @@ | ||
#### v0.91.0 | ||
* [feature] Option to specify alternative URI path for ui,stats and metrics [#17](https://github.com/slanatech/swagger-stats/issues/17) | ||
```javascript | ||
app.use(swStats.getMiddleware({ | ||
uriPath: '/myservice', | ||
swaggerSpec:swaggerSpec | ||
})); | ||
``` | ||
``` | ||
$ curl http://<your app host:port>/myservice/stats | ||
``` | ||
#### v0.90.3 | ||
@@ -189,0 +203,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6620
225
8755492
Updateddebug@^3.1.0