core: small enhancements

This commit is contained in:
undefined committed 2022-11-08 00:25:04 +08:00
1 parent 50b838d21d
commit d7908aaff6
5 files changed
+24 -8

No files matched your search

+10
View File
@@ -3,6 +3,14 @@ import {
} from 'prom-client';
import { Context, db } from 'hydrooj';
declare module 'hydrooj' {
interface Context {
metrics: Registry;
}
}
Context.service('metrics');
export function createRegistry(ctx: Context) {
const registry = new Registry();
@@ -61,5 +69,7 @@ export function createRegistry(ctx: Context) {
});
collectDefaultMetrics({ register: registry });
ctx.metrics = registry;
return registry;
}