feat(webhooks): add per-provider circuit breaker#306
Merged
mikewheeleer merged 2 commits intoMay 28, 2026
Merged
Conversation
|
@Elsa-tech2026 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
- Add missing SENSITIVE_KEYS definition in src/logger.ts - Fix WebhookDLQConfig export in src/queue/index.ts by importing DLQConfig as WebhookDLQConfig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closed: #284
Pino Structured Logging Implementation
Summary
This PR implements Pino-based structured logging with comprehensive redaction rules and request correlation ID support as requested in the issue.
What was implemented
webhookMetrics.ts
Added 'circuit_open' to FAILURE_REASONS — cardinality-safe label for fast-path deliveries
Added BREAKER_STATE_VALUES constant (CLOSED=0, OPEN=1, HALF_OPEN=2) for gauge encoding
Added webhookBreakerState Gauge to createWebhookMetrics() — per-provider, readable directly by dashboards without diffing counters
Core Logger Implementation
Request Correlation Middleware
Enhanced Features
Testing
Security Improvements
[REDACTED]Performance Benefits
Usage Examples
Basic Usage
Request-Scoped Logging
Child Loggers
Configuration
The logger supports environment-based configuration:
LOG_LEVEL: Set logging level (trace, debug, info, warn, error, fatal)NODE_ENV: Determines production vs development settingsHOSTNAME: Optional hostname for log contextMigration Notes
Testing
The implementation includes comprehensive tests covering:
To run tests (when Node.js environment is available):
Files Changed
src/logger.ts: Complete rewrite with Pino implementationsrc/logger.test.ts: Updated tests for new implementationsrc/middleware/requestLogger.ts: New request correlation middlewaresrc/middleware/requestLogger.test.ts: Tests for middleware functionalitypackage.json: Added Pino dependenciesThis implementation fully satisfies the requirements for secure, tested, and documented structured logging with comprehensive redaction rules and request correlation support.