Conversation
manan164
added a commit
that referenced
this pull request
Feb 16, 2026
…stry This commit addresses two critical issues identified in PR #375: 1. Thread Safety in MetricsCollector: - Added threading.RLock() to protect concurrent access to internal dictionaries - All metric recording methods now use locks to prevent race conditions - Added comprehensive thread safety tests - Updated docstring to document thread-safe behavior Race condition scenario: Monitor thread calls increment_worker_restart() while main thread calls other metric methods, both modifying the same dictionaries without synchronization. 2. Parent Process Metrics Registry Issue: - Removed MetricsCollector instantiation in TaskHandler parent process - Parent process now uses prometheus_client Counter directly - Avoids confusion between parent and worker process metrics - Prevents stale metrics from parent PID lingering after worker restarts Problem: Parent process (coordinator) was writing metrics to the same multiprocess directory as worker processes, causing confusion about which PID corresponds to which worker. Testing: - Added tests/unit/telemetry/test_metrics_collector_thread_safety.py - Tests verify concurrent counter, gauge, and quantile operations - All existing tests should continue to pass Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
5 tasks
manan164
approved these changes
Feb 17, 2026
manan164
added a commit
that referenced
this pull request
Feb 17, 2026
Resolve conflicts after PR #375 was merged to main. Keep thread safety improvements (RLock in MetricsCollector, process lock in TaskHandler) while adopting main's cleaner lazy-init metrics counter and simpler process cleanup logic. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
workers.md).
Testing