diff options
| author | Adam Malczewski <[email protected]> | 2026-06-10 10:16:20 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-10 10:16:20 +0900 |
| commit | 80e14ab59732aabbf06035d13138500f133e921d (patch) | |
| tree | be3c1c118ceeb207d7ff218aa5d7ace06e683710 /packages/host-bin | |
| parent | 5ff460688519e48fd0bfab893ebaed4258dee789 (diff) | |
| download | dispatch-80e14ab59732aabbf06035d13138500f133e921d.tar.gz dispatch-80e14ab59732aabbf06035d13138500f133e921d.zip | |
feat: per-model throughput (tok/s) tracking + metrics endpoint
New throughput-store extension records one token-weighted sample per turn
(model, output tokens, pure generation time = Σ step genTotalMs) into a
day-bucketed KV store, and aggregates per-model tok/s = Σtokens / Σgen-seconds
over a day/week/month (server-local boundaries; week = ISO Mon–Sun).
transport-http records a sample per turn (logged) and serves
GET /metrics/throughput?period=day|week|month&date=<...>. The response is typed
as transport-contract's ThroughputResponse, so store/wire drift is a compile
error. Pure period + aggregate logic fully unit-tested.
Diffstat (limited to 'packages/host-bin')
| -rw-r--r-- | packages/host-bin/package.json | 1 | ||||
| -rw-r--r-- | packages/host-bin/src/main.ts | 2 | ||||
| -rw-r--r-- | packages/host-bin/tsconfig.json | 1 |
3 files changed, 4 insertions, 0 deletions
diff --git a/packages/host-bin/package.json b/packages/host-bin/package.json index 65e986d..ccaddd2 100644 --- a/packages/host-bin/package.json +++ b/packages/host-bin/package.json @@ -11,6 +11,7 @@ "@dispatch/credential-store": "workspace:*", "@dispatch/provider-openai-compat": "workspace:*", "@dispatch/session-orchestrator": "workspace:*", + "@dispatch/throughput-store": "workspace:*", "@dispatch/transport-http": "workspace:*", "@dispatch/tool-read-file": "workspace:*", "@dispatch/journal-sink": "workspace:*", diff --git a/packages/host-bin/src/main.ts b/packages/host-bin/src/main.ts index ec51d11..7f219d1 100644 --- a/packages/host-bin/src/main.ts +++ b/packages/host-bin/src/main.ts @@ -23,6 +23,7 @@ import { extension as sessionOrchestratorExt } from "@dispatch/session-orchestra import { createSqliteStorage, extension as storageSqliteExt } from "@dispatch/storage-sqlite"; import { createLoadedExtensionsExtension } from "@dispatch/surface-loaded-extensions"; import { createSurfaceRegistryExtension } from "@dispatch/surface-registry"; +import { extension as throughputStoreExt } from "@dispatch/throughput-store"; import { extension as toolReadFileExt } from "@dispatch/tool-read-file"; import { createTransportHttpExtension } from "@dispatch/transport-http"; import { createTransportWsExtension } from "@dispatch/transport-ws"; @@ -62,6 +63,7 @@ const CORE_EXTENSIONS: readonly Extension[] = [ authApikeyExt, providerOpenaiCompatExt, toolReadFileExt, + throughputStoreExt, sessionOrchestratorExt, createTransportHttpExtension(), // Surface extensions — dependency order: surface-registry first, then consumers. diff --git a/packages/host-bin/tsconfig.json b/packages/host-bin/tsconfig.json index 3630394..53762c7 100644 --- a/packages/host-bin/tsconfig.json +++ b/packages/host-bin/tsconfig.json @@ -8,6 +8,7 @@ { "path": "../surface-loaded-extensions" }, { "path": "../surface-registry" }, { "path": "../tool-read-file" }, + { "path": "../throughput-store" }, { "path": "../transport-http" }, { "path": "../transport-ws" } ] |
