compute: add ComputeRuntimeRole and role-labeled metrics#37884
Open
antiguru wants to merge 1 commit into
Open
Conversation
Introduce `ComputeRuntimeRole` (Solo, Maintenance, Interactive) and thread a role through `serve` into `ComputeMetrics::register_with`. Each named role stamps a distinct `role` const label on its metrics so that two compute runtimes sharing one process registry register distinct series rather than colliding, and gates the whole-registry `workload_class` postprocessor on the globals-owning role so it is installed exactly once. `Solo` is the single-runtime default and is behaviorally identical to compute before a second runtime existed: it emits no `role` label, so exact-match dashboards and alerts are byte-unchanged, and it owns the process globals as the sole runtime always has. Every call site passes `Solo` here. The maintenance and interactive runtimes that use the other roles arrive with the two-runtime work that builds on this. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CY7GHdrTBfAG4tgvSgPGJ9
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.
Motivation
The two-runtime read-isolation work (#37770) runs two compute runtimes in a
single clusterd process, sharing one metrics registry. Without per-runtime
labels the two runtimes register the same metric series and collide. This PR
adds the role concept and the metric labeling on its own, so that the
two-runtime PR is left with only the runtime wiring.
Description
Introduce
ComputeRuntimeRole(Solo,Maintenance,Interactive) inmz_compute::serverand thread a role throughserveintoComputeMetrics::register_with. Each named role stamps a distinctroleconst label on its metrics, so two runtimes sharing one process registry
register distinct series rather than colliding. The whole-registry
workload_classpostprocessor is gated on the globals-owning role so it isinstalled exactly once.
Solois the single-runtime default and is behaviorally identical to computebefore a second runtime existed: it emits no
rolelabel, so exact-matchdashboards and alerts are byte-unchanged, and it owns the process globals as
the sole runtime always has. Every call site passes
Solohere.Two unit tests assert the two halves of the contract:
Solometrics carry norolelabel, and the two named roles carry distinct labels so they coexist onone registry.
Context
Prerequisite for #37770, which flips the call sites to
MaintenanceandInteractiveand adds the runtimes that use them. Independent of the other#37770 prerequisites (#37880, #37881).
Verification
cargo check -p mz-compute -p mz-clusterdpasses with no new warnings. The twonew
metrics::testspass.🤖 Generated with Claude Code
https://claude.ai/code/session_01CY7GHdrTBfAG4tgvSgPGJ9