mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: small enhancements
This commit is contained in:
1 parent
50b838d21d
commit
d7908aaff6
5 files changed
+24
-8
No files matched your search
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user