Metrics Engine
Turns an event stream into outcome metrics and demand forecasts.
Status, in the repository's words: Version 1.3.0, dated 2026-11-10 in the changelog: security review fixes.
What it is
A small FastAPI service with a dashboard.
It turns a stream of agent and task lifecycle events into outcome metrics and forecasts.
The forecasts of demand and cost are statistical; no machine learning is used.
Besides reading from the event router, it can be fed directly by any producer that posts task lifecycle events to it.
What it does today
- Reads events from the event router through the router's API and does not open the router's database.
- Other producers can send task lifecycle events to it directly over HTTP.
- Computes outcome metrics such as completion rate and time to resolution.
- There are eight outcome metrics, all worked out from the stored task events.
- Builds hourly and weekly demand curves, and cost forecasts for the 24h, 7d and 30d horizons.
- Keeps detailed events for 90 days by default; the period is a setting.
- The API needs a shared token: until one is set, every route except the health check, the dashboard page and the signed backfill answers 503.
- The cost backfill endpoint is protected by a shared signing secret and stays off, answering 503, until that secret is set.
- If the event router is down or refuses the token, the service keeps running, logs the reason and retries with growing waits.
- Generates a 7-day digest of outcomes and predictions on request and saves it as a JSON file.
What it ships
- A health endpoint, JSON metrics APIs and an HTML dashboard.
- A single SQLite database holds everything it stores.
- A Dockerfile based on python:3.12-slim that runs the service as a non-root user.
- Auto-generated API documentation, served while the app is running.
What it needs
- Python 3.12.
- No database server: data is kept in a local SQLite file.
- Pull ingest needs event router 1.1.0 or later.
- The router is optional: with the router address left empty, pull ingest is off and events are pushed to the service instead.
- Seven pinned Python packages are its direct runtime dependencies.
Install
Copied from the repository's README. This site has not run these commands.
pip install -r requirements.txt export EVENT_ROUTER_URL=http://localhost:8085 # event-router 1.1.0+ export EVENT_ROUTER_TOKEN_FILE=/path/to/event-router-token # or EVENT_ROUTER_TOKEN export METRICS_API_TOKEN="$(openssl rand -hex 32)" # required: the API answers 503 without it uvicorn app.main:app --host 127.0.0.1 --port 8086
Limits and known issues, as the repository lists them
As listed on branch main of BulletproofSoftwareAI/bulletproof-metrics-engine on 2026-11-30, commit 7ec2b5d: newer than the version described above.
- There is one API token for all callers, with no roles: anyone holding it can read and write.
- The service speaks plain HTTP only, so it should be published on loopback or behind a proxy that terminates TLS.
- The container image has HIGH findings in base operating-system packages for which no fixed version has been published; they are accepted until a fix ships.
- Forecast-accuracy (MAPE) monitoring is not implemented.
- Model pricing settings are configuration only; they are not yet applied in the cost calculations.
- Daily roll-up totals are written when old events are purged, but no endpoint reads them.
Works with
Documents in the repository
Where each statement on this page comes from
Read from BulletproofSoftwareAI/bulletproof-metrics-engine, branch main, commit a29de4d; the limits and known issues from BulletproofSoftwareAI/bulletproof-metrics-engine, branch main, commit 7ec2b5d, read on 2026-11-30. File and line for each statement:
- Turns an event stream into outcome metrics and demand forecasts.
README.md:9 - Version 1.3.0, dated 2026-11-10 in the changelog: security review fixes.
CHANGELOG.md:7 - 1.3.0
app/__init__.py:3 - 2026-11-10
CHANGELOG.md:7 - Apache-2.0
README.md:144 - A small FastAPI service with a dashboard.
README.md:10 - It turns a stream of agent and task lifecycle events into outcome metrics and forecasts.
docs/OVERVIEW.md:6 - The forecasts of demand and cost are statistical; no machine learning is used.
docs/OVERVIEW.md:11 - Besides reading from the event router, it can be fed directly by any producer that posts task lifecycle events to it.
docs/OVERVIEW.md:20 - Reads events from the event router through the router's API and does not open the router's database.
docs/OVERVIEW.md:118 - Other producers can send task lifecycle events to it directly over HTTP.
docs/OVERVIEW.md:47 - Computes outcome metrics such as completion rate and time to resolution.
README.md:17 - There are eight outcome metrics, all worked out from the stored task events.
docs/OVERVIEW.md:81 - Builds hourly and weekly demand curves, and cost forecasts for the 24h, 7d and 30d horizons.
README.md:22 - Keeps detailed events for 90 days by default; the period is a setting.
README.md:96 - The API needs a shared token: until one is set, every route except the health check, the dashboard page and the signed backfill answers 503.
README.md:86 - The cost backfill endpoint is protected by a shared signing secret and stays off, answering 503, until that secret is set.
README.md:99 - If the event router is down or refuses the token, the service keeps running, logs the reason and retries with growing waits.
README.md:76 - Generates a 7-day digest of outcomes and predictions on request and saves it as a JSON file.
docs/HOW-TO-USE.md:174 - A health endpoint, JSON metrics APIs and an HTML dashboard.
README.md:23 - A single SQLite database holds everything it stores.
docs/OVERVIEW.md:52 - A Dockerfile based on python:3.12-slim that runs the service as a non-root user.
docs/OVERVIEW.md:141 - Auto-generated API documentation, served while the app is running.
docs/HOW-TO-USE.md:207 - Python 3.12.
docs/INSTALL.md:9 - No database server: data is kept in a local SQLite file.
docs/INSTALL.md:10 - Pull ingest needs event router 1.1.0 or later.
docs/ADMINISTRATOR.md:143 - The router is optional: with the router address left empty, pull ingest is off and events are pushed to the service instead.
README.md:74 - Seven pinned Python packages are its direct runtime dependencies.
docs/SBOM.md:10 - There is one API token for all callers, with no roles: anyone holding it can read and write.
docs/ADMINISTRATOR.md:160 at 7ec2b5d - The service speaks plain HTTP only, so it should be published on loopback or behind a proxy that terminates TLS.
docs/ADMINISTRATOR.md:161 at 7ec2b5d - The container image has HIGH findings in base operating-system packages for which no fixed version has been published; they are accepted until a fix ships.
docs/SECURITY-ACCEPTED-RISK.md:6 at 7ec2b5d - Forecast-accuracy (MAPE) monitoring is not implemented.
docs/ADMINISTRATOR.md:198 at 7ec2b5d - Model pricing settings are configuration only; they are not yet applied in the cost calculations.
docs/ADMINISTRATOR.md:194 at 7ec2b5d - Daily roll-up totals are written when old events are purged, but no endpoint reads them.
README.md:170 at 7ec2b5d - Reads the event router's routing log through the router's authenticated HTTP API.
docs/OVERVIEW.md:17 - The optional backfill fills in missing cost and token data from agent-economics candidates.
README.md:25 - Install section of the README
README.md:28
Bulletproof suite v1.0.0 pins tag v1.3.0, commit a29de4d, tagged 2026-11-10.