global: BIG snapshot

This commit is contained in:
nym21
2026-01-04 01:47:03 +01:00
parent c33444a92e
commit 3cae817915
127 changed files with 4750 additions and 9474 deletions
+6 -6
View File
@@ -2,17 +2,17 @@
import { localhost } from "../utils/env.js";
/** @type {Set<MetricAccessor<any>> | null} */
/** @type {Set<AnyMetricPattern> | null} */
export const unused = localhost ? new Set() : null;
/**
* Walk and collect MetricAccessors
* Walk and collect AnyMetricPatterns
* @param {TreeNode | null | undefined} node
* @param {Set<MetricAccessor<unknown>>} set
* @param {Set<AnyMetricPattern>} set
*/
function walk(node, set) {
if (node && "by" in node) {
set.add(/** @type {MetricAccessor<unknown>} */ (node));
set.add(/** @type {AnyMetricPattern} */ (node));
} else if (node && typeof node === "object") {
for (const value of Object.values(node)) {
walk(/** @type {TreeNode | null | undefined} */ (value), set);
@@ -21,7 +21,7 @@ function walk(node, set) {
}
/**
* Collect all MetricAccessors from tree
* Collect all AnyMetricPatterns from tree
* @param {TreeNode} tree
*/
export function collect(tree) {
@@ -30,7 +30,7 @@ export function collect(tree) {
/**
* Mark a metric as used
* @param {MetricAccessor<any>} metric
* @param {AnyMetricPattern} metric
*/
export function markUsed(metric) {
unused?.delete(metric);