Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prombed

English | 简体中文

Prombed is a small, embeddable subset of Prometheus for diagnostic and performance tools. It scrapes /metrics, retains short-lived time-series data, and evaluates PromQL inside the host process—without requiring Prometheus to be installed or reachable in the target environment.

Prombed is not a replacement for the Prometheus server. It implements only the behavior required to analyze short diagnostic windows and fails explicitly for unsupported PromQL features instead of returning plausible but semantically different results.

Language implementations

Directory Status Runtime dependencies
typescript/ Available 0
go/ Planned -
python/ Planned -

All language implementations follow the same PromQL compatibility contract and share the Prometheus-derived input/output fixtures in conformance/.

How it works

Service /metrics ──scrape──> bounded in-memory TSDB ──PromQL──> Doctor charts / detectors
      local samples                                  └──────> perf harness assertions
  • Scrape: reads the Prometheus text exposition format with target labels, headers, timeouts, response-size limits, and metric-family allowlists.
  • Store: retains data in the current process with explicit retention, series, and per-series sample limits.
  • Query: returns the familiar Prometheus API success/data/resultType/result shape.
  • Lifecycle: releases all data when the process exits; it starts no database or Prometheus subprocess and writes nothing to disk.

A single ingest or scrapeOnce call captures only the current cumulative snapshot. Functions such as rate and increase require at least two samples, so callers must scrape periodically before evaluating them.

TypeScript quick start

npm install @compforge/prombed
import { Prombed } from "@compforge/prombed";

const metrics = new Prombed({
  retentionMs: 10 * 60_000,
  scrapeIntervalMs: 5_000,
  targets: [{
    url: "http://chat-server:8080/metrics",
    labels: { service: "chat-server" },
    metricNames: ["chat_api_requests_total", "chat_api_duration_seconds"],
  }],
});

await metrics.start();

const successRate = metrics.query(
  'sum(rate(chat_api_requests_total{status="success"}[1m])) / sum(rate(chat_api_requests_total[1m]))',
);
const latency = metrics.query(
  "histogram_quantile(0.95, sum by (le) (rate(chat_api_duration_seconds_bucket[1m])))",
);

metrics.stop();

See typescript/README.md for development, testing, and bundle-size checks.

Boundaries

Prombed owns scrape → store → query. Chart specifications, HTML bundles, business detector registration, and alert thresholds belong to Doctor; workloads and performance assertions belong to the perf harness. See the PromQL compatibility contract for the supported syntax and deliberate omissions.

Releases

Packages

Contributors

Languages