Skip to content

Feature/issue 176 profiling#196

Closed
rayeberechi wants to merge 43 commits intoSynapse-bridgez:mainfrom
rayeberechi:feature/issue-176-profiling
Closed

Feature/issue 176 profiling#196
rayeberechi wants to merge 43 commits intoSynapse-bridgez:mainfrom
rayeberechi:feature/issue-176-profiling

Conversation

@rayeberechi
Copy link
Copy Markdown

@rayeberechi rayeberechi commented Feb 26, 2026

closes #176

victorisiguzoruzoma874 and others added 30 commits February 22, 2026 20:39
…ure/issue-27-api-versioning

 API Versioning Strategy (Architecture)
Synapse-bridgez#78)

Implemented 8 integration test cases covering:
- All services healthy validation
- Database unavailability detection
- Redis unavailability detection
- Horizon unavailability detection
- ValidationReport generation and structure
- Environment validation with empty/invalid configs
- Multiple simultaneous service failures

Technical details:
- Uses testcontainers for isolated PostgreSQL instances
- Applies migrations automatically for each test
- Tests real service connectivity (Horizon testnet API)
- Validates error reporting and ValidationReport structure
- CI/CD ready with no external dependencies

Also fixed duplicate AllowedIps enum definition in src/config.rs

Closes Synapse-bridgez#78
…re (Issue Synapse-bridgez#76)

Implemented 13 integration test cases covering:
- Request ID generation and uniqueness
- Logging with different HTTP methods (GET, POST)
- Query parameter logging
- Error response logging
- Request body logging with sanitization
- Nested sensitive data handling
- Large body handling (payload size limits)
- Non-JSON body handling
- Multiple concurrent requests

Technical details:
- Tests request ID UUID v4 format validation
- Verifies sensitive data sanitization integration
- Tests MAX_BODY_LOG_SIZE enforcement (1KB limit)
- Validates LOG_REQUEST_BODY environment variable behavior
- Ensures proper cleanup of environment variables
- CI/CD ready with no external dependencies

Also fixed duplicate auth module in src/middleware/mod.rs and added request_logger module export

Closes Synapse-bridgez#76
- Created tests/search_test.rs with 12 test cases covering:
  * Search by status filter
  * Search by asset code
  * Search by date range
  * Pagination with cursor
  * Empty results
  * Invalid query parameters
  * Combined filters
  * Stellar account search
  * Amount range filtering
  * Limit boundaries
  * Cursor behavior on last page
  * Result ordering verification

- Added search_transactions_wrapper to src/handlers/search.rs for ApiState compatibility
- Registered /transactions/search route in src/lib.rs create_app function
- Implemented seed_test_data helper for predictable test assertions
- test_cursor_encode_decode_roundtrip: Verifies round-trip encoding and decoding
- test_cursor_decode_invalid_base64: Tests error handling for invalid base64 input
- test_cursor_decode_malformed_data: Tests error for data without separator
- test_cursor_decode_invalid_uuid: Tests error for invalid UUID format
- test_cursor_decode_invalid_timestamp: Tests error for invalid RFC3339 timestamp

All error cases return descriptive error messages as required.
- Created tests/websocket_test.rs with 10 test cases covering:
  * Connection with valid token
  * Connection rejection with invalid/missing token
  * Transaction status update broadcasting
  * Multiple clients receiving broadcasts
  * Connection cleanup on disconnect
  * Heartbeat mechanism
  * Client message handling
  * Rapid broadcast handling
  * Empty token rejection
  * Connection lifecycle

- Added tx_broadcast field to AppState for WebSocket notifications
- Registered /ws route in create_app function
- Added ws and search modules to handlers/mod.rs
- Added tokio-tungstenite to dev-dependencies for WebSocket client testing
- Added HealthStatus and DbPoolStats structs to handlers/mod.rs
- Add missing id field to WebhookPayload struct
- Close the tests mod properly
- Regenerate Cargo.lock
…37-sanitization-utility

feat:sanitization utility test
 Database Query Performance Tracing (Observability)
…-startup-validation-tests

Request Logger Middleware Tests
…-request-logger-tests

Request Logger Middleware Tests
…ature/issue-67-search-tests

Transaction Search API Tests
…ature/issue-66-ws-tests

 WebSocket Handler Integration Tests
…cursor-tests

Feature/issue 70 cursor tests
…settlement-tests

Add settlement service unit tests
manuelusman73-png and others added 13 commits February 24, 2026 22:28
- Add test_asset_cache_initialization
- Add test_asset_cache_get
- Add test_asset_cache_concurrent_reads (50 concurrent tasks)
- Add test_asset_cache_reload
- Add test_asset_cache_empty
- Add test_asset_cache_clone_independence
- All 6 tests passing
- All CI checks passing
- Add test_create_month_partition
- Add test_create_month_partition_idempotent
- Add test_ensure_future_partitions
- Add test_detach_old_partitions
- Add test_parse_partition_name
- Add test_partition_error_handling_invalid_month
- Add test_partition_december_rollover
- Add test_ensure_future_partitions_multiple_years
- Add test_partition_retention_boundary
- Fix SQL syntax in partition creation
- Add proper error handling for invalid dates
- All 9 tests passing
- All CI checks passing
- Add test_audit_log_on_insert: Verifies audit log creation on transaction insert
- Add test_audit_log_on_status_change: Tests status change logging
- Add test_audit_log_on_field_update: Tests field update logging
- Add test_audit_log_on_deletion: Tests deletion event logging
- Add test_audit_log_query: Tests audit log querying and filtering
- Add test_audit_log_immutability: Demonstrates current lack of DB-level immutability

All tests pass successfully. Audit logs are properly created for all transaction lifecycle events.
- Add test_scheduler_job_execution: Verifies job registration and execution
- Add test_scheduler_cron_scheduling: Tests cron expression scheduling
- Add test_scheduler_job_error_handling: Tests error handling and retries
- Add test_scheduler_job_status: Tests job status tracking
- Add test_scheduler_shutdown: Tests graceful scheduler shutdown
- Add test_scheduler_invalid_cron: Tests invalid cron expression handling
- Add test_scheduler_multiple_jobs: Tests multiple concurrent jobs

All tests pass successfully. Uses short intervals to avoid long test times.
- Add test_ip_filter_allowed_ip: Tests allowed IP access
- Add test_ip_filter_blocked_ip: Tests blocked IP rejection
- Add test_ip_filter_xff_header: Tests X-Forwarded-For parsing
- Add test_ip_filter_xff_trusted_proxy_depth: Tests proxy depth handling
- Add test_ip_filter_cidr_range: Tests multiple CIDR ranges
- Add test_ip_filter_bypass_mode: Tests AllowedIps::Any mode
- Add test_ip_filter_connect_info_fallback: Tests ConnectInfo fallback
- Add test_ip_filter_connect_info_blocked: Tests ConnectInfo blocking
- Add test_ip_filter_ipv6_support: Tests IPv6 CIDR ranges
- Add test_ip_filter_no_xff_no_connect_info: Tests missing IP handling
- Add test_ip_filter_malformed_xff: Tests malformed header handling

All tests pass successfully with real HTTP stack integration.
- Add EnvSecretsManager for environment-based secret management
- Add test_secret_retrieval_from_env: Tests secret retrieval from environment
- Add test_secret_caching: Tests secret caching mechanism
- Add test_secret_missing_error: Tests error handling for missing secrets
- Add test_secret_rotation: Tests secret rotation functionality
- Add test_cache_clear: Tests cache clearing
- Add test_multiple_secret_retrievals: Tests multiple secret handling
- Add test_concurrent_access: Tests thread-safe concurrent access

All tests pass successfully. Includes caching and rotation support.
…ue-131-secrets-tests

Feature/issue 131 secrets tests
…graph generation

- Add pprof and flate2 dependencies for profiling capabilities
- Implement ProfilingManager for session management (CPU and memory profiling)
- Create profiling handler endpoints:
  - POST /admin/profiling/start - Start a profiling session
  - GET /admin/profiling/status - Get current session status
  - POST /admin/profiling/stop - Stop active profiling
  - GET /admin/profiling/flamegraph/:session_id - Serve flamegraph SVG
- Generate CPU flamegraphs using pprof integration
- Placeholder memory profiling implementation with SVG output
- Minimal performance impact when profiling is disabled
- Thread-safe ProfilingManager integrated into AppState
- Unit tests for profiling manager and session management
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.

Performance Profiling and Flame Graph Generation

7 participants