Papi Stats
Add basic stats support to Papi clients.
Options
- count (Function<String, Number>): a function that increments a counter by a given amount
- timing (Function<String, Number>): a function that records timing data in milliseconds
Example
var lynx = ;var papi = ;var metrics = ;var client =name: 'github'baseUrl: 'https://api.github.com'timeout: 10000;client;client;
This could produce metrics like the following:
// responses
prefix.github.gists.200:773|ms
prefix.github.gists.401:421|ms
// non-responses
prefix.github.gists.abort:5003|ms
prefix.github.gists.timeout:10001|ms
prefix.github.gists.error:3|ms
// ctx.retry called in middleware
prefix.github.gists.retry:1|c
License
This work is licensed under the MIT License (see the LICENSE file).