Skip to content

Conversation

@itssimon
Copy link
Member

@itssimon itssimon commented Jan 4, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Improved request path extraction and handling when paths are missing or malformed.
    • Enhanced null/empty path and user-agent validation in request filtering.
  • Improvements

    • Expanded static resource exclusion patterns (favicons, manifests, robots.txt, service workers, etc.) to reduce unnecessary logging.

✏️ Tip: You can customize this high-level summary in your review settings.

@itssimon itssimon self-assigned this Jan 4, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 4, 2026

Walkthrough

Updated RequestLogger.java to expand excluded path patterns for static assets and special endpoints, and added defensive null/empty checks for request path extraction and user-agent validation to prevent null pointer exceptions during request logging.

Changes

Cohort / File(s) Summary
Request logging defensive handling
src/main/java/io/apitally/common/RequestLogger.java
Extended exclude path patterns with favicon, icons, robots.txt, sitemap.xml, manifest.json, site.webmanifest, service-worker.js, sw.js, and well-known endpoints. Added fallback path extraction from request URL when path is null/empty. Modified shouldExcludePath to treat null/empty paths as non-excludable. Updated shouldExcludeUserAgent to validate non-empty user-agent strings before pattern matching.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Extend EXCLUDE_PATH_PATTERNS' accurately describes the primary change in the pull request, which extends exclude path patterns to skip additional endpoints.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch extend-exclude-path-patterns

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7b6f75a and 8cbe72a.

📒 Files selected for processing (1)
  • src/main/java/io/apitally/common/RequestLogger.java
🔇 Additional comments (5)
src/main/java/io/apitally/common/RequestLogger.java (5)

51-60: LGTM! Well-chosen exclusion patterns for static assets.

The extended patterns appropriately cover common static assets (favicons, icons, manifests, service workers) and standard files (robots.txt, sitemap.xml) that shouldn't be logged as API requests. The regex patterns are correctly formed with proper escaping and anchoring.

Note: The /.well-known/ pattern intentionally lacks the $ anchor to match all well-known URIs (e.g., /.well-known/acme-challenge/...).


156-163: Excellent defensive path extraction with graceful fallback.

The hierarchical fallback approach (direct path → URL parsing → empty string) effectively prevents NPEs while ensuring malformed URLs are still logged for debugging purposes. This integrates well with the exclusion logic below.


165-165: Correct usage of derived path variable.

The exclusion check properly uses the defensively-extracted path variable, ensuring consistent behavior with the fallback logic.


382-384: Good defensive check for empty paths.

Extending the check to include isEmpty() aligns with the fallback logic in logRequest and ensures that requests with indeterminate paths are logged rather than silently excluded.


390-392: Good defensive check for empty user-agent.

Requiring a non-empty user-agent before pattern matching prevents NPEs and avoids unnecessary regex operations on empty strings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Jan 4, 2026

Codecov Report

❌ Patch coverage is 22.22222% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.28%. Comparing base (7b6f75a) to head (8cbe72a).

Files with missing lines Patch % Lines
...rc/main/java/io/apitally/common/RequestLogger.java 22.22% 4 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main      #44      +/-   ##
============================================
- Coverage     77.81%   77.28%   -0.54%     
+ Complexity      314      313       -1     
============================================
  Files            31       31              
  Lines          1055     1061       +6     
  Branches        133      134       +1     
============================================
- Hits            821      820       -1     
- Misses          159      163       +4     
- Partials         75       78       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@itssimon itssimon merged commit a59cf90 into main Jan 4, 2026
14 of 16 checks passed
@itssimon itssimon deleted the extend-exclude-path-patterns branch January 4, 2026 13:07
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