swagger-stats
swagger-stats copied to clipboard
Support custom metrics
Allow app to submit custom metrics. Provide Inc/Dec operations. Keep overall values, and time- interval values. Examples: number of DB connections, time to execute internal operations, number of items in queue, etc.
+1
Swagger-stats uses prom-client under the hood. You can get a handle of the client with getPromClient() and use this to create custom metrics to be exposed at /metrics.
const client = swStats.getPromClient();
const counter = new client.Counter('metric_name', 'metric_help');
counter.inc(); // Inc with 1
counter.inc(10); // Inc with 10
@connorjayfitzgerald You, my friend, are a scholar and a gentleman. That worked just as intended.