mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
``` // Report a metric only if the preset uses the latest version of the template and the template is not deleted. // This avoids conflicts between metrics from old and new template versions. // // NOTE: Multiple versions of a preset can exist with the same orgName, templateName, and presetName, // because templates can have multiple versions — or deleted templates can share the same name. // // The safest approach is to report the metric only for the latest version of the preset. // When a new template version is released, the metric for the new preset should overwrite // the old value in Prometheus. // // However, there’s one edge case: if an admin creates a template, it becomes hard-limited, // then deletes the template and never creates another with the same name, // the old preset will continue to be reported as hard-limited — // even though it’s deleted. This will persist until `coderd` is restarted. ```