mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Add Policy metrics
This commit is contained in:
parent
9b521e9f36
commit
8960bdcca9
2 changed files with 8 additions and 1 deletions
|
|
@ -35,6 +35,12 @@ export const pipelineEventCounter = new Counter({
|
|||
labelNames: ['kind'],
|
||||
});
|
||||
|
||||
export const policyEventCounter = new Counter({
|
||||
name: 'policy_events_total',
|
||||
help: 'Total number of policy OK responses',
|
||||
labelNames: ['ok'],
|
||||
});
|
||||
|
||||
export const relayEventCounter = new Counter({
|
||||
name: 'relay_events_total',
|
||||
help: 'Total number of EVENT messages processed by the relay',
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { Conf } from '@/config.ts';
|
|||
import { DittoDB } from '@/db/DittoDB.ts';
|
||||
import { deleteAttachedMedia } from '@/db/unattached-media.ts';
|
||||
import { DittoEvent } from '@/interfaces/DittoEvent.ts';
|
||||
import { pipelineEventCounter } from '@/metrics.ts';
|
||||
import { pipelineEventCounter, policyEventCounter } from '@/metrics.ts';
|
||||
import { RelayError } from '@/RelayError.ts';
|
||||
import { AdminSigner } from '@/signers/AdminSigner.ts';
|
||||
import { hydrateEvents } from '@/storages/hydrate.ts';
|
||||
|
|
@ -71,6 +71,7 @@ async function policyFilter(event: NostrEvent): Promise<void> {
|
|||
|
||||
try {
|
||||
const result = await policyWorker.call(event);
|
||||
policyEventCounter.inc({ ok: String(result[2]) });
|
||||
debug(JSON.stringify(result));
|
||||
RelayError.assert(result);
|
||||
} catch (e) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue