Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
feat(index/metrics): add better timings
Gergő Móricz1972f371b8ed
diff --git a/apps/api/src/scraper/scrapeURL/engines/index/index.ts b/apps/api/src/scraper/scrapeURL/engines/index/index.tsindex 3a51ae435..4a2b79da5 100644--- a/apps/api/src/scraper/scrapeURL/engines/index/index.ts+++ b/apps/api/src/scraper/scrapeURL/engines/index/index.ts@@ -188,6 +188,7 @@ const errorCountToRegister = 3;export async function scrapeURLWithIndex(meta: Meta,): Promise<EngineScrapeResult> {+ const startTime = Date.now();const normalizedURL = normalizeURLForIndex(meta.url);const urlHash = hashURL(normalizedURL);@@ -241,6 +242,8 @@ export async function scrapeURLWithIndex(}}+ const checkpoint1 = Date.now();+const { data, error } = await index_supabase_service.rpc("index_get_recent", {p_url_hash: urlHash,p_max_age_ms: maxAge,@@ -291,6 +294,8 @@ export async function scrapeURLWithIndex(throw new IndexMissError();}+ const checkpoint2 = Date.now();+const id = data[0].id;const doc = await getIndexFromGCS(@@ -327,6 +332,10 @@ export async function scrapeURLWithIndex(age: Date.now() - new Date(selectedRow.created_at).getTime(),maxAge,dynamicMaxAge: meta.options.maxAge === undefined,+ timingsFull: Date.now() - startTime,+ timingsMaxAge: checkpoint1 - startTime,+ timingsSupa: checkpoint2 - checkpoint1,+ timingsGCS: Date.now() - checkpoint2,});return {