@cobol-ts/metrics 0.0.13 → 0.0.16
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/README.md +23 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
# @cobol-ts/metrics
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Expose constant-name, opt-in operation counters for projection and cursor hot paths.
|
|
4
4
|
|
|
5
|
-
Counters
|
|
5
|
+
Counters reflect explicit `put` calls, not bytes allocated or wall-clock timings.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Example
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
```typescript
|
|
10
|
+
import {MemoryMetrics, METRIC} from '@cobol-ts/metrics'
|
|
11
|
+
|
|
12
|
+
const metrics = new MemoryMetrics()
|
|
13
|
+
metrics.put(METRIC.RECORD_BORROW)
|
|
14
|
+
metrics.put(METRIC.RECORD_BORROW)
|
|
15
|
+
const borrows = metrics.get(METRIC.RECORD_BORROW) // 2
|
|
16
|
+
const snapshot = metrics.snapshot() // detached from later resets
|
|
17
|
+
metrics.reset()
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Use `NULL_METRICS` in production when operation counters are disabled. Names in `METRIC` are fixed literals so instrumented hot paths do not format labels per record. These counters report operations, not allocated bytes or elapsed time.
|
|
21
|
+
|
|
22
|
+
## Source and tests
|
|
23
|
+
|
|
24
|
+
**Public entry points:** [metrics.ts](./src/metrics.ts).
|
|
25
|
+
|
|
26
|
+
**Tests:** [metrics.spec.ts](src/metrics.spec.ts)
|
|
27
|
+
|
|
28
|
+
**Related:** [@cobol-ts/cursor-projection](../../cursor-loader/projection/README.md) · [@cobol-ts/cursor-loader-benchmark](../../cursor-loader/cursor-loader-benchmark/README.md).
|