Skip to content

Wire pegma-dev-api logging (Cloudflare + Datadog tee) - #3

Merged
FlyOverCoderKY merged 3 commits into
mainfrom
wire-pegma-logger-workers
Jul 28, 2026
Merged

FlyOverCoderKY merged 3 commits into
mainfrom
wire-pegma-logger-workers

Conversation

@FlyOverCoderKY

Copy link
Copy Markdown
Contributor

Summary

  • Add Worker pegma-dev-api with createTeeLogger(cloudflare, datadog) composition root
  • Enable Cloudflare Workers Logs store via Wrangler observability.logs (persist: true)
  • Deploy Worker with CLI; CI deploys it on main after Pages
  • Datadog arm optional until DATADOG_API_KEY secret is set

Test plan

  • npx wrangler deploy -c worker/wrangler.jsonc succeeded
  • GET https://pegma-dev-api.websitemakers-et-al.workers.dev/health returns cloudflare: true
  • Confirm logs appear under Workers → pegma-dev-api → Observability (or npm run worker:tail)
  • Optional: wrangler secret put DATADOG_API_KEY -c worker/wrangler.jsonc and verify Datadog intake

Add a thin Workers composition root that tees Cloudflare Workers Logs and
Datadog through @pegma/logger-*, enable the Cloudflare log store via
wrangler observability, and deploy on main.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copilot AI review requested due to automatic review settings July 27, 2026 22:21
@cursor

cursor Bot commented Jul 27, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new Cloudflare Worker (pegma-dev-api) as a thin API slice focused on validating Pegma’s dual-sink logging composition (Cloudflare Workers Logs + optional Datadog), and wires deployment via Wrangler and the existing deploy workflow.

Changes:

  • Add worker/ with a /health endpoint and a composed Spine logger (createTeeLogger(cloudflare, datadog)), with Datadog shipping enabled only when DATADOG_API_KEY is set.
  • Enable Workers Logs persistence via Wrangler observability.logs and add local/dev ergonomics (scripts, .dev.vars example, gitignore).
  • Deploy the Worker from GitHub Actions after Pages deploy, and document the new Worker/logging slice in repo docs.

Reviewed changes

Copilot reviewed 10 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
worker/wrangler.jsonc Defines the Worker entrypoint and enables Workers Observability + persistent logs store.
worker/src/logger.ts Composition root for tee logging and Datadog intake shipping helper.
worker/src/index.ts Worker handler with request logging and ///health endpoint.
worker/README.md Documents Worker purpose, log store enablement, and Datadog secret setup.
worker/.dev.vars.example Example local env vars for wrangler dev.
tsconfig.json Includes Worker sources in TS project and adds Workers ambient types.
README.md Updates repo overview to include the Worker logging slice and basic commands.
package.json Adds Wrangler scripts and Pegma logger dependencies + toolchain devDependencies.
package-lock.json Locks newly added dependencies/tooling versions.
docs/PROJECT_PLAN.md Records the logging precursor milestone for Phase 4 gating context.
AGENTS.md Updates agent guidance to explicitly allow a thin logging Worker pre-Phase 4.
.gitignore Ignores Wrangler state directory and local Worker dev vars file.
.github/workflows/deploy.yml Adds a Worker deploy step on main (after Pages deploy).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/deploy.yml Resolved
Comment thread worker/src/logger.ts Resolved
Comment thread worker/src/logger.ts Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd4c81115d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/deploy.yml Resolved
FlyOverCoderKY and others added 2 commits July 27, 2026 19:58
The org is on us5; shipping to the us1 host silently dropped Worker logs.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep Worker redeploys aligned with Pages on schedule/dispatch; prevent
attribute override of service identity; normalize DATADOG_SITE; document
Workers:Edit on the shared CI token.

Co-authored-by: Cursor <cursoragent@cursor.com>
@FlyOverCoderKY
FlyOverCoderKY merged commit aa32278 into main Jul 28, 2026
1 check passed
@FlyOverCoderKY
FlyOverCoderKY deleted the wire-pegma-logger-workers branch July 28, 2026 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants