Repository navigation
refactor(observability): one home for the task annotations telemetry reads - #407
Draft
yuechao-qin wants to merge 1 commit into
Draft
yuechao-qin wants to merge 1 commit into
yuechao-qin wants to merge 1 commit into
Conversation
yuechao-qin
force-pushed
the
ycq/observability-02-annotation-readers-refactor
branch
2 times, most recently
from
October 26, 2026 20:48
f1622ba to
94bbbe8
Compare
…reads The cloud_provider key was declared twice in instrumentation/, and the three resource keys were reached by importing a launcher purely to borrow its constants. Collects every read into instrumentation/execution_annotations.py: the resource keys are aliased from kubernetes_launchers rather than respelled, and cloud_provider -- which no launcher owns, since routing sets it -- is declared once. Also adds Target and register_targets(), the lookup that turns whatever a task's provider annotation says into a provider and a cluster. A provider that declares no clusters of its own registers the annotation key its tasks use, so no deployment-specific key appears in this repository. Pure readers: task_spec is a loaded column, never a relationship, so these are safe inside before_commit where a lazy load would put a SELECT in the commit path. No behaviour change.
yuechao-qin
force-pushed
the
ycq/observability-02-annotation-readers-refactor
branch
from
October 27, 2026 16:33
94bbbe8 to
70e6786
Compare
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.
What
Four annotation keys were read from three different modules, one of which imported a
Kubernetes launcher purely to borrow its constants. This puts every read in one place
and adds the lookup that turns whatever a task's provider annotation says into a
provider and a cluster.
No behaviour changes. Every value emitted today is still emitted, identically.
Why
The metric emitter is about to become a fourth reader, and it runs inside
before_commit:That last line is the problem. The cluster a task ran on is not in its annotations —
the annotation holds a key or an alias, and only the deployment's launcher config says
which cluster each resolves to. Reading that config per status change would put a file
read inside a database commit.
So the mapping is registered once at startup and looked up in memory.
Changes
CLOUD_PROVIDER_KEYkubernetes_launchers, not respelled, so a rename there cannot silently empty these readerscloud_provider()target()Target(provider, cluster)through the registered mapaccelerators(){"X":"1"}and{"X": "1"}parse to one requestregister_targets()Target.cluster_from_annotationcovers a provider that declares no clusters of its ownand lets each task name one. The deployment registers that annotation key, so no
deployment-specific key appears in this repository.
Every reader is pure —
task_specis a loaded column, never a relationship — so all ofthem are safe inside
before_commit, where a lazy load would put a SELECT in thecommit path.
The caller arrives separately:
targeting/routing.pyin Shopify's oasis-backend buildsthe map from its launcher config at
create_launcher(). Until something callsregister_targets, the map is empty andtarget()returnsNone, which is the sameanswer it gives for an unrecognised value.
Tests