aboutsummaryrefslogtreecommitdiffstats
path: root/apps/workers/metrics.ts
blob: 3dc4d2c0b7781f8c473add812cab2e678bd4ebcc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { prometheus } from "@hono/prometheus";
import { Counter, Registry } from "prom-client";

const registry = new Registry();

export const { printMetrics } = prometheus({
  registry: registry,
  prefix: "karakeep_",
  collectDefaultMetrics: true,
});

export const workerStatsCounter = new Counter({
  name: "karakeep_worker_stats",
  help: "Stats for each worker",
  labelNames: ["worker_name", "status"],
});

export const crawlerStatusCodeCounter = new Counter({
  name: "karakeep_crawler_status_codes_total",
  help: "HTTP status codes encountered during crawling",
  labelNames: ["status_code"],
});

registry.registerMetric(workerStatsCounter);
registry.registerMetric(crawlerStatusCodeCounter);