Skip to content

Conversation

@HugoRCD
Copy link
Owner

@HugoRCD HugoRCD commented Feb 8, 2026

This pull request introduces a new enrichment hook for event logging, allowing for flexible addition of derived context to events before they are drained.
It adds a set of built-in enrichers for user agent, geo, request size, and trace context, and updates the Nitro plugin and documentation to support and demonstrate these features. The changes also improve header handling and event enrichment in both the main package and playground app.

@vercel
Copy link

vercel bot commented Feb 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
evlog-docs Ready Ready Preview, Comment Feb 8, 2026 5:56pm

@github-actions
Copy link

github-actions bot commented Feb 8, 2026

Thank you for following the naming conventions! 🙏

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 8, 2026

npm i https://pkg.pr.new/evlog@55

commit: ab369f1

@HugoRCD HugoRCD changed the title Add evlog:enrich hook and built-in enrichers feat: evlog:enrich hook and built-in enrichers Feb 8, 2026
@HugoRCD HugoRCD self-assigned this Feb 8, 2026
@HugoRCD HugoRCD requested a review from Copilot February 8, 2026 17:32
@HugoRCD HugoRCD marked this pull request as ready for review February 8, 2026 17:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a dedicated evlog:enrich Nitro hook that runs after emit() and before evlog:drain, plus a set of built-in enrichers to derive common context (UA/geo/sizes/trace) from request/response metadata.

Changes:

  • Introduces EnrichContext and registers the new evlog:enrich hook in Nitro hook typings.
  • Updates server request logging and the client ingest endpoint to run evlog:enrich before evlog:drain, with shared safe-header filtering and response metadata collection.
  • Adds built-in enrichers (user-agent, geo, request-size, trace-context), exports them as evlog/enrichers, and adds unit tests + docs.

Reviewed changes

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

Show a summary per file
File Description
packages/evlog/test/nitro-plugin.test.ts Updates tests to use shared header filtering and adds enrichment pipeline tests.
packages/evlog/test/enrichers.test.ts Adds comprehensive unit tests for the built-in enrichers.
packages/evlog/src/utils.ts Centralizes sensitive-header filtering via SENSITIVE_HEADERS + filterSafeHeaders.
packages/evlog/src/types.ts Adds EnrichContext and Nitro hook typing for evlog:enrich.
packages/evlog/src/runtime/server/routes/_evlog/ingest.post.ts Runs evlog:enrich before draining for client ingest, adds safe headers + waitUntil usage.
packages/evlog/src/nitro/plugin.ts Adds enrich→drain pipeline for server requests; collects safe request/response metadata.
packages/evlog/src/index.ts Exports EnrichContext from the main package entrypoint.
packages/evlog/src/enrichers/index.ts Implements built-in enrichers and related types/helpers.
packages/evlog/package.json Adds ./enrichers export + types mapping.
packages/evlog/build.config.ts Adds an enrichers build entry.
packages/evlog/README.md Documents the new hook and built-in enrichers (package-level docs).
apps/playground/server/plugins/evlog-enrich.ts Adds a playground example using evlog:enrich + enrichers.
README.md Documents the new hook/enrichers at the repo root.

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

@HugoRCD HugoRCD merged commit 5cc5418 into main Feb 8, 2026
12 checks passed
@HugoRCD HugoRCD deleted the codex/linear-mention-evl-52-enrichment-hook-evlog-enrich branch February 8, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant