Skip to main content

Prometheus Pushgateway

@sntxrr/prometheus-pushgatewayv2026.08.20.1· 2d agoMODELS
01README

Push metrics from a scheduled swamp method into a Prometheus Pushgateway. Scheduled jobs are exactly what Pushgateway exists for: a batch that runs, computes numbers, and exits long before any scrape could reach it. The @sntxrr/prometheus/pushgateway model's push method takes a flat {name, value, labels} series — the shape several models already emit alongside their verdicts — renders it as text exposition format, and writes it to a grouping key. Defaults to PUT so a series that disappears from the source disappears from the gateway, rather than lingering at its last value forever. Validates metric and label names and rejects non-finite values before sending, because Pushgateway answers 400 without naming the offending series and a single NaN discards the whole batch. Handles the base64 grouping-key escape for values containing a slash or empty values, which would otherwise corrupt or collapse a path segment. Emits an optional heartbeat counter, because pushed metrics go stale silently: the gateway serves the last value forever, so a job that stops running leaves every dashboard green while nothing is being checked.

02Models1
@sntxrr/prometheus/pushgatewayv2026.08.20.1prometheus_pushgateway.ts

Global Arguments

ArgumentTypeDescription
urlstringPushgateway base URL, e.g. http://192.0.2.10:9091 (no trailing path).
jobstringDefault `job` label for the grouping key. Overridable per push.
fn push(metrics: array, job?: string, grouping: record, replace: boolean, heartbeat: boolean)
Render a flat metric series as Prometheus text exposition format and write it to a Pushgateway grouping key. Defaults to PUT, which replaces every series in the group so removed series disappear rather than lingering at their last value.
ArgumentTypeDescription
metricsarrayThe series to push. Typically taken straight from another model's
job?stringOverride the model's default `job` label.
groupingrecordExtra grouping-key labels beyond `job`, e.g. {instance: 'site-a'}.
replacebooleanPUT (replace the whole group) when true; POST when false. Leave
heartbeatbooleanAlso emit `swamp_push_heartbeat_total`, so staleness can be alerted

Resources

push_result(infinite)— Outcome of one push to a Pushgateway grouping key.
03Stats
A
100 / 100
Downloads
0
Archive size
8.6 KB
  • Has README or module doc2/2earned
  • README has a code example1/1earned
  • README is substantive1/1earned
  • Most symbols documented1/1earned
  • No slow types (deprecated)1/1earned
  • Dependencies pass trust audit2/2earned
  • Has description1/1earned
  • Platform support declared (or universal)2/2earned
  • License declared1/1earned
  • Verified public repository2/2earned
04Platforms
05Labels