|
4 | 4 | * Lightweight web framework for your serverless applications
|
5 | 5 | * @author Jeremy Daly <[email protected]>
|
6 | 6 | * @license MIT
|
7 |
| - */ |
| 7 | +*/ |
8 | 8 |
|
9 |
| - // IDEA: add unique function identifier |
10 |
| - // IDEA: response length |
11 |
| - // https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#context-variable-reference |
| 9 | +// IDEA: add unique function identifier |
| 10 | +// IDEA: response length |
| 11 | +// https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#context-variable-reference |
12 | 12 |
|
13 | 13 | const UTILS = require('./utils') // Require utils library
|
14 | 14 |
|
@@ -64,7 +64,7 @@ exports.config = (config,levels) => {
|
64 | 64 | qs: Object.keys(req.query).length > 0 ? req.query : undefined
|
65 | 65 | }
|
66 | 66 | },
|
67 |
| - res: res => { |
| 67 | + res: () => { |
68 | 68 | return { }
|
69 | 69 | },
|
70 | 70 | context: context => {
|
@@ -92,7 +92,7 @@ exports.config = (config,levels) => {
|
92 | 92 | let _context = Object.assign({},defaults.context(context),serializers.context(context))
|
93 | 93 | let _custom = typeof custom === 'object' && !Array.isArray(custom) ?
|
94 | 94 | Object.assign({},defaults.custom(custom),serializers.custom(custom)) :
|
95 |
| - defaults.custom(custom) |
| 95 | + defaults.custom(custom) |
96 | 96 |
|
97 | 97 | return Object.assign({},
|
98 | 98 | {
|
@@ -198,14 +198,14 @@ exports.sampler = (app,req) => {
|
198 | 198 | // Enable sampling if last sample is passed target split
|
199 | 199 | } else if (rule.target > 0 &&
|
200 | 200 | counts.start+Math.floor(rule.period*1000/rule.target*counts.fCount) < now) {
|
201 |
| - level = rule.level |
202 |
| - counts.fCount++ |
203 |
| - // console.log('\n*********** FIXED ***********'); |
| 201 | + level = rule.level |
| 202 | + counts.fCount++ |
| 203 | + // console.log('\n*********** FIXED ***********'); |
204 | 204 | } else if (rule.rate > 0 &&
|
205 | 205 | counts.start+Math.floor(velocity*counts.pCount+velocity/2) < now) {
|
206 |
| - level = rule.level |
207 |
| - counts.pCount++ |
208 |
| - // console.log('\n*********** RATE ***********'); |
| 206 | + level = rule.level |
| 207 | + counts.pCount++ |
| 208 | + // console.log('\n*********** RATE ***********'); |
209 | 209 | }
|
210 | 210 |
|
211 | 211 | // Increment total count
|
|
0 commit comments