Skip to content

feat: ✨ Add request based logging and update dependencies#1

Merged
faizanazim11 merged 1 commit intomainfrom
feat/request-id-based-logging
Sep 25, 2025
Merged

feat: ✨ Add request based logging and update dependencies#1
faizanazim11 merged 1 commit intomainfrom
feat/request-id-based-logging

Conversation

@faizanazim11
Copy link

This pull request introduces several improvements and new features to the Jetpack microservice utility library, focusing on developer experience, code quality, and observability. The most significant changes include enhanced documentation (including a new Copilot instructions file and a changelog), upgrades to logging and response metadata with correlation ID support, improved error handling, expanded testing infrastructure, and updates to dependencies and project configuration.

Documentation & Developer Guidance:

  • Added a comprehensive .github/copilot-instructions.md file detailing code style, architecture patterns, testing strategies, file organization, and best practices for contributors and Copilot usage.
  • Introduced a CHANGELOG.md following Keep a Changelog format, documenting all notable changes and features for version history.
  • Expanded the README.md with a detailed overview, installation and usage instructions, environment variables, API reference, FastAPI integration examples, and contribution guidelines.

Logging & Observability:

  • Enhanced structured logging by integrating asgi-correlation-id for correlation ID propagation, adding a CorrelationIdFilter to log handlers, and updating log formats to include correlation IDs. [1] [2] [3] [4]
  • Updated dependencies to require asgi-correlation-id and ensured type hints and logging improvements are reflected in the configuration.

Response & Error Handling:

  • Refactored response schemas to use a new RequestMeta model with default factories for correlation ID and timestamp, ensuring every response includes traceable metadata.
  • Improved FastAPI request validation error handling to use the correct status code (422 Unprocessable Content) and provide error details in a standardized format.

Testing & CI/CD:

  • Added a new GitHub Actions workflow (.github/workflows/tests.yaml) for automated testing and coverage on pull requests, using uv for environment management.
  • Created tests/conftest.py with reusable pytest fixtures for environment isolation, temporary directories, and sample configurations, supporting comprehensive and reliable test coverage.
  • Updated development dependencies to include pytest-cov and configured coverage to omit test and script files.

Configuration & Dependency Management:

  • Improved configuration merging logic in config.py to handle None values gracefully for base paths and module names.
  • Upgraded pre-commit hooks and linting tools to latest versions for better code quality enforcement.
  • Bumped project version to 0.2.0 to reflect these significant enhancements.

These changes collectively improve Jetpack's reliability, maintainability, and developer experience, setting a strong foundation for future development.

Copilot AI review requested due to automatic review settings September 25, 2025 18:35
Copy link

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

This pull request enhances the Jetpack microservice utility library with comprehensive testing infrastructure, improved logging with correlation ID tracking, updated response schemas, and expanded documentation. The changes focus on improving developer experience, code quality, and observability.

  • Adds comprehensive test coverage with 407 new test cases across all modules
  • Integrates asgi-correlation-id for request tracing in logging and response metadata
  • Updates response schemas to use RequestMeta with factory functions for correlation IDs and timestamps

Reviewed Changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_responses.py Comprehensive tests for response schemas and RequestMeta correlation ID handling
tests/test_log_config.py Tests for logging configuration with correlation ID filter integration
tests/test_exception_handlers.py Tests for FastAPI exception handlers with improved validation error handling
tests/test_errors.py Tests for GenericErrors exception class with various initialization scenarios
tests/test_config.py Tests for configuration management with environment variable handling
tests/conftest.py Pytest fixtures for environment isolation and temporary directories
src/jetpack/responses.py Updated RequestMeta with correlation ID factory functions
src/jetpack/log_config.py Added correlation ID filter to logging configuration
src/jetpack/errors/exception_handlers.py Fixed validation error status code to HTTP 422
src/jetpack/config.py Improved None value handling in path configuration
pyproject.toml Version bump and added asgi-correlation-id dependency
README.md Expanded documentation with usage examples and API reference
CHANGELOG.md Added changelog following Keep a Changelog format
.pre-commit-config.yaml Updated pre-commit hook versions
.github/workflows/tests.yaml Added GitHub Actions CI workflow
.github/copilot-instructions.md Added comprehensive development guidelines

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@faizanazim11 faizanazim11 merged commit 27a61f7 into main Sep 25, 2025
2 checks passed
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