feat: implement distributed lock timeouts, synthetic monitoring, prov… - #325
Open
feyisaralawal wants to merge 1 commit into
Open
feat: implement distributed lock timeouts, synthetic monitoring, prov…#325feyisaralawal wants to merge 1 commit into
feyisaralawal wants to merge 1 commit into
Conversation
…ider performance metrics, and distributed tracing Resolves Pidoko257#250, Pidoko257#259, Pidoko257#258, Pidoko257#257 Closes Pidoko257#250 Closes Pidoko257#259 Closes Pidoko257#258 Closes Pidoko257#257 Detailed Explanation of Changes & Technical Implementation: 1. Distributed Transaction Lock with Timeout (Closes Pidoko257#250) - Enhanced LockManager in src/utils/lock.ts to support AcquireOptions (configurable ttl, timeoutMs, retryCount, retryDelay, exponential backoffFactor). - Implemented LockAcquisitionTimeoutError to prevent processes from blocking indefinitely during high contention. - Integrated Promise.race to enforce timeout constraints per lock operation. - Added Prometheus metrics in src/utils/metrics.ts (lock_acquisition_total, lock_contention_total, lock_acquisition_duration_seconds) to track contention and acquisition latencies. 2. Synthetic Monitoring for Critical Flows (Closes Pidoko257#259) - Built src/services/syntheticMonitoringService.ts to execute synthetic deposit, withdraw, and dispute transactions. - Used SYNTHETIC_ prefixed references and isolated sandbox data to ensure zero impact on production data. - Created src/jobs/syntheticMonitoringJob.ts and registered it in src/jobs/scheduler.ts to execute every minute. - Exposed Prometheus metrics (synthetic_test_total, synthetic_test_duration_seconds, synthetic_test_success, synthetic_consecutive_failures) and integrated high-priority PagerDuty alerting within 2 minutes of consecutive flow failures. 3. Custom Metrics for Provider-Specific Performance (Closes Pidoko257#258) - Developed src/services/providerMetricsService.ts to track 5-minute sliding window success rates, request counts, and execution latencies for mobile money providers (MTN, Airtel, Orange). - Enhanced circuit breaker execution in src/utils/circuitBreaker.ts to record provider metrics and emit alerts on provider degradation (<85% success rate). - Provisioned Grafana dashboard configuration (config/grafana/dashboards/provider_performance_comparison.json) comparing provider success rates, circuit breaker states, P95 latencies, and degradation alerts. 4. Distributed Tracing for Cross-Service Requests (Closes Pidoko257#257) - Enhanced src/tracer.ts with configurable sampling rates (TRACE_SAMPLE_RATE), context injection/extraction, and active trace metrics. - Created Express distributed tracing middleware src/middleware/tracing.ts to extract trace headers (x-trace-id, traceparent, x-datadog-trace-id) and propagate context downstream. - Instrument ingest-go/main.go to parse trace headers from incoming callback requests, tag Redis Stream messages with trace_id, and propagate trace IDs in HTTP responses.
|
@feyisaralawal 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! 🚀 |
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.
…ider performance metrics, and distributed tracing
Resolves #250, #259, #258, #257
Closes #250
Closes #259
Closes #258
Closes #257
Detailed Explanation of Changes & Technical Implementation:
Description
Brief description of changes.
Related Issue
Fixes #(issue number)
Type of Change
Changes Made
Testing
How did you test these changes?
Checklist
Screenshots (if applicable)
Additional Notes