Skip to content
Source
Sign inSign up
TanStack/schemas

Log each ingest event to Workers Logs as one JSON line #683

Mergedtombeckenhammerged 1 commit intomain from100002-log-ingest-eventsmerged by tombeckenham View on GitHub

Showing 2 changed files with 22 additions and 1 deletion.

x
0 of 2 viewed, 2 left
18 additions and 1 deletionsrc/server/ingest/ingest-signals.test.tsModified
View file
@@ -1,5 +1,5 @@
import { bodyText, requestUrl } from '#/lib/text.ts'
-import { describe, expect, it } from 'vitest'
+import { describe, expect, it, vi } from 'vitest'
​
import { assertParsed } from '#/server/providers/model-facts.ts'
​
@@ -257,4 +257,21 @@
expect(takeIngestEvents()).toEqual([])
+ it('logs each event as one JSON line, even with no PostHog key', async () => {
+ takeIngestEvents()
+ noteIngest(ingestFailedEvent('models-poll', 'nvidia', 'GET → 404'))
+ const log = vi.spyOn(console, 'log').mockImplementation(() => {})
+ await captureIngestEvents(undefined)
+ expect(
+ log.mock.calls.map(([line]) => JSON.parse(String(line)) as unknown),
+ ).toEqual([
+ {
+ event: 'ingest_failed',
+ job: 'models-poll',
+ providerId: 'nvidia',
+ error: 'GET → 404',
+ },
+ ])