feat(metrics): count request:end, and only request:end
A failed request emits three lifecycle events. request:end is the terminal and universal one, so it is the request counter; request:failed is additional and gets its own series. Counting both as requests is the double count issue #64 was filed for. Labels come from route, which the route table bounds, never from name, which carries the arriving path and is bounded by nothing — issue #65. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
3 files changed
+101
No files matched your search
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
/** One labelled series and its accumulated value. */
|
||||
export interface Series {
|
||||
route: string;
|
||||
method: string;
|
||||
status?: number;
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** What the collector holds, for a consumer that wants numbers rather than text. */
|
||||
export interface MetricsSnapshot {
|
||||
requests: Series[];
|
||||
errors: Series[];
|
||||
duration: Array<{ route: string; method: string; sum: number; count: number }>;
|
||||
}
|
||||
|
||||
export interface MetricsOptions {
|
||||
/** Graph name the collector is published under, and the plugin's name. Defaults to `metrics`. */
|
||||
provides?: string;
|
||||
}
|
||||
Reference in new issue
Block a user