Skip to content

Log only valid API requests to R2#53

Merged
aaronparker merged 4 commits into
mainfrom
fix-r2
Oct 26, 2025
Merged

Log only valid API requests to R2#53
aaronparker merged 4 commits into
mainfrom
fix-r2

Conversation

@aaronparker

Copy link
Copy Markdown
Collaborator

Updated R2 logging to only log requests to main API endpoints, excluding health checks and invalid paths. Added logic to determine valid endpoints and a flag to control logging behavior.

Updated R2 logging to only log requests to main API endpoints, excluding health checks and invalid paths. Added logic to determine valid endpoints and a flag to control logging behavior.
@aaronparker aaronparker requested a review from Copilot October 26, 2025 01:24
@aaronparker aaronparker self-assigned this Oct 26, 2025
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 26, 2025

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
evergreen-api ae6b052 Oct 26 2025, 02:17 AM

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 updates R2 logging to filter requests before storage, ensuring only valid API endpoint requests are logged while excluding health checks and invalid paths. This optimization reduces storage costs and focuses logs on meaningful API usage.

Key Changes:

  • Added endpoint validation logic to determine which requests should be logged
  • Modified storeLogToR2 function to accept a shouldLog parameter
  • Implemented conditional logging in the fetch event listener based on endpoint validation

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

Comment thread src/index.js Outdated
Comment thread src/index.js Outdated
Comment thread src/index.js Outdated
aaronparker and others added 3 commits October 26, 2025 12:51
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@aaronparker aaronparker merged commit 96ce6dd into main Oct 26, 2025
13 of 14 checks passed
@aaronparker aaronparker deleted the fix-r2 branch October 26, 2025 02:18
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