1001Ferramentas
📈Dev

Prometheus Metric Exposition Generator

Feed a name, a type, help text and a value; out come the HELP, TYPE and sample lines, with the name checked against the naming regex and _total hints.

YAML

A metric in the Prometheus exposition format

The format Prometheus reads is plain text and deceptively strict: one help line, one type line and one per sample. It looks like something you can assemble by concatenating strings, and that is where the metric starts being rejected by the collector with nobody understanding why — almost always over a character the grammar does not accept.

Fill in name, type, help text and value, and the page assembles the block while validating what matters. The name has its own grammar: it starts with a letter, underscore or colon, and continues with those plus digits. Hyphens, spaces and accents make the line invalid — and the hyphen is the commonest mistake from people coming from other metric systems, where it is conventional.

The page also flags the naming conventions, which are not mandatory but matter to whoever reads the dashboard later: counters end in total, duration metrics end in seconds with the unit in the name, and the counter suffix should not appear on a gauge. The unit belongs in the name because Prometheus stores it nowhere else — if it is not there, nobody knows whether that number is milliseconds or seconds.

Frequently asked questions

What is the difference between a counter and a gauge?
A counter only rises, and resets when the process restarts — it suits totals of requests, errors, bytes. A gauge goes up and down — it suits memory usage, temperature, queue depth. The choice changes which functions make sense: the rate function only applies to counters.
Why does the unit go in the name?
Because the format holds no unit field. Without it in the name, whoever queries six months later cannot tell seconds from milliseconds, and the official convention is always using base units — seconds and bytes, not milliseconds and kilobytes.
How do I add labels?
In braces after the name, as comma-separated key-value pairs with the value always quoted. The caution is cardinality: a label whose value varies widely, such as a user or request identifier, multiplies the series and drags the server down.

Related Tools