@uptimizr/metrics 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md ADDED
@@ -0,0 +1,69 @@
1
+ # AGENTS.md — @uptimizr/metrics
2
+
3
+ > Packaged agent guide. For the human reference see [README.md](./README.md); for design
4
+ > rationale see the project ADRs at https://github.com/RaananW/Uptimizr/tree/main/docs/adr.
5
+
6
+ ## What this package is
7
+
8
+ The **semantic metric registry**: one machine-readable `MetricDefinition` per Uptimizr analytics
9
+ metric. It is the single source of truth for _what can be asked_ of a collector — the endpoint, the
10
+ filters, the shape and units of a row, the row caps, how to read the answer and what not to trust.
11
+
12
+ It is **pure data**: `zod` and a type-only `@uptimizr/schema` import, nothing else. No `node:`
13
+ built-in, no DOM, no database driver. Import it from a browser bundle, a worker or an `npx` CLI.
14
+
15
+ ## Install
16
+
17
+ ```bash
18
+ pnpm add @uptimizr/metrics
19
+ ```
20
+
21
+ ## Canonical usage
22
+
23
+ ```ts
24
+ import { allMetrics, getMetric, METRIC_IDS, type MetricDefinition } from "@uptimizr/metrics";
25
+
26
+ // Everything callable, as data.
27
+ for (const metric of allMetrics()) {
28
+ metric.id; // the tool name / DSL metric name
29
+ metric.endpoint?.path; // the collector route, when one exists
30
+ metric.filters; // exactly the endpoint's querystring keys
31
+ metric.row; // z.ZodObject — one row
32
+ metric.limits.maxRows; // the hard cap; never ask for more
33
+ }
34
+
35
+ const metric: MetricDefinition | undefined = getMetric("perf_summary");
36
+ ```
37
+
38
+ ## Rules for agents
39
+
40
+ - **Derive, never restate.** Tool catalogs, OpenAPI paths, capability lists and docs tables are
41
+ generated from this registry. If you find a hand-written table of endpoints or tools, it is a bug
42
+ — regenerate it with `pnpm gen:docs` instead of editing it.
43
+ - **A new aggregation is not done until it has a registry entry.** Add the `build*` name to
44
+ `AGGREGATION_BUILDER_NAMES` and a `MetricDefinition` to `METRIC_REGISTRY`; the
45
+ `NoUnregisteredAggregations` type fails the build otherwise.
46
+ - **Keep this package dependency-free.** It exists so that `@uptimizr/agent-core`,
47
+ `@uptimizr/mcp` and `@uptimizr/react` never pull in `@uptimizr/db`'s ~37 MB native DuckDB
48
+ binding. Do not import `@uptimizr/db`, a `node:` built-in, or anything with a native/optional
49
+ binary dependency. A test in this package enforces that.
50
+ - **Ids are a public contract.** A `MetricId` is the MCP tool name an existing client already
51
+ calls. Rename nothing; add instead.
52
+ - **Respect `limits`.** `maxRows` is the registry's promise that no answer is unbounded;
53
+ `maxSummaryRows` is what a model should be shown.
54
+ - **Read `caveats` before you conclude anything.** They record small-sample, sampling-rate and
55
+ capture-gating conditions — a metric with no enabled source channel returns an honest empty
56
+ result, not a zero.
57
+ - **`null` is not `0`.** An aggregate over no samples is SQL `NULL` and means "no data".
58
+
59
+ ## Where the SQL lives
60
+
61
+ The `build*` aggregation each entry names is in [`@uptimizr/db`](../db)'s
62
+ `src/query/aggregations.ts`. This package deliberately does **not** import it — the link between
63
+ the two is asserted at runtime by `@uptimizr/db`'s `src/__tests__/registry.test.ts`.
64
+
65
+ ## More
66
+
67
+ - Package reference: [README.md](./README.md)
68
+ - Query API: https://uptimizr.com/docs/api/query/
69
+ - ADR 0051 (AI-first analytics layer), ADR 0050 (browser-safe agent core), ADR 0020 (storage boundary)
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or Derivative
95
+ Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and do
117
+ not modify the License. You may add Your own attribution notices
118
+ within Derivative Works that You distribute, alongside or as an
119
+ addendum to the NOTICE text from the Work, provided that such
120
+ additional attribution notices cannot be construed as modifying
121
+ the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions for
125
+ use, reproduction, or distribution of Your modifications, or for any
126
+ such Derivative Works as a whole, provided Your use, reproduction,
127
+ and distribution of the Work otherwise complies with the conditions
128
+ stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Uptimizr Contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # @uptimizr/metrics
2
+
3
+ > The **semantic metric registry** for Uptimizr: one machine-readable definition per analytics
4
+ > metric — what it measures, the collector endpoint that serves it, the filters it accepts, the
5
+ > Zod schema of one row, per-column units and semantics, row limits, how to read the result and
6
+ > what not to trust.
7
+
8
+ Everything that used to restate the query surface by hand is **derived** from this package: the
9
+ agent tool catalog in [`@uptimizr/agent-core`](../agent-core), the `uptimizr://capabilities`
10
+ resource and tool output schemas in [`@uptimizr/mcp`](../mcp), the collector's
11
+ `GET /api/v1/openapi.json` document, and the endpoint/tool tables in the docs. Coverage therefore
12
+ cannot drift: CI fails when an aggregation has no registry entry, when a row schema does not match
13
+ real query output, or when an endpoint's querystring keys diverge from its declared filters.
14
+
15
+ **Dependency-free and browser-safe.** The only runtime dependencies are `zod` and
16
+ `@uptimizr/schema` (imported type-only). No `node:` built-in, no DOM, no database driver — so a
17
+ browser bundle, an `npx` MCP client or an edge function can read the registry without pulling in
18
+ [`@uptimizr/db`](../db) and its ~37 MB `@duckdb/node-api` native binding.
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ pnpm add @uptimizr/metrics
24
+ ```
25
+
26
+ ## Quick start
27
+
28
+ ```ts
29
+ import { allMetrics, getMetric, METRIC_IDS } from "@uptimizr/metrics";
30
+
31
+ METRIC_IDS.length; // 71 metrics (69 aggregations + 2 store resources)
32
+
33
+ const metric = getMetric("top_meshes");
34
+ metric?.title; // "Most-interacted meshes"
35
+ metric?.endpoint?.path; // "/api/v1/meshes/top"
36
+ metric?.filters; // ["since", "until", "bins", "limit", "session"]
37
+ metric?.row; // z.ZodObject — the shape of one row
38
+ metric?.columns.count?.unit; // "count"
39
+ metric?.limits.maxRows; // the hard cap no consumer may exceed
40
+
41
+ // Everything an agent may call, grouped the way the docs group it:
42
+ const byCategory = Object.groupBy(allMetrics(), (m) => m.category);
43
+ ```
44
+
45
+ ## What a `MetricDefinition` carries
46
+
47
+ | Field | Meaning |
48
+ | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
49
+ | `id` | Stable snake_case id. Also the DSL metric name and the **agent tool name**. |
50
+ | `title`, `description` | Agent-facing prose: what it measures and what one row is. |
51
+ | `builder` | The `build*` aggregation in `@uptimizr/db` that computes it. Absent for the two **resource** entries (`session_meta`, `scene_representation`), which are store reads. |
52
+ | `endpoint` | `{ method, path, pathParams }` — the canned collector route, when one exists. |
53
+ | `grain` | What one row represents (`project`, `scene`, `session`, `mesh`, `bin`, `voxel`, `bucket`, `row`). |
54
+ | `dimensions` | The `DimensionId`s the rows are keyed by. Closed vocabulary. |
55
+ | `filters` | The `FilterId`s the endpoint accepts — exactly its Zod querystring keys. |
56
+ | `row` | `z.ZodObject` for one row: the source for OpenAPI, tool output schemas and numeric coercion. |
57
+ | `columns` | Per-column `{ description, unit, measure, label, rateOf }`. |
58
+ | `limits` | `{ maxRows, maxSummaryRows }` — no consumer can ask for an unbounded payload. |
59
+ | `interpretation` | How to read the result. |
60
+ | `caveats` | Small-sample, capture-gating and sampling-rate warnings. |
61
+ | `sourceChannels` | The `EventType` capture channels that feed it (ADR 0012). |
62
+ | `related`, `comparable` | Metrics worth reading alongside; comparison semantics for deltas. |
63
+ | `category` | Grouping used by the docs, the capabilities resource and the health score. |
64
+
65
+ ## Exports
66
+
67
+ **Data**
68
+
69
+ - `METRIC_REGISTRY` — the registry object, each entry's literal `builder` preserved.
70
+ - `METRIC_IDS` — every id, in declaration order.
71
+ - `FILTER_TARGETS` — every request parameter and the option field it drives.
72
+ - `DIMENSION_COLUMNS` — where each group-by dimension reads from in the event model.
73
+ - `AGGREGATION_BUILDER_NAMES` — every `build*` aggregation name `@uptimizr/db` exports.
74
+
75
+ **Helpers**
76
+
77
+ - `allMetrics()`, `getMetric(id)`, `isMetricId(value)`
78
+ - `metricForBuilder(builder)`, `isResourceMetric(metric)`
79
+
80
+ **Types**
81
+
82
+ `MetricDefinition`, `MetricId`, `MetricRegistry`, `MetricEndpoint`, `MetricGrain`,
83
+ `MetricCategory`, `MetricComparison`, `ColumnSemantics`, `ColumnUnit`, `DimensionId`, `FilterId`,
84
+ `FilterTarget`, `FilterOptionInterface`, `AggregationBuilderName`, `UnregisteredAggregation`,
85
+ `NoUnregisteredAggregations`.
86
+
87
+ ## Adding a metric
88
+
89
+ A new aggregation is **not done until it has a registry entry**. The loop:
90
+
91
+ 1. Add the `build*` aggregation in `@uptimizr/db`'s `src/query/aggregations.ts`.
92
+ 2. Add its name to `AGGREGATION_BUILDER_NAMES` here, and a `MetricDefinition` to
93
+ `METRIC_REGISTRY` keyed by the new `MetricId`.
94
+ 3. Serve it from the collector and run `pnpm gen:docs` — the docs, MCP and agent tables regenerate
95
+ themselves.
96
+
97
+ Four gates keep that honest:
98
+
99
+ - `NoUnregisteredAggregations` **fails to compile** when a declared builder has no entry.
100
+ - This package's `src/__tests__/registry.test.ts` checks coverage and internal consistency.
101
+ - `@uptimizr/db`'s `src/__tests__/registry.test.ts` asserts at runtime that
102
+ `AGGREGATION_BUILDER_NAMES` is exactly the set of `build*` exports, and that every `row` schema
103
+ parses the rows the aggregation really produces (run against DuckDB over the parity fixtures,
104
+ and again with every number string-encoded — the shape ClickHouse returns over HTTP).
105
+ - The collector's `registryRoutes.test.ts` asserts each entry's endpoint and filters match the Zod
106
+ querystring that actually serves it.
107
+
108
+ ## Why this is its own package
109
+
110
+ `@uptimizr/db` owns the SQL builders, the dialects and the DuckDB store, so it depends on
111
+ `@duckdb/node-api` — a ~37 MB native binding. The registry is pure data, and its consumers
112
+ (`@uptimizr/agent-core`, `@uptimizr/mcp`, `@uptimizr/react`) run in a browser or over `npx`, where
113
+ a database driver is dead weight they can never use. Splitting the registry out means
114
+ `npm i @uptimizr/react` and `npx @uptimizr/mcp` never download one. See ADR 0051 §1 and ADR 0050.
115
+
116
+ ## Links
117
+
118
+ - [Agent guide](./AGENTS.md)
119
+ - [Query API reference](https://uptimizr.com/docs/api/query/)
120
+ - [ADR 0051 — AI-first analytics layer](https://github.com/RaananW/Uptimizr/blob/main/docs/adr/0051-ai-first-analytics-layer.md)
121
+
122
+ ## License
123
+
124
+ Apache-2.0
@@ -0,0 +1,29 @@
1
+ /**
2
+ * `@uptimizr/metrics` — the semantic metric registry (ADR 0051 §1).
3
+ *
4
+ * One machine-readable {@link MetricDefinition} per Uptimizr analytics metric:
5
+ * what it measures, the collector endpoint that serves it, the filters it
6
+ * accepts, the Zod schema of one row, per-column units and semantics, row
7
+ * limits, how to read the result, and what not to trust. Everything that used to
8
+ * restate the query surface by hand — the agent tool catalog
9
+ * (`@uptimizr/agent-core`), the MCP capabilities resource and the OpenAPI
10
+ * document, the docs tables — is **derived** from this package, so coverage
11
+ * cannot drift.
12
+ *
13
+ * **Dependency-free and browser-safe.** The only runtime dependencies are `zod`
14
+ * and `@uptimizr/schema` (a type-only import). No `node:` built-in, no DOM, no
15
+ * database driver: the registry used to live in `@uptimizr/db`, which depends on
16
+ * the ~37 MB `@duckdb/node-api` native binding that a browser bundle or an `npx`
17
+ * MCP client can never use.
18
+ *
19
+ * ```ts
20
+ * import { allMetrics, getMetric } from "@uptimizr/metrics";
21
+ *
22
+ * const metric = getMetric("top_meshes");
23
+ * metric?.endpoint?.path; // "/api/v1/meshes/top"
24
+ * metric?.row; // z.ZodObject — the shape of one row
25
+ * ```
26
+ */
27
+ export { AGGREGATION_BUILDER_NAMES, DIMENSION_COLUMNS, FILTER_TARGETS, METRIC_BY_BUILDER, METRIC_IDS, METRIC_REGISTRY, allMetrics, getMetric, isMetricId, isResourceMetric, metricForBuilder, } from "./registry.js";
28
+ export type { AggregationBuilderName, ColumnSemantics, ColumnUnit, DimensionId, FilterId, FilterOptionInterface, FilterTarget, MetricCategory, MetricComparison, MetricDefinition, MetricEndpoint, MetricGrain, MetricId, MetricRegistry, NoUnregisteredAggregations, UnregisteredAggregation, } from "./registry.js";
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,UAAU,EACV,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,sBAAsB,EACtB,eAAe,EACf,UAAU,EACV,WAAW,EACX,QAAQ,EACR,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,QAAQ,EACR,cAAc,EACd,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * `@uptimizr/metrics` — the semantic metric registry (ADR 0051 §1).
3
+ *
4
+ * One machine-readable {@link MetricDefinition} per Uptimizr analytics metric:
5
+ * what it measures, the collector endpoint that serves it, the filters it
6
+ * accepts, the Zod schema of one row, per-column units and semantics, row
7
+ * limits, how to read the result, and what not to trust. Everything that used to
8
+ * restate the query surface by hand — the agent tool catalog
9
+ * (`@uptimizr/agent-core`), the MCP capabilities resource and the OpenAPI
10
+ * document, the docs tables — is **derived** from this package, so coverage
11
+ * cannot drift.
12
+ *
13
+ * **Dependency-free and browser-safe.** The only runtime dependencies are `zod`
14
+ * and `@uptimizr/schema` (a type-only import). No `node:` built-in, no DOM, no
15
+ * database driver: the registry used to live in `@uptimizr/db`, which depends on
16
+ * the ~37 MB `@duckdb/node-api` native binding that a browser bundle or an `npx`
17
+ * MCP client can never use.
18
+ *
19
+ * ```ts
20
+ * import { allMetrics, getMetric } from "@uptimizr/metrics";
21
+ *
22
+ * const metric = getMetric("top_meshes");
23
+ * metric?.endpoint?.path; // "/api/v1/meshes/top"
24
+ * metric?.row; // z.ZodObject — the shape of one row
25
+ * ```
26
+ */
27
+ export { AGGREGATION_BUILDER_NAMES, DIMENSION_COLUMNS, FILTER_TARGETS, METRIC_BY_BUILDER, METRIC_IDS, METRIC_REGISTRY, allMetrics, getMetric, isMetricId, isResourceMetric, metricForBuilder, } from "./registry.js";
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,UAAU,EACV,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,eAAe,CAAC"}