Comments (6)
Hi ! Could you kindly elaborate more on your scenarios ? I'd like to get a better sense of what kind of options to put in place to enable configurable tracking of endpoints ... for example, may consider introducing option to enable/disable tracking of all endpoints that are not in swagger, or explicitly specify an array of endpoints to track in options ... any details on your specific needs will help !
from swagger-stats.
Thanks for getting back to me!
I was thinking about having the option to enable/disable tracking of all endpoints that are not in swagger. The reason being is that I have two endpoints for example which are routed the same way. I have route 1 which would be:
/iwanttotrack/issue1
and route 2 which I also want to track which would be
/iwanttotrack/issue2
.
Currently, both hits to these endpoints show up in swagger-stats as:
/iwanttotrack/:issue
.
I was hoping there would be an option to separate it out specifically as I wanted to track which of the two issues issue1
or issue2
would be hit more often.
from swagger-stats.
Thanks! Could you give me a sample how /iwanttotrack/issue1 is defined in your swagger spec ?
from swagger-stats.
As of now it's a very simple definition
"paths": {
"/iwanttotrack/issue1": {
"get": {
"summary": "issue",
"description": "This operation will get the issue",
"responses": {
"200": {
"description": "The path is retrieved successfully."
},
"304": {
"description": "The path is redirected successfully"
}
}
}
}
},
"/iwanttotrack/issue2": {
"get": {
"summary": "issue",
"description": "This operation will get the issue",
"responses": {
"200": {
"description": "The path is retrieved successfully."
},
"304": {
"description": "The path is redirected successfully"
}
}
}
}
Nothing else to it.
from swagger-stats.
now you can specify option swaggerOnly={true|false}
. When set to true
, swagger-stats will only track API requests defined in swagger spec. Default is false
. See example in auttest app:
app.use(swStats.getMiddleware({
name: 'swagger-stats-authtest',
version: '0.95.0',
hostname: "hostname",
ip: "127.0.0.1",
swaggerSpec:swaggerSpec,
swaggerOnly: true,
uriPath: '/swagger-stats',
durationBuckets: [10, 25, 50, 100, 200],
requestSizeBuckets: [10, 25, 50, 100, 200],
responseSizeBuckets: [10, 25, 50, 100, 200],
apdexThreshold: 100,
onResponseFinish: function(req,res,rrr){
debug('onResponseFinish: %s', JSON.stringify(rrr));
},
authentication: true,
sessionMaxAge: maxAge,
onAuthenticate: function(req,username,password){
// simple check for username and password
if(username==='swagger-stats') {
return ((username === 'swagger-stats') && (password === 'swagger-stats'));
} else if(username==='swagger-promise'){
return new Promise(function(resolve) {
setTimeout(function(){
resolve((username === 'swagger-promise') && (password === 'swagger-promise'));
}, 1000);
});
}
return false;
}
}));
from swagger-stats.
I don't believe this is solving the problem that the author of this issue described. However I also think that this tool should not do what he wants for reasons related to #34.
from swagger-stats.
Related Issues (20)
- unit tests fail at [email protected] HOT 4
- How to make the data persist? HOT 1
- URL Normalization and 404 count consolidation by config option without requiring swagger apiSpec HOT 1
- how to customize metrics
- problem
- feat
- Hope to support a new feature
- DEBUG env is being overridden by `lib/swsElasticEmitter.js`
- 0.99.7 HOT 1
- where is the file "swagger.json" ? HOT 1
- Error on routes with wildcards
- Support prom-client 15
- Issue with Basic Auth when connecting the Endpoint to Grafana cloud HOT 2
- ReferenceError: that is not defined
- How to implement it in a production environment? HOT 1
- Error in tests when updating to 0.99.7
- Native Fastify plugin
- Issue in authentication in case of a multi-instance environment
- Issues with Requests to the root route (/)
- ReferenceError: that is not defined HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swagger-stats.