Skip to content
SEAMWAREPublic

About

Prometheus counters, gauges and histograms - atomics on the hot path, rendered on demand

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

corProm — Prometheus Metrics

Counters, gauges and histograms for a server whose metrics path must not allocate, block or take a lock: every update is an atomic on a fixed-point int64_t. Rendering happens only when the metrics are asked for — as Prometheus text, or as a corTree.

The only dependency is corTree (for corPromMetrics).

It is kprom under new names, moved onto corTree so that the coraine stack links one tree library rather than two.

API

CorPromMetric* reqs = corPromCounterCreate("requests_total", "Requests served");
CorPromMetric* conn = corPromGaugeCreate("connections", "Open connections");
double         b[]  = { 0.001, 0.01, 0.1, 1 };
CorPromMetric* lat  = corPromHistogramCreate("latency_seconds", "Latency", b, 4);

corPromCounterInc(reqs);
corPromGaugeAdd(conn, 1);
corPromHistogramObserve(lat, 0.004);

int   size = corPromRenderSize();
char* text = malloc(size);
corPromRender(text, size);                 // Prometheus text exposition format

CorNode* treeP = corPromMetrics(kaP);      // the same, as a tree (NULL: malloc)

Build

make di

About

Prometheus counters, gauges and histograms - atomics on the hot path, rendered on demand

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages