kempnerpulse.reader.prometheus¶
Layer 1 (Read) — Prometheus backend (dcgm-exporter /metrics).
Scrapes a dcgm-exporter HTTP endpoint (or reads a saved exposition-format
file) and emits one RawRecord per GPU, keyed by the metric names the
exporter publishes. Source labels (gpu, UUID, modelName, …) ride
along in the same fields mapping as string values; Layer 2 separates metric
values from identity labels.
- Entry points:
parse_prometheus_records— pure text ->RawRecordparser.load_source— fetch the exposition text (HTTP URL or local file).PrometheusBackend— a scrape-per-pollBackendimplementation.
Functions
|
Return exposition-format text from an HTTP(S) URL or a local file path. |
|
Parse exposition text into |
Classes
|
- kempnerpulse.reader.prometheus.load_source(source, timeout=5.0)[source]¶
Return exposition-format text from an HTTP(S) URL or a local file path.
- kempnerpulse.reader.prometheus.parse_prometheus_records(text, *, source_version='exporter', timestamp=None, wallclock=None)[source]¶
Parse exposition text into
RawRecordobjects, one per labelled entity.A metric line’s entity key is its
gpulabel (falling back toUUIDthendevice); lines without one are skipped. Bare (unlabelled) metric lines are grouped under the"global"entity. The entity’s labels are carried infieldsas string values alongside the numeric metrics. All records share onetimestamp/wallclock.
- class kempnerpulse.reader.prometheus.PrometheusBackend[source]¶
Bases:
objectBackendthat scrapes the exporter once per poll interval.Unlike the dcgmi backend there is no long-lived subprocess: each pass through
streamperforms one scrape and yields that scrape’s records, then sleepspoll_secondsbefore the next.dcgm-exporterrefreshes profiling fields on its own (~30 s) scrape cycle, which sets the true ceiling on useful poll rates.- open(config)[source]¶
- Parameters:
config (ReaderConfig)
- Return type:
None
- property caps: BackendCaps¶