Move docs/ package mirror into document-navigator plugin
Relocate the ~6k-file docs tree from the repo root into plugins/document-navigator/docs/ so the plugin is self-contained and portable. docs/superpowers/ (specs and plans) stays at the repo root. Moved via cp+rm rather than git mv because directory rename() fails with EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the identical-content files at commit time. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
# Bitpacker Game OTel Instruments
|
||||
|
||||
<!-- begin:auto-docs -->
|
||||
_(no submodules)_
|
||||
<!-- end:auto-docs -->
|
||||
## Purpose
|
||||
|
||||
OTel meter, tracer, counter, and histogram declarations for `@suaveplan/bitpacker-game`. Ships canonical instrumentation primitives for the `GameBitPacker`'s pack/unpack boundaries plus the three sub-systems (`prediction`, `interpolation`, `reconciliation`). The instruments file is the canonical source of truth for the package's metric and span vocabulary so consumers wiring a game pipeline can attach observability without re-deriving names.
|
||||
|
||||
The metric and span names follow the suaveplan convention: tracer/meter named `@suaveplan/bitpacker-game`; spans named `bitpacker_game.<operation>` (`pack`, `unpack`, `predict`, `interpolate`, `reconcile`); counters named `bitpacker_game.<scope>.<metric>`. This shape matches the rest of the bitpacker family.
|
||||
|
||||
## Features
|
||||
|
||||
- `getBitPackerGameTracer()` — returns the package's tracer
|
||||
- `gameBitPackerOpsTotal` — counter labelled by `op` and `success`
|
||||
- `gameBitPackerOpDurationMs` — histogram of pack/unpack duration
|
||||
- `gameSubsystemOpsTotal` — counter labelled by `subsystem` and `success`
|
||||
- `BITPACKER_GAME_SPAN_NAMES` — five canonical span names
|
||||
|
||||
## Usage: Basic Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
BITPACKER_GAME_SPAN_NAMES,
|
||||
gameBitPackerOpsTotal,
|
||||
getBitPackerGameTracer,
|
||||
} from "@suaveplan/bitpacker-game";
|
||||
|
||||
const tracer = getBitPackerGameTracer();
|
||||
tracer.startActiveSpan(BITPACKER_GAME_SPAN_NAMES.pack, (span) => {
|
||||
try {
|
||||
// pack work
|
||||
gameBitPackerOpsTotal.add(1, { op: "pack", success: "true" });
|
||||
} finally {
|
||||
span.end();
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Usage: Advanced Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
BITPACKER_GAME_SPAN_NAMES,
|
||||
gameSubsystemOpsTotal,
|
||||
getBitPackerGameTracer,
|
||||
} from "@suaveplan/bitpacker-game";
|
||||
|
||||
function runPredict(state: unknown) {
|
||||
const tracer = getBitPackerGameTracer();
|
||||
return tracer.startActiveSpan(
|
||||
BITPACKER_GAME_SPAN_NAMES.predict,
|
||||
(span) => {
|
||||
try {
|
||||
// predict
|
||||
gameSubsystemOpsTotal.add(1, {
|
||||
subsystem: "prediction",
|
||||
success: "true",
|
||||
});
|
||||
return state;
|
||||
} finally {
|
||||
span.end();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
### `getBitPackerGameTracer(): Tracer`
|
||||
|
||||
Returns the OTel `Tracer` instance for the package.
|
||||
|
||||
### `gameBitPackerOpsTotal: Counter`
|
||||
|
||||
Counter labelled by `op: "pack" | "unpack"` and `success: "true" | "false"`.
|
||||
|
||||
### `gameBitPackerOpDurationMs: Histogram`
|
||||
|
||||
Histogram of elapsed milliseconds per pack/unpack call, labelled by `op`.
|
||||
|
||||
### `gameSubsystemOpsTotal: Counter`
|
||||
|
||||
Counter labelled by `subsystem: "prediction" | "interpolation" | "reconciliation"` and `success`.
|
||||
|
||||
### `BITPACKER_GAME_SPAN_NAMES`
|
||||
|
||||
Const map: `{ pack, unpack, predict, interpolate, reconcile }` → canonical span names.
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
- **Five sub-spans, one parent.** The pack/unpack span is the parent; predict/interpolate/reconcile spans are children when called from inside the pack/unpack hot path. Standalone calls produce a top-level span of the corresponding name.
|
||||
- **No per-frame spans.** The game subsystems run at frame rate on real-time pipelines; one span per frame would explode trace volume. The counters fire per frame; the spans are reserved for boundary entries.
|
||||
Reference in New Issue
Block a user