mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
prom-client: add category for connection handler
This commit is contained in:
1 parent
1e62a9b027
commit
3c97ff74a9
3 files changed
+5
-2
No files matched your search
@@ -363,6 +363,8 @@ class HomeDomainCreateHandler extends Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class HomeMessagesHandler extends Handler {
|
class HomeMessagesHandler extends Handler {
|
||||||
|
category = '#message';
|
||||||
|
|
||||||
async get() {
|
async get() {
|
||||||
// TODO(iceboy): projection, pagination.
|
// TODO(iceboy): projection, pagination.
|
||||||
const messages = await message.getByUser(this.user._id);
|
const messages = await message.getByUser(this.user._id);
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ export class SubmissionDataDownloadHandler extends Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class JudgeConnectionHandler extends ConnectionHandler {
|
class JudgeConnectionHandler extends ConnectionHandler {
|
||||||
|
category = '#judge';
|
||||||
processing: any = null;
|
processing: any = null;
|
||||||
closed = false;
|
closed = false;
|
||||||
query: any = { type: 'judge' };
|
query: any = { type: 'judge' };
|
||||||
|
|||||||
@@ -40,10 +40,10 @@ export function createRegistry(ctx: Context) {
|
|||||||
labelNames: ['domainId'],
|
labelNames: ['domainId'],
|
||||||
});
|
});
|
||||||
ctx.on('connection/active', (h) => {
|
ctx.on('connection/active', (h) => {
|
||||||
connectionGauge.inc({ domainId: h.args.domainId });
|
connectionGauge.inc({ domainId: (h as any).category || h.args.domainId });
|
||||||
});
|
});
|
||||||
ctx.on('connection/close', (h) => {
|
ctx.on('connection/close', (h) => {
|
||||||
connectionGauge.dec({ domainId: h.args.domainId });
|
connectionGauge.dec({ domainId: (h as any).category || h.args.domainId });
|
||||||
});
|
});
|
||||||
|
|
||||||
const taskColl = db.collection('task');
|
const taskColl = db.collection('task');
|
||||||
|
|||||||
Reference in new issue
Block a user