-
Notifications
You must be signed in to change notification settings - Fork 12
feat: implemented metrics feature to track workers #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds a Metrics abstraction and wires per-job metrics (submitted, completed, successful, failed) across workers and queues; extends Worker with Metrics() and NumPending(); updates constructors to record success/failure; provides tests, a Prometheus example, and enables the race detector for tests. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Queue
participant Worker
participant Metrics
participant JobProcessor
Client->>Queue: Add(job)
Queue->>Metrics: incSubmitted()
Metrics->>Metrics: submitted++
Queue->>Worker: notify / wake
Worker->>JobProcessor: dequeue & execute
JobProcessor->>JobProcessor: run job
alt success
JobProcessor->>Metrics: incSuccessful()
Metrics->>Metrics: successful++
else failure
JobProcessor->>Metrics: incFailed()
Metrics->>Metrics: failed++
end
JobProcessor->>Metrics: incCompleted()
Metrics->>Metrics: completed++
Client->>Worker: Metrics()
Worker-->>Client: Metrics instance
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…the worker interface, implementation, and usage.
NumPendingwith worker to provide the number of pending tasks