feat(worker): add generic Prometheus metrics to WorkerRunner + wire workers - #176
Open
extreme4all wants to merge 1 commit into
Open
feat(worker): add generic Prometheus metrics to WorkerRunner + wire workers#176extreme4all wants to merge 1 commit into
extreme4all wants to merge 1 commit into
Conversation
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
Adds generic Prometheus metrics to the shared
WorkerRunnerframework and wires a metrics server into the framework-based workers.Changes
Framework (
components/bot_detector/worker/)metrics.py: 7 generic metrics +start_metrics_server(port)(idempotent, no-op underENVIRONMENT=test)core.py:WorkerRunnergains a requiredworker_nameparam;_consume()emits the metricsstart_metrics_serverfrom the componentGeneric metrics (all labeled by
worker):worker_messages_consumed_totalworker_messages_committed_totalworker_messages_requeued_totalreason(worker_error/requeue/error/cancelled)worker_batch_sizeworker_handle_duration_secondshandle()worker_batch_errors_totalhandle()byerror_typeworker_poll_idle_totalWorkers (each:
start_metrics_server()at startup +worker_name)**worker_hiscore→"hiscore"worker_report→"report"worker_ban_migration→"ban_migration"(also refactored its basemetrics.pyto drop the duplicatestart_http_server, now centralized)Projects
prometheus-client==0.22.0toworker_hiscoreandworker_report(+ re-locked).worker_mlskipped (doesn't use theworkercomponent);worker_ban_migrationalready had it.Validation
ruff check/ruff format --check: cleanpytest: 127 passed+prometheus-client(rest isuv lockreformatting)Related