feat(log-collector): implement stream error handling with process failure#1715
feat(log-collector): implement stream error handling with process failure#1715ygrishajev merged 3 commits intomainfrom
Conversation
…lure - Add stream event handlers for proper lifecycle management - Implement custom Promise to handle stream errors and propagate failures - Enable "let it fail" strategy for automatic recovery via Kubernetes restarts - Fix test coverage for new error handling logic Resolves hanging issues when log streams terminate unexpectedly.
WalkthroughA Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant K8sLogCollectorService
participant LogStream
participant LogDestinationService
Client->>K8sLogCollectorService: collectLogs(namespace, podName, logDestination)
K8sLogCollectorService->>LogStream: createLogStream(podName, namespace, logDestination)
K8sLogCollectorService->>LogStream: startKubernetesLogStream(...)
Note right of LogStream: Emits "end" or "error" events
LogStream-->>K8sLogCollectorService: "end" event
K8sLogCollectorService-->>Client: resolve Promise
LogStream-->>K8sLogCollectorService: "error" event
K8sLogCollectorService-->>Client: reject Promise, propagate error
K8sLogCollectorService->>LogDestinationService: Forward logs, log events
Estimated code review effort2 (~15 minutes) Possibly related PRs
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
📓 Path-based instructions (3)**/*.{ts,tsx}📄 CodeRabbit Inference Engine (.cursor/rules/general.mdc)
Files:
**/*.{js,jsx,ts,tsx}📄 CodeRabbit Inference Engine (.cursor/rules/general.mdc)
Files:
**/*.spec.{ts,tsx}📄 CodeRabbit Inference Engine (.cursor/rules/no-jest-mock.mdc)
Files:
🧠 Learnings (1)apps/log-collector/src/services/k8s-log-collector/k8s-log-collector.service.spec.ts (4)Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR 🧬 Code Graph Analysis (2)apps/log-collector/src/services/k8s-log-collector/k8s-log-collector.service.spec.ts (2)
apps/log-collector/src/services/k8s-log-collector/k8s-log-collector.service.ts (1)
🧰 Additional context used📓 Path-based instructions (3)**/*.{ts,tsx}📄 CodeRabbit Inference Engine (.cursor/rules/general.mdc)
Files:
**/*.{js,jsx,ts,tsx}📄 CodeRabbit Inference Engine (.cursor/rules/general.mdc)
Files:
**/*.spec.{ts,tsx}📄 CodeRabbit Inference Engine (.cursor/rules/no-jest-mock.mdc)
Files:
🧠 Learnings (1)apps/log-collector/src/services/k8s-log-collector/k8s-log-collector.service.spec.ts (4)Learnt from: CR Learnt from: CR Learnt from: CR Learnt from: CR 🧬 Code Graph Analysis (2)apps/log-collector/src/services/k8s-log-collector/k8s-log-collector.service.spec.ts (2)
apps/log-collector/src/services/k8s-log-collector/k8s-log-collector.service.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (8)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1715 +/- ##
==========================================
+ Coverage 72.41% 72.52% +0.10%
==========================================
Files 607 607
Lines 14162 14081 -81
Branches 2406 2401 -5
==========================================
- Hits 10256 10212 -44
- Misses 3586 3653 +67
+ Partials 320 216 -104
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
Resolves hanging issues when log streams terminate unexpectedly.
Summary by CodeRabbit
Documentation
Bug Fixes
Tests
Chores