mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-25 00:04:22 +01:00
Add Prometheus metrics
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Stickynotes } from '@soapbox/stickynotes';
|
||||
|
||||
import { firehoseEventCounter } from '@/metrics.ts';
|
||||
import { Storages } from '@/storages.ts';
|
||||
import { nostrNow } from '@/utils.ts';
|
||||
|
||||
@@ -12,13 +13,14 @@ const console = new Stickynotes('ditto:firehose');
|
||||
* side-effects based on them, such as trending hashtag tracking
|
||||
* and storing events for notifications and the home feed.
|
||||
*/
|
||||
export async function startFirehose() {
|
||||
export async function startFirehose(): Promise<void> {
|
||||
const store = await Storages.client();
|
||||
|
||||
for await (const msg of store.req([{ kinds: [0, 1, 3, 5, 6, 7, 9735, 10002], limit: 0, since: nostrNow() }])) {
|
||||
if (msg[0] === 'EVENT') {
|
||||
const event = msg[2];
|
||||
console.debug(`NostrEvent<${event.kind}> ${event.id}`);
|
||||
firehoseEventCounter.inc({ kind: event.kind });
|
||||
|
||||
pipeline
|
||||
.handleEvent(event, AbortSignal.timeout(5000))
|
||||
|
||||
Reference in New Issue
Block a user