prom-client#LabelValues TypeScript Examples
The following examples show how to use
prom-client#LabelValues.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.ts From common-ts with MIT License | 6 votes |
export async function timed<T>(
metric: Histogram<string> | undefined,
labels: LabelValues<string> | undefined,
promise: T | Promise<T>,
): Promise<T> {
const timer = metric?.startTimer(labels)
try {
return await promise
} finally {
if (timer) {
timer(labels)
}
}
}