swagger-stats
Advanced tools
Comparing version 0.95.6 to 0.95.7
@@ -67,3 +67,3 @@ 'use strict'; | ||
name: 'swagger-stats-authtest', | ||
version: '0.95.6', | ||
version: '0.95.7', | ||
hostname: "hostname", | ||
@@ -70,0 +70,0 @@ ip: "127.0.0.1", |
@@ -79,3 +79,3 @@ 'use strict'; | ||
name: 'swagger-stats-spectest', | ||
version: '0.95.6', | ||
version: '0.95.7', | ||
hostname: "hostname", | ||
@@ -122,2 +122,7 @@ ip: "127.0.0.1", | ||
if( process.env.SWS_ELASTIC_INDEX_PREFIX ){ | ||
swsOptions.elasticsearchIndexPrefix = process.env.SWS_ELASTIC_INDEX_PREFIX; | ||
} | ||
// Enable swagger-stats middleware with options | ||
@@ -124,0 +129,0 @@ app.use(swStats.getMiddleware(swsOptions)); |
@@ -112,3 +112,3 @@ 'use strict'; | ||
name: 'swagger-stats-testapp', | ||
version: '0.95.6', | ||
version: '0.95.7', | ||
timelineBucketDuration: tlBucket, | ||
@@ -115,0 +115,0 @@ uriPath: '/swagger-stats', |
@@ -38,2 +38,4 @@ /** | ||
this.indexPrefix = "api-"; | ||
this.enabled = false; | ||
@@ -65,2 +67,6 @@ } | ||
if(swsUtil.supportedOptions.elasticsearchIndexPrefix in swsOptions) { | ||
this.indexPrefix = swsOptions[swsUtil.supportedOptions.elasticsearchIndexPrefix]; | ||
} | ||
// Check / Initialize schema | ||
@@ -155,3 +161,3 @@ this.initTemplate(); | ||
// Create metadata | ||
var indexName = 'api-'+moment(rrr['@timestamp']).utc().format('YYYY.MM.DD'); | ||
var indexName = this.indexPrefix+moment(rrr['@timestamp']).utc().format('YYYY.MM.DD'); | ||
var meta = {index:{_index:indexName,_type:'api',_id:rrr.id}}; | ||
@@ -158,0 +164,0 @@ |
@@ -375,3 +375,8 @@ /** | ||
return processor.getStats(); | ||
}, | ||
// Allow get stats as prometheus format | ||
getPromStats: function() { | ||
return promClient.register.metrics(); | ||
} | ||
}; |
@@ -263,3 +263,3 @@ /** | ||
if (req.hasOwnProperty("body")) { | ||
rrr.http.request.body = {}; | ||
rrr.http.request.body = Object.assign({}, req.body); | ||
swsUtil.swsStringRecursive(rrr.http.request.body, req.body); | ||
@@ -266,0 +266,0 @@ } |
@@ -94,2 +94,5 @@ /* | ||
// Prefix for Elasticsearch index. Default is "api-" | ||
elasticsearchIndexPrefix : "elasticsearchIndexPrefix", | ||
// Set to true to track only requests defined in swagger spec. Default false. | ||
@@ -213,7 +216,7 @@ swaggerOnly : "swaggerOnly" | ||
// returns object key values as string recursively | ||
// returns object key values as string | ||
module.exports.swsStringRecursive = function (output, val) { | ||
if (typeof val === "object" && !Array.isArray(val)) { | ||
for (var key in val) { | ||
output[key] = this.swsStringRecursive(output[key], val[key]); | ||
output[key] = this.swsStringValue(val); | ||
} | ||
@@ -223,3 +226,2 @@ } else { | ||
} | ||
return output; | ||
@@ -226,0 +228,0 @@ } |
{ | ||
"name": "swagger-stats", | ||
"version": "0.95.6", | ||
"version": "0.95.7", | ||
"description": "API Telemetry and APM. Trace API calls and Monitor API performance, health and usage statistics in Node.js Microservices, based on express routes and Swagger (Open API) specification", | ||
@@ -52,2 +52,3 @@ "main": "lib/index.js", | ||
"moment": "^2.19.3", | ||
"natives": "^1.1.6", | ||
"path-to-regexp": "^2.1.0", | ||
@@ -59,5 +60,5 @@ "prom-client": "^11.0.0", | ||
"devDependencies": { | ||
"artillery": "^1.6.0-22", | ||
"artillery": "^1.6.0-26", | ||
"body-parser": "^1.18.2", | ||
"bootstrap": "^3.3.7", | ||
"bootstrap": "^3.4.0", | ||
"chai": "^4.1.2", | ||
@@ -89,9 +90,9 @@ "chart.js": "^2.7.2", | ||
"jquery": "^3.1.1", | ||
"jshint": "^2.9.4", | ||
"karma": "^1.7.1", | ||
"jshint": "^2.9.6", | ||
"karma": "^3.0.0", | ||
"karma-chai": "^0.1.0", | ||
"karma-chrome-launcher": "^2.1.1", | ||
"karma-chrome-launcher": "^2.2.0", | ||
"karma-cli": "^1.0.1", | ||
"karma-coverage": "^1.1.2", | ||
"karma-firefox-launcher": "^1.0.1", | ||
"karma-firefox-launcher": "^1.1.0", | ||
"karma-fixture": "^0.2.6", | ||
@@ -98,0 +99,0 @@ "karma-html2js-preprocessor": "^1.1.0", |
@@ -29,2 +29,12 @@ <p align="center"> | ||
### Built-In API Telemetry | ||
> **swagger-stats** provides built-in Telemetry UI, so you may enable **swagger-stats** in your app, and start monitoring immediately, with no infrastructure requirements. | ||
> Navigate to `http://<your app host:port>/swagger-stats/ui` | ||
![swagger-stats Built-In Monitoring](screenshots/ui0950.gif?raw=true) | ||
@@ -53,11 +63,3 @@ ### API Analytics with [Elasticsearch](https://www.elastic.co/) and [Kibana](https://www.elastic.co/products/kibana) | ||
### Built-In API Telemetry | ||
> **swagger-stats** provides built-in Telemetry UI, so you may enable **swagger-stats** in your app, and start monitoring immediately, with no infrastructure requirements. | ||
> Navigate to `http://<your app host:port>/swagger-stats/ui` | ||
![swagger-stats Built-In Monitoring](screenshots/ui0950.gif?raw=true) | ||
With statistics and metrics exposed by **swagger-stats** you may spot problematic API endpoints, see where most of errors happens, | ||
@@ -203,2 +205,12 @@ catch long-running requests, analyze details of last errors, observe trends, setup alerting. | ||
#### v0.95.7 | ||
* [bug] Fixes error in body stringification [#59](https://github.com/slanatech/swagger-stats/issues/59), [#60](https://github.com/slanatech/swagger-stats/pull/60) | ||
* [bug] Cannot upload to elk and Built-In API Telemetry [#46](https://github.com/slanatech/swagger-stats/issues/46) | ||
* [feature] Option `elasticsearchIndexPrefix` [#45](https://github.com/slanatech/swagger-stats/issues/45),[#47](https://github.com/slanatech/swagger-stats/issues/47) | ||
#### v0.95.6 | ||
@@ -205,0 +217,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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
5336511
10057
303
9
25
+ Addednatives@^1.1.6
+ Addednatives@1.1.6(transitive)