-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
DB Integration & Observability
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Overview
Scope: yaml-language-server improvements only. Promote buildscripts/idl/metrics_schema.yml to a repo-wide glob for _metrics.idl so every metrics IDL file gets editor validation without a per-file modeline comment, by first freeing the _metrics.idl pattern from legacy occupants.
Background
The _metrics.idl pattern is currently occupied by ordinary IDL files that predate the framework (replication_metrics.idl, query_stats_metrics.idl, read_preference_metrics.idl, server_write_concern_metrics.idl, log_server_manager's metrics file, and any other glob matches; scan for the full list). They are plain structs: files that happen to carry "metrics" in the name. SERVER-138331 now enforces the forward naming rule in the parser (ID125: metrics blocks require _metrics.idl, with metrics_sections.idl allowlisted), so the glob is the remaining piece of the convention.
Scope of Work
- Scan the repo for every _metrics.idl file not using the metrics grammar; rename them to non-matching names (e.g. _stats.idl), updating BUILD.bazel targets, .auto_header references, includes, and any generated-output references. Note: these files currently keep the explain-verbosity dep via the filename-keyed skip in the idl_generator macro; renaming moves them to the ordinary path, which is fine.
- Configure a repo-wide yaml-language-server setting mapping *_metrics.idl to buildscripts/idl/metrics_schema.yml (e.g. VS Code settings + whatever other editors the repo documents), and remove the now-redundant modeline comments from the framework's metrics files (codegen_test_metrics.idl; metrics_sections.idl does not match the glob and keeps its modeline or is allowlisted).
- Document the convention: metrics-grammar files (metrics_section: / metrics_structs: / metrics: blocks) are named *_metrics.idl and live next to the owning code; the metrics_section: block is only legal in mongo/observability/metrics_sections.idl (build-time enforcement of that lands via SERVER-138451).
Out of scope (tracked elsewhere)
- Forward-direction naming enforcement: DONE in SERVER-138331 (parser ID125 + repo-scan test).
- TODO: reverse-direction check (a *_metrics.idl file that declares none of the metrics blocks is an error) once all legacy occupants are renamed; the TODO lives in the parser and the scan test.
- The framework filename metrics_sections.idl is hardcoded in two places (parser allowlist and the scan test); if it ever moves, both need edits.
- is blocked by
-
SERVER-138331 Codegen to create metrics structs (<file>_metrics_gen.h/cpp and metrics_sections.idl)
-
- In Code Review
-