resources_metadata previously reported only what the direct engine's state
contained, so terraform deploys reported nothing at all and the dashboard had
to fall back to the resource_*_count fields. Those cover 12 of the 32 resource
types, which made newer types (job_runs, genie_spaces, alerts, sql_warehouses,
postgres_*, ...) look like zero adoption. The count fields are deprecated in
the universe proto in favour of resources_metadata, so the gap is closed here
rather than by adding 20 more deprecated fields.
Counts now come from Resources.AllResources(), which is exhaustive by
construction, so a new resource type is reported the moment it ships with no
telemetry change. resources_metadata is emitted for terraform deploys too,
carrying counts without state sizes since the terraform path leaves
StateSizeBytes zero. The engine that ran the deploy is recorded on Metrics so
state_engine reflects it.
Also adds .agent/rules/telemetry.md, which documents the procedure and the rule
not to extend the deprecated count fields.
Changes
resources_metadataonly covered direct deploys, so terraform deploys emitted nothing at all. Counts now come fromResources.AllResources()and are emitted for both engines, withstate_enginereporting the engine that ran. Sizes remain direct-only, since the terraform path leavesStateSizeByteszero.Comments in
libs/telemetry/protosare updated to record the deprecation, and.agent/rules/telemetry.mddocuments the procedure so the next person doesn't extend the deprecated fields.Behaviour change: for direct deploys
countis now config-derived, so a declared-but-not-yet-deployed resource is counted and sub-resource state entries no longer inflate the parent type's count. Types present only in state keep their state-derived count.Why
Dashboards fall back to the
resource_*_countfields, which cover 12 of the 32 resource types, so newer types (job_runs,genie_spaces,alerts,sql_warehouses,postgres_*, …) look like zero adoption.The obvious fix is to add the 20 missing fields, but they are
deprecated = truein the universe proto, superseded byresources_metadata.resources[*].count. Extending them would recreate exactly the problemresources_metadatawas introduced to solve: a hand-maintained field list that silently lags the resource types. Deriving counts fromAllResources()instead means a new resource type is reported the moment it ships, with no telemetry change and no proto change — which is also what the proto already specifies ("declared in the bundle configuration").Tests
TestResourceMetadataCoversAllResourceTypesputs one resource of every type inconfig.Resourcesand asserts each is reported, so a type dropping out ofAllResources()fails loudly.out.resources_metadata.terraform.txt: per-type counts instead ofnull.