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

tombeckenhamcommented

captureIngestEvents now console.logs each event as { event, ...properties } before the PostHog send, also when no PostHog key is set, so Workers Logs can be queried by providerId/reason when PostHog is unavailable. Test added.

Summary by CodeRabbit

  • Chores
    • Ingest events are now recorded in application logs as JSON lines, including when analytics capture is not configured.
    1. tombeckenham linked this to fix #100002

    2. ⚠️ No Changeset found

      Latest commit: e0bcdad5ae9c3e61d2635982b859919988fcaed5

      Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

      This PR includes no changesets

      When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

      Click here to learn what changesets are, and how to add one.

      Click here if you're a maintainer who wants to add a changeset to this PR

    3. Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      captureIngestEvents now logs each drained ingest event as a JSON line before the PostHog checks. PostHog capture behavior remains unchanged. A test checks the logged event when no PostHog key is provided.

      Changes: Ingest event logging

      Layer / File(s)Summary
      Log drained events and verify output
      src/server/ingest/ingest-signals.ts, src/server/ingest/ingest-signals.test.ts
      captureIngestEvents logs each drained event as JSON before the PostHog checks. The test checks the logged ingest_failed event’s job, provider ID, and error when no PostHog key is provided.

      Estimated code review effort: 2 (Simple) | ~8 minutes

      Change: Feature

      Merge Risk: Minimal · up to e0bcd

      This change adds one JSON log line per ingest event so failures can be queried in Workers Logs even without a PostHog key. No concrete merge-blocking risk was found.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Description CheckPassedCheck skipped - CodeRabbit’s high-level summary is enabled.
      Title checkPassedThe title "Log each ingest event to Workers Logs as one JSON line" matches the main change. captureIngestEvents now writes each drained event as a JSON line to the console before the PostHog key check…
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Title check

      Explanation

      The title "Log each ingest event to Workers Logs as one JSON line" matches the main change. captureIngestEvents now writes each drained event as a JSON line to the console before the PostHog key check, and a test covers this. The title names the change and its destination. It does not mention the no-key fallback, which is a minor omission.

      Finishing Touches

      Generate unit tests (beta)

      • Commit to this branch
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      Share

      Recent review info

      Run configuration

      • Source mode: Auto
      • Repository: Unavailable
      • Branch: Unavailable
      • File: No configuration file from this repository applied
      • Commit: Unavailable
      • Layers: defaults
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: 6f1edf72-9030-44ea-a0ed-416df6e6f150
      Commits

      Reviewing files that changed from the base of the PR and between 13ad6f79b0b5cc1ef77d9e16642e50087c18ad3f and e0bcdad5ae9c3e61d2635982b859919988fcaed5.

      Files selected for processing: 2

      • src/server/ingest/ingest-signals.test.ts
      • src/server/ingest/ingest-signals.ts

      Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

    4. tombeckenham merged this48ce00d

    5. tombeckenham merged this48ce00d

    6. tombeckenham closed this

Sign in to join this conversation.