diff options
| author | Mohamed Bassem <me@mbassem.com> | 2026-02-08 01:33:48 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-08 01:33:48 +0000 |
| commit | b2640803745636e87e42f5460759093f49df9d04 (patch) | |
| tree | 965f020a5c81b1805c19b2a2b8a3a434d06b1e1e /apps/workers/metrics.ts | |
| parent | 9e5693c6e4b410d1af05cc3d50c89ff73f21e060 (diff) | |
| download | karakeep-b2640803745636e87e42f5460759093f49df9d04.tar.zst | |
feat(metrics): add prometheus metric for bookmark crawl latency (#2461)
Track the time from bookmark creation to crawl completion as a histogram
(karakeep_bookmark_crawl_latency_seconds). This measures the end-to-end
latency users experience when adding bookmarks via extension, web, etc.
Excludes recrawls (crawledAt already set) and imports (low priority jobs).
https://claude.ai/code/session_019jTGGXGWzK9C5aTznQhdgz
Co-authored-by: Claude <noreply@anthropic.com>
Diffstat (limited to 'apps/workers/metrics.ts')
| -rw-r--r-- | apps/workers/metrics.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/workers/metrics.ts b/apps/workers/metrics.ts index c16c7bd4..42b5aa46 100644 --- a/apps/workers/metrics.ts +++ b/apps/workers/metrics.ts @@ -1,5 +1,5 @@ import { prometheus } from "@hono/prometheus"; -import { Counter, Registry } from "prom-client"; +import { Counter, Histogram, Registry } from "prom-client"; export const registry = new Registry(); @@ -21,5 +21,15 @@ export const crawlerStatusCodeCounter = new Counter({ labelNames: ["status_code"], }); +export const bookmarkCrawlLatencyHistogram = new Histogram({ + name: "karakeep_bookmark_crawl_latency_seconds", + help: "Latency from bookmark creation to crawl completion (excludes recrawls and imports)", + buckets: [ + 0.1, 0.25, 0.5, 1, 2.5, 5, 7.5, 10, 15, 20, 30, 45, 60, 90, 120, 180, 300, + 600, 900, 1200, + ], +}); + registry.registerMetric(workerStatsCounter); registry.registerMetric(crawlerStatusCodeCounter); +registry.registerMetric(bookmarkCrawlLatencyHistogram); |
